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.


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.

Parameters:

Returns:



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

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


84
85
86
# File 'lib/contentful/management/environment.rb', line 84

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.


93
94
95
# File 'lib/contentful/management/environment.rb', line 93

def content_types
  EnvironmentContentTypeMethodsFactory.new(self)
end

#default_localeString

Retrieves Default Locale for current Environment and leaves it cached

Returns:

  • (String)


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

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.


120
121
122
# File 'lib/contentful/management/environment.rb', line 120

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.


75
76
77
# File 'lib/contentful/management/environment.rb', line 75

def entries
  EnvironmentEntryMethodsFactory.new(self)
end

#environment_idObject

Gets the environment ID



125
126
127
# File 'lib/contentful/management/environment.rb', line 125

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)


140
141
142
143
144
145
# File 'lib/contentful/management/environment.rb', line 140

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.


102
103
104
# File 'lib/contentful/management/environment.rb', line 102

def locales
  EnvironmentLocaleMethodsFactory.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.


111
112
113
# File 'lib/contentful/management/environment.rb', line 111

def ui_extensions
  EnvironmentUIExtensionMethodsFactory.new(self)
end