Class: Contentful::Management::ContentTypeEntryMethodsFactory
- Inherits:
-
Object
- Object
- Contentful::Management::ContentTypeEntryMethodsFactory
- Defined in:
- lib/contentful/management/content_type_entry_methods_factory.rb
Instance Attribute Summary collapse
-
#content_type ⇒ Object
readonly
Returns the value of attribute content_type.
Instance Method Summary collapse
- #all(params = {}) ⇒ Object
- #create(attributes) ⇒ Object
-
#initialize(content_type) ⇒ ContentTypeEntryMethodsFactory
constructor
A new instance of ContentTypeEntryMethodsFactory.
- #new ⇒ Object
Constructor Details
#initialize(content_type) ⇒ ContentTypeEntryMethodsFactory
Returns a new instance of ContentTypeEntryMethodsFactory.
7 8 9 |
# File 'lib/contentful/management/content_type_entry_methods_factory.rb', line 7 def initialize(content_type) @content_type = content_type end |
Instance Attribute Details
#content_type ⇒ Object (readonly)
Returns the value of attribute content_type.
5 6 7 |
# File 'lib/contentful/management/content_type_entry_methods_factory.rb', line 5 def content_type @content_type end |
Instance Method Details
#all(params = {}) ⇒ Object
11 12 13 |
# File 'lib/contentful/management/content_type_entry_methods_factory.rb', line 11 def all(params = {}) Entry.all(content_type.space.id, params.merge(content_type: content_type.id)) end |
#create(attributes) ⇒ Object
15 16 17 |
# File 'lib/contentful/management/content_type_entry_methods_factory.rb', line 15 def create(attributes) Entry.create(content_type, attributes) end |
#new ⇒ Object
19 20 21 22 23 24 |
# File 'lib/contentful/management/content_type_entry_methods_factory.rb', line 19 def new dynamic_entry_class = content_type.client.register_dynamic_entry(content_type.id, DynamicEntry.create(content_type)) dynamic_entry = dynamic_entry_class.new dynamic_entry.content_type = content_type dynamic_entry end |