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.
6 7 8 |
# File 'lib/contentful/management/content_type_entry_methods_factory.rb', line 6 def initialize(content_type) @content_type = content_type end |
Instance Attribute Details
#content_type ⇒ Object (readonly)
Returns the value of attribute content_type.
4 5 6 |
# File 'lib/contentful/management/content_type_entry_methods_factory.rb', line 4 def content_type @content_type end |
Instance Method Details
#all(params = {}) ⇒ Object
10 11 12 |
# File 'lib/contentful/management/content_type_entry_methods_factory.rb', line 10 def all(params = {}) Entry.all(content_type.space.id, params.merge(content_type: content_type.id)) end |
#create(attributes) ⇒ Object
14 15 16 |
# File 'lib/contentful/management/content_type_entry_methods_factory.rb', line 14 def create(attributes) Entry.create(content_type, attributes) end |
#new ⇒ Object
18 19 20 21 22 23 |
# File 'lib/contentful/management/content_type_entry_methods_factory.rb', line 18 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 |