lib/contentful/management/editor_interface.rb in contentful-management-1.10.1 vs lib/contentful/management/editor_interface.rb in contentful-management-2.0.0
- old
+ new
@@ -1,26 +1,28 @@
require_relative 'resource'
+require_relative 'resource/environment_aware'
module Contentful
module Management
# Resource class for Editor Interface.
class EditorInterface
include Contentful::Management::Resource
- include Contentful::Management::Resource::SystemProperties
include Contentful::Management::Resource::Refresher
+ include Contentful::Management::Resource::SystemProperties
+ include Contentful::Management::Resource::EnvironmentAware
property :controls, :array
# Gets the Default Editor Interface
#
# @param [Contentful::Management::Client] client
# @param [String] space_id
# @param [String] content_type_id
#
# @return [Contentful::Management::EditorInterface]
- def self.default(client, space_id, content_type_id)
- ClientEditorInterfaceMethodsFactory.new(client).default(space_id, content_type_id)
+ def self.default(client, space_id, environment_id, content_type_id)
+ ClientEditorInterfaceMethodsFactory.new(client, space_id, environment_id, content_type_id).default
end
# Finds an EditorInterface.
#
# Not Supported
@@ -41,13 +43,14 @@
end
# @private
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}/content_types/#{content_type_id}/editor_interface"
+ "spaces/#{space_id}/environments/#{environment_id}/content_types/#{content_type_id}/editor_interface"
end
# Updates an Editor Interface
#
# @param [Hash] attributes
@@ -55,11 +58,16 @@
#
# @return [Contentful::Management::EditorInterface]
def update(attributes)
ResourceRequester.new(client, self.class).update(
self,
- { space_id: space.id, content_type_id: content_type.id, editor_id: id },
+ {
+ space_id: space.id,
+ environment_id: environment_id,
+ content_type_id: content_type.id,
+ editor_id: id
+ },
{ 'controls' => attributes.fetch(:controls) },
version: sys[:version]
)
end
@@ -71,10 +79,10 @@
end
protected
def refresh_find
- self.class.default(client, space.id, content_type.id)
+ self.class.default(client, space.id, environment_id, content_type.id)
end
def query_attributes(attributes)
attributes.each_with_object({}) { |(k, v), result| result[k.to_sym] = v }
end