class Contentful::Management::ClientEnvironmentMethodsFactory

Wrapper for Environment API for usage from within Client @private

Attributes

client[R]

Public Class Methods

new(client, space_id) click to toggle source
# File lib/contentful/management/client_environment_methods_factory.rb, line 13
def initialize(client, space_id)
  @client = client
  @space_id = space_id
  @resource_requester = ResourceRequester.new(client, associated_class)
end

Public Instance Methods

all(params = {}) click to toggle source

Gets a collection of environments.

@return [Contentful::Management::Array<Contentful::Management::Environment>]

# File lib/contentful/management/client_environment_methods_factory.rb, line 22
def all(params = {})
  @resource_requester.all(
    {
      space_id: @space_id
    },
    params
  )
end
associated_class() click to toggle source
# File lib/contentful/management/client_environment_methods_factory.rb, line 59
def associated_class
  ::Contentful::Management::Environment
end
create(attributes) click to toggle source

Create an environment.

@param [Hash] attributes @option attributes [String] :name

@return [Contentful::Management::Environment]

# File lib/contentful/management/client_environment_methods_factory.rb, line 49
def create(attributes)
  associated_class.create(client, @space_id, attributes)
end
find(environment_id) click to toggle source

Gets a specific environment.

@param [String] environment_id

@return [Contentful::Management::Environment]

# File lib/contentful/management/client_environment_methods_factory.rb, line 36
def find(environment_id)
  @resource_requester.find(
    space_id: @space_id,
    environment_id: environment_id
  )
end
new() click to toggle source
# File lib/contentful/management/client_environment_methods_factory.rb, line 53
def new
  object = associated_class.new
  object.client = client
  object
end