module ContentfulModel::Migrations::ContentTypeFactory
Content Type Factory class
Public Class Methods
create(name, fields = {}) { |content_type| ... }
click to toggle source
# File lib/contentful_model/migrations/content_type_factory.rb, line 7 def self.create(name, fields = {}, &_block) content_type = ContentfulModel::Migrations::ContentType.new(name) yield(content_type) if block_given? fields.each do |field_name, type| content_type.field(field_name, type) end content_type.save end
find(content_type_id)
click to toggle source
# File lib/contentful_model/migrations/content_type_factory.rb, line 19 def self.find(content_type_id) ContentfulModel::Migrations::ContentType.new( nil, ContentfulModel::Management.new.content_types( ContentfulModel.configuration.space, ContentfulModel.configuration.environment ).find(content_type_id) ) end