class Contentful::Management::Environment
Resource
class for Environment
. @see _ www.contentful.com/developers/documentation/content-management-api/#resources-environments
Public Class Methods
Source
# File lib/contentful/management/environment.rb, line 23 def self.build_endpoint(endpoint_options) space_id = endpoint_options.fetch(:space_id) environment_id = endpoint_options.fetch(:resource_id, endpoint_options.fetch(:environment_id, nil)) endpoint = "spaces/#{space_id}/environments" endpoint = "#{endpoint}/#{environment_id}" if environment_id endpoint end
@private
Source
# File lib/contentful/management/environment.rb, line 40 def self.create(client, space_id, attributes = {}) super(client, space_id, nil, attributes) end
Creates an environment.
@param [Contentful::Management::Client] client @param [String] space_id @param [Hash] attributes @see _ README for full attribute list for each resource.
@return [Contentful::Management::Environment]
Source
# File lib/contentful/management/environment.rb, line 56 def self.create_attributes(_client, attributes) return {} if attributes.nil? || attributes.empty? { 'name' => attributes[:name] || attributes['name'] } end
@private
Source
# File lib/contentful/management/environment.rb, line 65 def self.create_headers(_client, attributes, _instance = nil) return {} unless attributes[:source_environment_id] || attributes['source_environment_id'] { 'X-Contentful-Source-Environment' => attributes[:source_environment_id] || attributes['source_environment_id'] } end
@private
Source
# File lib/contentful/management/environment.rb, line 51 def self.find(client, space_id, environment_id) super(client, space_id, nil, environment_id) end
Finds an environment by ID.
@param [Contentful::Management::Client] client @param [String] space_id @param [String] environment_id
@return [Contentful::Management::Environment]
Public Instance Methods
Source
# File lib/contentful/management/environment.rb, line 87 def assets EnvironmentAssetMethodsFactory.new(self) end
Allows manipulation of assets in context of the current environment Allows listing all assets for the current environment, creating new and finding one by ID. @see _ README for details.
@return [Contentful::Management::EnvironmentAssetMethodsFactory]
Source
# File lib/contentful/management/environment.rb, line 96 def content_types EnvironmentContentTypeMethodsFactory.new(self) end
Allows manipulation of content types in context of the current environment Allows listing all content types for the current environment, creating new and finding one by ID. @see _ README for details.
@return [Contentful::Management::EnvironmentContentTypeMethodsFactory]
Source
# File lib/contentful/management/environment.rb, line 144 def default_locale self.found_locale ||= find_locale end
Retrieves Default Locale
for current Environment
and leaves it cached
@return [String]
Source
# File lib/contentful/management/environment.rb, line 123 def editor_interfaces EnvironmentEditorInterfaceMethodsFactory.new(self) end
Allows manipulation of editor interfaces in context of the current environment Allows listing of editor interfaces for the current environment. @see _ README for details.
@return [Contentful::Management::EnvironmentEditorInterfaceMethodsFactory]
Source
# File lib/contentful/management/environment.rb, line 78 def entries EnvironmentEntryMethodsFactory.new(self) end
Allows manipulation of entries in context of the current environment Allows listing all entries for the current environment, creating new and finding one by ID. @see _ README for details.
@return [Contentful::Management::EnvironmentEntryMethodsFactory]
Source
# File lib/contentful/management/environment.rb, line 137 def environment_id id end
Gets the environment ID
Source
Source
# File lib/contentful/management/environment.rb, line 105 def locales EnvironmentLocaleMethodsFactory.new(self) end
Allows manipulation of locales in context of the current environment Allows listing all locales for the current environment, creating new and finding one by ID. @see _ README for details.
@return [Contentful::Management::EnvironmentLocaleMethodsFactory]
Source
# File lib/contentful/management/environment.rb, line 160 def refresh_find self.class.find(client, space.id, id) end
@private
Source
# File lib/contentful/management/environment.rb, line 114 def ui_extensions EnvironmentUIExtensionMethodsFactory.new(self) end
Allows manipulation of UI extensions in context of the current environment Allows listing all UI extensions for the current environment, creating new and finding one by ID. @see _ README for details.
@return [Contentful::Management::EnvironmentUIExtensionMethodsFactory]
Protected Instance Methods
Source
# File lib/contentful/management/environment.rb, line 166 def query_attributes(attributes) { name: name }.merge(attributes) end