class Contentful::Management::EditorInterface

Resource class for Editor Interface.

Public Class Methods

build_endpoint(endpoint_options) click to toggle source

@private

# 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)
  content_type_id = endpoint_options.fetch(:content_type_id)

  "spaces/#{space_id}/environments/#{environment_id}/content_types/#{content_type_id}/editor_interface"
end
create(*) click to toggle source

Creates an EditorInterface.

Not Supported

# File lib/contentful/management/editor_interface.rb, line 39
def self.create(*)
  fail 'Not supported'
end
create_attributes(_client, attributes) click to toggle source

@private

# File lib/contentful/management/editor_interface.rb, line 44
def self.create_attributes(_client, attributes)
  {
    'controls' => attributes.fetch(:controls),
    'sidebar' => attributes.fetch(:sidebar)
  }
end
default(client, space_id, environment_id, content_type_id) click to toggle source

Gets the Default Editor Interface

@param [Contentful::Management::Client] client @param [String] space_id @param [String] content_type_id

@return [Contentful::Management::EditorInterface]

# 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
find(*) click to toggle source

Finds an EditorInterface.

Not Supported

# File lib/contentful/management/editor_interface.rb, line 32
def self.find(*)
  fail 'Not supported'
end

Public Instance Methods

destroy() click to toggle source

Destroys an EditorInterface.

Not Supported

# File lib/contentful/management/editor_interface.rb, line 86
def destroy
  fail 'Not supported'
end
update(attributes) click to toggle source

Updates an Editor Interface

@param [Hash] attributes @option attributes [Array<Hash>] :controls, :sidebar

@return [Contentful::Management::EditorInterface]

# File lib/contentful/management/editor_interface.rb, line 66
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[:sidebar] || sidebar
    },
    version: sys[:version]
  )
end

Protected Instance Methods

query_attributes(attributes) click to toggle source
# File lib/contentful/management/editor_interface.rb, line 96
def query_attributes(attributes)
  {
    controls: controls,
    sidebar: sidebar
  }.merge(
    attributes.transform_keys(&:to_sym)
  )
end
refresh_find() click to toggle source
# File lib/contentful/management/editor_interface.rb, line 92
def refresh_find
  self.class.default(client, space.id, environment_id, content_type.id)
end