module Contentful::Management::ClientAssociationMethodsFactory

Wrapper for Space Association Methods @private

Attributes

client[R]

Public Class Methods

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

Public Instance Methods

all(params = {}) click to toggle source

Gets a collection of resources.

@param [Hash] params @see _ For complete option list: www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters

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

# File lib/contentful/management/client_association_methods_factory.rb, line 23
def all(params = {})
  associated_class.all(client, @space_id, @environment_id, params)
end
associated_class() click to toggle source
# File lib/contentful/management/client_association_methods_factory.rb, line 46
def associated_class
  class_name = /\A(.+)Client(.+)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/client_association_methods_factory.rb, line 36
def create(attributes)
  associated_class.create(client, @space_id, @environment_id, attributes)
end
find(resource_id) click to toggle source

Gets a specific resource.

@param [String] resource_id

@return [Contentful::Management::Resource]

# File lib/contentful/management/client_association_methods_factory.rb, line 32
def find(resource_id)
  associated_class.find(client, @space_id, @environment_id, resource_id)
end
new() click to toggle source
# File lib/contentful/management/client_association_methods_factory.rb, line 40
def new
  object = associated_class.new
  object.client = client
  object
end