Module: ContentfulModel::Manageable::ClassMethods
- Defined in:
- lib/contentful_model/manageable.rb
Overview
Management Class methods
Instance Method Summary collapse
Instance Method Details
#create(values = {}, publish = false) ⇒ Object
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/contentful_model/manageable.rb', line 138 def create(values = {}, publish = false) space = ContentfulModel.configuration.space environment = ContentfulModel.configuration.environment entry = management.entries(space, environment).create( management.content_types(space, environment).find(content_type_id), values ) if publish entry.publish entry = find(entry.id) end entry end |
#management(options = {}) ⇒ Object
132 133 134 135 136 |
# File 'lib/contentful_model/manageable.rb', line 132 def management( = {}) @management ||= ContentfulModel::Management.new( .merge(raise_errors: true) ) end |