module Contentful::Management::EnvironmentAssociationMethodsFactory

Wrapper for Environment Association Methods @private

Attributes

environment[R]

Public Class Methods

new(environment) click to toggle source
# File lib/contentful/management/environment_association_methods_factory.rb, line 12
def initialize(environment)
  @environment = environment
end

Public Instance Methods

all(params = {}) click to toggle source
# File lib/contentful/management/environment_association_methods_factory.rb, line 16
def all(params = {})
  associated_class.all(environment.client, environment.sys[:space].id, environment.id, params)
end
associated_class() click to toggle source
# File lib/contentful/management/environment_association_methods_factory.rb, line 36
def associated_class
  class_name = /\A(.+)Environment(.+)MethodsFactory\z/.match(self.class.name).captures.join
  class_name.split('::').reduce(Object) do |mod, actual_class_name|
    mod.const_get(actual_class_name)
  end
end
create(attributes = {}) click to toggle source
# File lib/contentful/management/environment_association_methods_factory.rb, line 24
def create(attributes = {})
  associated_class.create(environment.client, environment.sys[:space].id, environment.id, attributes)
end
find(id) click to toggle source
# File lib/contentful/management/environment_association_methods_factory.rb, line 20
def find(id)
  associated_class.find(environment.client, environment.sys[:space].id, environment.id, id)
end
new() click to toggle source
# File lib/contentful/management/environment_association_methods_factory.rb, line 28
def new
  object = associated_class.new
  object.sys[:space] = environment.space
  object.sys[:environment] = environment
  object.client = environment.client
  object
end