Class: Contentful::Management::Environment

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

Overview

Resource class for Environment.

See Also:

  • https://www.contentful.com/developers/documentation/content-management-api/#resources-environments

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::Refresher

#reload

Methods included from Resource

#array?, #destroy, #fields, #nested_locale_fields?, #resource?, #save, #sys, #update

Class Method Details

.create(client, space_id, attributes = {}) ⇒ Contentful::Management::Environment

Creates an environment.

Parameters:

Returns:

See Also:

  • README for full attribute list for each resource.


40
41
42
# File 'lib/contentful/management/environment.rb', line 40

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.

Parameters:

Returns:



51
52
53
# File 'lib/contentful/management/environment.rb', line 51

def self.find(client, space_id, environment_id)
  super(client, space_id, nil, environment_id)
end

Instance Method Details

#assetsContentful::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.

Returns:

  • (Contentful::Management::EnvironmentAssetMethodsFactory)

See Also:

  • README for details.


87
88
89
# File 'lib/contentful/management/environment.rb', line 87

def assets
  EnvironmentAssetMethodsFactory.new(self)
end

#content_typesContentful::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.

Returns:

  • (Contentful::Management::EnvironmentContentTypeMethodsFactory)

See Also:

  • README for details.


96
97
98
# File 'lib/contentful/management/environment.rb', line 96

def content_types
  EnvironmentContentTypeMethodsFactory.new(self)
end

#default_localeString

Retrieves Default Locale for current Environment and leaves it cached

Returns:

  • (String)


144
145
146
# File 'lib/contentful/management/environment.rb', line 144

def default_locale
  self.found_locale ||= find_locale
end

#editor_interfacesContentful::Management::EnvironmentEditorInterfaceMethodsFactory

Allows manipulation of editor interfaces in context of the current environment Allows listing of editor interfaces for the current environment.

Returns:

  • (Contentful::Management::EnvironmentEditorInterfaceMethodsFactory)

See Also:

  • README for details.


123
124
125
# File 'lib/contentful/management/environment.rb', line 123

def editor_interfaces
  EnvironmentEditorInterfaceMethodsFactory.new(self)
end

#entriesContentful::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.

Returns:

  • (Contentful::Management::EnvironmentEntryMethodsFactory)

See Also:

  • README for details.


78
79
80
# File 'lib/contentful/management/environment.rb', line 78

def entries
  EnvironmentEntryMethodsFactory.new(self)
end

#environment_idObject

Gets the environment ID



137
138
139
# File 'lib/contentful/management/environment.rb', line 137

def environment_id
  id
end

#find_localeString

Finds Default Locale Code for current Space This request makes an API call to the Locale endpoint

Returns:

  • (String)


152
153
154
155
156
157
# File 'lib/contentful/management/environment.rb', line 152

def find_locale
  locale = locales.all.detect(&:default)
  return locale.code if locale

  default_locale
end

#localesContentful::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.

Returns:

  • (Contentful::Management::EnvironmentLocaleMethodsFactory)

See Also:

  • README for details.


105
106
107
# File 'lib/contentful/management/environment.rb', line 105

def locales
  EnvironmentLocaleMethodsFactory.new(self)
end

#tagsContentful::Management::EnvironmentTagMethodsFactory

Allows manipulation of tags in context of the current environment Allows listing all tags for the current environment, creating new and finding one by ID.

Returns:

  • (Contentful::Management::EnvironmentTagMethodsFactory)

See Also:

  • README for details.


132
133
134
# File 'lib/contentful/management/environment.rb', line 132

def tags
  EnvironmentTagMethodsFactory.new(self)
end

#ui_extensionsContentful::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.

Returns:

  • (Contentful::Management::EnvironmentUIExtensionMethodsFactory)

See Also:

  • README for details.


114
115
116
# File 'lib/contentful/management/environment.rb', line 114

def ui_extensions
  EnvironmentUIExtensionMethodsFactory.new(self)
end