class Contentful::Management::EditorInterface
Resource
class for Editor Interface.
Public Class Methods
Source
# File lib/contentful/management/editor_interface.rb, line 52 def self.build_endpoint(endpoint_options) space_id = endpoint_options.fetch(:space_id) environment_id = endpoint_options.fetch(:environment_id) base_path = "spaces/#{space_id}/environments/#{environment_id}" if endpoint_options.key?(:content_type_id) content_type_id = endpoint_options.fetch(:content_type_id) "#{base_path}/content_types/#{content_type_id}/editor_interface" else "#{base_path}/editor_interfaces" end end
@private
Source
# File lib/contentful/management/editor_interface.rb, line 39 def self.create(*) fail 'Not supported' end
Creates an EditorInterface
.
Not Supported
Source
# File lib/contentful/management/editor_interface.rb, line 44 def self.create_attributes(_client, attributes) { 'controls' => attributes.fetch(:controls), 'sidebar' => attributes.fetch(:sidebar) } end
@private
Source
# File lib/contentful/management/editor_interface.rb, line 25 def self.default(client, space_id, environment_id, content_type_id) ClientEditorInterfaceMethodsFactory.new(client, space_id, environment_id, content_type_id).default end
Gets the Default Editor Interface
@param [Contentful::Management::Client] client @param [String] space_id @param [String] content_type_id
@return [Contentful::Management::EditorInterface]
Source
# File lib/contentful/management/editor_interface.rb, line 32 def self.find(*) fail 'Not supported' end
Finds an EditorInterface
.
Not Supported
Public Instance Methods
Source
# File lib/contentful/management/editor_interface.rb, line 91 def destroy fail 'Not supported' end
Destroys an EditorInterface
.
Not Supported
Source
# File lib/contentful/management/editor_interface.rb, line 71 def update(attributes) ResourceRequester.new(client, self.class).update( self, { space_id: space.id, environment_id: environment_id, content_type_id: content_type.id, editor_id: id }, { 'controls' => attributes[:controls] || controls, 'sidebar' => attributes.fetch(:sidebar, sidebar) }.compact, version: sys[:version] ) end
Updates an Editor Interface
@param [Hash] attributes @option attributes [Array<Hash>] :controls, :sidebar
@return [Contentful::Management::EditorInterface]
Protected Instance Methods
Source
# File lib/contentful/management/editor_interface.rb, line 101 def query_attributes(attributes) { controls: controls, sidebar: sidebar }.merge( attributes.transform_keys(&:to_sym) ) end
Source
# File lib/contentful/management/editor_interface.rb, line 97 def refresh_find self.class.default(client, space.id, environment_id, content_type.id) end