Module: Contentful::Management::SpaceAssociationMethodsFactory
- Included in:
- SpaceAssetMethodsFactory, SpaceContentTypeMethodsFactory, SpaceEntryMethodsFactory, SpaceLocaleMethodsFactory, SpaceWebhookMethodsFactory
- Defined in:
- lib/contentful/management/space_association_methods_factory.rb
Instance Attribute Summary collapse
-
#space ⇒ Object
readonly
Returns the value of attribute space.
Instance Method Summary collapse
- #all(params = {}) ⇒ Object
- #associated_class ⇒ Object
- #create(attributes) ⇒ Object
- #find(id) ⇒ Object
- #initialize(space) ⇒ Object
- #new ⇒ Object
Instance Attribute Details
#space ⇒ Object (readonly)
Returns the value of attribute space.
4 5 6 |
# File 'lib/contentful/management/space_association_methods_factory.rb', line 4 def space @space end |
Instance Method Details
#all(params = {}) ⇒ Object
10 11 12 |
# File 'lib/contentful/management/space_association_methods_factory.rb', line 10 def all(params = {}) associated_class.all(space.id, params) end |
#associated_class ⇒ Object
28 29 30 31 32 33 |
# File 'lib/contentful/management/space_association_methods_factory.rb', line 28 def associated_class class_name = /\A(.+)Space(.+)MethodsFactory\z/.match(self.class.name).captures.join class_name.split('::').reduce(Object) do |mod, class_name| mod.const_get(class_name) end end |
#create(attributes) ⇒ Object
18 19 20 |
# File 'lib/contentful/management/space_association_methods_factory.rb', line 18 def create(attributes) associated_class.create(space.id, attributes) end |
#find(id) ⇒ Object
14 15 16 |
# File 'lib/contentful/management/space_association_methods_factory.rb', line 14 def find(id) associated_class.find(space.id, id) end |
#initialize(space) ⇒ Object
6 7 8 |
# File 'lib/contentful/management/space_association_methods_factory.rb', line 6 def initialize(space) @space = space end |
#new ⇒ Object
22 23 24 25 26 |
# File 'lib/contentful/management/space_association_methods_factory.rb', line 22 def new object = associated_class.new object.sys[:space] = space object end |