Sha256: 25ada3e167dd6245ff063e964a0ea364ff0c225a05a2b767cfa090168100065b

Contents?: true

Size: 810 Bytes

Versions: 33

Compression:

Stored size: 810 Bytes

Contents

require_relative 'resource_requester'

module Contentful
  module Management
    # Wrapper for Entry Association Methods
    # @private
    module EntryAssociationMethodsFactory
      attr_reader :entry

      def initialize(entry)
        @entry = entry
      end

      def all(_params = {})
        associated_class.all(entry.client, entry.sys[:space].id, entry.environment_id, entry.id)
      end

      def find(id)
        associated_class.find(entry.client, entry.sys[:space].id, entry.environment_id, entry.id, id)
      end

      def associated_class
        class_name = /\A(.+)Entry(.+)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
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
contentful-management-3.8.0 lib/contentful/management/entry_association_methods_factory.rb
contentful-management-3.7.0 lib/contentful/management/entry_association_methods_factory.rb
contentful-management-3.6.0 lib/contentful/management/entry_association_methods_factory.rb
contentful-management-3.5.0 lib/contentful/management/entry_association_methods_factory.rb
contentful-management-3.4.0 lib/contentful/management/entry_association_methods_factory.rb
contentful-management-3.3.0 lib/contentful/management/entry_association_methods_factory.rb
contentful-management-3.2.0 lib/contentful/management/entry_association_methods_factory.rb
contentful-management-3.1.0 lib/contentful/management/entry_association_methods_factory.rb
contentful-management-3.0.0 lib/contentful/management/entry_association_methods_factory.rb
contentful-management-2.13.1 lib/contentful/management/entry_association_methods_factory.rb
contentful-management-2.13.0 lib/contentful/management/entry_association_methods_factory.rb
contentful-management-2.12.1 lib/contentful/management/entry_association_methods_factory.rb
contentful-management-2.12.0 lib/contentful/management/entry_association_methods_factory.rb
contentful-management-2.11.0 lib/contentful/management/entry_association_methods_factory.rb
contentful-management-2.10.0 lib/contentful/management/entry_association_methods_factory.rb
contentful-management-2.9.1 lib/contentful/management/entry_association_methods_factory.rb
contentful-management-2.9.0 lib/contentful/management/entry_association_methods_factory.rb
contentful-management-2.8.2 lib/contentful/management/entry_association_methods_factory.rb
contentful-management-2.8.1 lib/contentful/management/entry_association_methods_factory.rb
contentful-management-2.8.0 lib/contentful/management/entry_association_methods_factory.rb