Class: Contentful::ContentType
- Inherits:
-
BaseResource
- Object
- BaseResource
- Contentful::ContentType
- Defined in:
- lib/contentful/content_type.rb
Overview
Resource Class for Content Types www.contentful.com/developers/documentation/content-delivery-api/#content-types
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#display_field ⇒ Object
(also: #displayField)
readonly
Returns the value of attribute display_field.
-
#fields ⇒ Object
readonly
Returns the value of attribute fields.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Attributes inherited from BaseResource
#_metadata, #default_locale, #raw, #sys
Instance Method Summary collapse
-
#field_for(field_id) ⇒ Object
Field definition for field.
-
#initialize(item) ⇒ ContentType
constructor
A new instance of ContentType.
Methods inherited from BaseResource
#==, #inspect, #marshal_dump, #marshal_load, #reload
Constructor Details
#initialize(item) ⇒ ContentType
Returns a new instance of ContentType.
11 12 13 14 15 16 17 18 |
# 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 |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
9 10 11 |
# File 'lib/contentful/content_type.rb', line 9 def description @description end |
#display_field ⇒ Object (readonly) Also known as: displayField
Returns the value of attribute display_field.
9 10 11 |
# File 'lib/contentful/content_type.rb', line 9 def display_field @display_field end |
#fields ⇒ Object (readonly)
Returns the value of attribute fields.
9 10 11 |
# File 'lib/contentful/content_type.rb', line 9 def fields @fields end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
9 10 11 |
# File 'lib/contentful/content_type.rb', line 9 def name @name end |