Skip to content

Commit

Permalink
Adds getter/setter for EditorInterface#sidebar property (contentful#231)
Browse files Browse the repository at this point in the history
* added getter and setter for sidebar on editor_interface

* Updated changelog
  • Loading branch information
rubydog committed Aug 31, 2021
1 parent e341019 commit 46db416
Show file tree
Hide file tree
Showing 4 changed files with 596 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Change Log

## Master
* Added getter/setter for EditorInterface#sidebar

## 3.2.0
* Added support for parameters on Users API. [#227](https://github.com/contentful/contentful-management.rb/pull/227)
Expand Down
16 changes: 12 additions & 4 deletions lib/contentful/management/editor_interface.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class EditorInterface
include Contentful::Management::Resource::EnvironmentAware

property :controls, :array
property :sidebar, :array

# Gets the Default Editor Interface
#
Expand Down Expand Up @@ -39,7 +40,10 @@ def self.create(*)

# @private
def self.create_attributes(_client, attributes)
{ 'controls' => attributes.fetch(:controls) }
{
'controls' => attributes.fetch(:controls),
'sidebar' => attributes.fetch(:sidebar)
}
end

# @private
Expand All @@ -54,7 +58,7 @@ def self.build_endpoint(endpoint_options)
# Updates an Editor Interface
#
# @param [Hash] attributes
# @option attributes [Array<Hash>] :controls
# @option attributes [Array<Hash>] :controls, :sidebar
#
# @return [Contentful::Management::EditorInterface]
def update(attributes)
Expand All @@ -66,7 +70,10 @@ def update(attributes)
content_type_id: content_type.id,
editor_id: id
},
{ 'controls' => attributes[:controls] || controls },
{
'controls' => attributes[:controls] || controls,
'sidebar' => attributes[:sidebar] || sidebar
},
version: sys[:version]
)
end
Expand All @@ -86,7 +93,8 @@ def refresh_find

def query_attributes(attributes)
{
controls: controls
controls: controls,
sidebar: sidebar
}.merge(
attributes.each_with_object({}) { |(k, v), result| result[k.to_sym] = v }
)
Expand Down
Loading

0 comments on commit 46db416

Please sign in to comment.