Class: Contentful::Management::EditorInterface

Inherits:
Object
  • Object
show all
Includes:
Resource, Resource::EnvironmentAware, Resource::Refresher, Resource::SystemProperties
Defined in:
lib/contentful/management/editor_interface.rb

Overview

Resource class for Editor Interface.

Instance Attribute Summary

Attributes included from Resource::SystemProperties

#sys

Attributes included from Resource

#client, #properties, #raw_object, #request

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Resource::EnvironmentAware

#environment_id

Methods included from Resource::Refresher

#reload

Methods included from Resource

#array?, #default_locale, #environment_id, #fields, #nested_locale_fields?, #resource?, #save, #sys

Class Method Details

.createObject

Creates an EditorInterface.

Not Supported



39
40
41
# File 'lib/contentful/management/editor_interface.rb', line 39

def self.create(*)
  fail 'Not supported'
end

.default(client, space_id, environment_id, content_type_id) ⇒ Contentful::Management::EditorInterface

Gets the Default Editor Interface

Parameters:

Returns:



25
26
27
# 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

.findObject

Finds an EditorInterface.

Not Supported



32
33
34
# File 'lib/contentful/management/editor_interface.rb', line 32

def self.find(*)
  fail 'Not supported'
end

Instance Method Details

#destroyObject

Destroys an EditorInterface.

Not Supported



86
87
88
# File 'lib/contentful/management/editor_interface.rb', line 86

def destroy
  fail 'Not supported'
end

#update(attributes) ⇒ Contentful::Management::EditorInterface

Updates an Editor Interface

Parameters:

  • attributes (Hash)

Options Hash (attributes):

  • :controls, (Array<Hash>)

    :sidebar

Returns:



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# 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.fetch(:sidebar, sidebar)
    }.compact,
    version: sys[:version]
  )
end