Class: Contentful::Management::Environment
- Inherits:
-
Object
- Object
- Contentful::Management::Environment
- Includes:
- Resource, Resource::Refresher, Resource::SystemProperties
- Defined in:
- lib/contentful/management/environment.rb
Overview
Resource class for Environment.
Instance Attribute Summary
Attributes included from Resource::SystemProperties
Attributes included from Resource
#client, #properties, #raw_object, #request
Class Method Summary collapse
-
.create(client, space_id, attributes = {}) ⇒ Contentful::Management::Environment
Creates an environment.
-
.find(client, space_id, environment_id) ⇒ Contentful::Management::Environment
Finds an environment by ID.
Instance Method Summary collapse
-
#assets ⇒ Contentful::Management::EnvironmentAssetMethodsFactory
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.
-
#content_types ⇒ Contentful::Management::EnvironmentContentTypeMethodsFactory
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.
-
#default_locale ⇒ String
Retrieves Default Locale for current Environment and leaves it cached.
-
#editor_interfaces ⇒ Contentful::Management::EnvironmentEditorInterfaceMethodsFactory
Allows manipulation of editor interfaces in context of the current environment Allows listing of editor interfaces for the current environment.
-
#entries ⇒ Contentful::Management::EnvironmentEntryMethodsFactory
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.
-
#environment_id ⇒ Object
Gets the environment ID.
-
#find_locale ⇒ String
Finds Default Locale Code for current Space This request makes an API call to the Locale endpoint.
-
#locales ⇒ Contentful::Management::EnvironmentLocaleMethodsFactory
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.
-
#ui_extensions ⇒ Contentful::Management::EnvironmentUIExtensionMethodsFactory
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.
Methods included from Resource::Refresher
Methods included from Resource
#array?, #destroy, #fields, #nested_locale_fields?, #resource?, #sys, #update
Class Method Details
.create(client, space_id, attributes = {}) ⇒ Contentful::Management::Environment
Creates an environment.
37 38 39 |
# File 'lib/contentful/management/environment.rb', line 37 def self.create(client, space_id, attributes = {}) super(client, space_id, nil, attributes) end |
.find(client, space_id, environment_id) ⇒ Contentful::Management::Environment
Finds an environment by ID.
48 49 50 |
# File 'lib/contentful/management/environment.rb', line 48 def self.find(client, space_id, environment_id) super(client, space_id, nil, environment_id) end |
Instance Method Details
#assets ⇒ Contentful::Management::EnvironmentAssetMethodsFactory
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.
75 76 77 |
# File 'lib/contentful/management/environment.rb', line 75 def assets EnvironmentAssetMethodsFactory.new(self) end |
#content_types ⇒ Contentful::Management::EnvironmentContentTypeMethodsFactory
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.
84 85 86 |
# File 'lib/contentful/management/environment.rb', line 84 def content_types EnvironmentContentTypeMethodsFactory.new(self) end |
#default_locale ⇒ String
Retrieves Default Locale for current Environment and leaves it cached
123 124 125 |
# File 'lib/contentful/management/environment.rb', line 123 def default_locale self.found_locale ||= find_locale end |
#editor_interfaces ⇒ Contentful::Management::EnvironmentEditorInterfaceMethodsFactory
Allows manipulation of editor interfaces in context of the current environment Allows listing of editor interfaces for the current environment.
111 112 113 |
# File 'lib/contentful/management/environment.rb', line 111 def editor_interfaces EnvironmentEditorInterfaceMethodsFactory.new(self) end |
#entries ⇒ Contentful::Management::EnvironmentEntryMethodsFactory
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.
66 67 68 |
# File 'lib/contentful/management/environment.rb', line 66 def entries EnvironmentEntryMethodsFactory.new(self) end |
#environment_id ⇒ Object
Gets the environment ID
116 117 118 |
# File 'lib/contentful/management/environment.rb', line 116 def environment_id id end |
#find_locale ⇒ String
Finds Default Locale Code for current Space This request makes an API call to the Locale endpoint
131 132 133 134 135 |
# File 'lib/contentful/management/environment.rb', line 131 def find_locale locale = locales.all.detect(&:default) return locale.code unless locale.nil? @default_locale end |
#locales ⇒ Contentful::Management::EnvironmentLocaleMethodsFactory
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.
93 94 95 |
# File 'lib/contentful/management/environment.rb', line 93 def locales EnvironmentLocaleMethodsFactory.new(self) end |
#ui_extensions ⇒ Contentful::Management::EnvironmentUIExtensionMethodsFactory
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.
102 103 104 |
# File 'lib/contentful/management/environment.rb', line 102 def ui_extensions EnvironmentUIExtensionMethodsFactory.new(self) end |