class Contentful::ContentType

Resource Class for Content Types www.contentful.com/developers/documentation/content-delivery-api/#content-types

Attributes

description[R]
displayField[R]
display_field[R]
fields[R]
name[R]

Public Class Methods

new(item, *) click to toggle source
Calls superclass method Contentful::BaseResource::new
# File lib/contentful/content_type.rb, line 11
def initialize(item, *)
  super

  @name = item.fetch('name', nil)
  @description = item.fetch('description', nil)
  @fields = item.fetch('fields', []).map { |field| Field.new(field) }
  @display_field = item.fetch('displayField', nil)
end

Public Instance Methods

field_for(field_id) click to toggle source

Field definition for field

# File lib/contentful/content_type.rb, line 21
def field_for(field_id)
  fields.detect { |f| Support.snakify(f.id) == Support.snakify(field_id) }
end

Protected Instance Methods

repr_name() click to toggle source
# File lib/contentful/content_type.rb, line 29
def repr_name
  "#{super}[#{name}]"
end