module ContentfulModel::Manageable::ClassMethods

Management Class methods

Public Instance Methods

create(values = {}, publish = false) click to toggle source
# 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 = {}) click to toggle source
# File lib/contentful_model/manageable.rb, line 132
def management(options = {})
  @management ||= ContentfulModel::Management.new(
    options.merge(raise_errors: true)
  )
end