Class: Contentstack::ContentType
- Inherits:
-
Object
- Object
- Contentstack::ContentType
- Defined in:
- lib/contentstack/content_type.rb
Class Method Summary collapse
Instance Method Summary collapse
- #entry(entry_uid) ⇒ Object
-
#initialize(object) ⇒ ContentType
constructor
A new instance of ContentType.
- #query ⇒ Object
Constructor Details
#initialize(object) ⇒ ContentType
Returns a new instance of ContentType.
27 28 29 |
# File 'lib/contentstack/content_type.rb', line 27 def initialize(object) @attributes = object.symbolize_keys end |
Class Method Details
.all ⇒ Object
40 41 42 43 44 45 |
# File 'lib/contentstack/content_type.rb', line 40 def self.all content_types = API.fetch_content_types["content_types"] content_types.map do |content_type| ContentType.new(content_type.inject({}){|clone,(k,v)| clone[k.to_sym] = v; clone}) end end |
.find_by_uid(uid) ⇒ Object
47 48 49 50 |
# File 'lib/contentstack/content_type.rb', line 47 def self.find_by_uid(uid) content_type = API.fetch_content_types(uid)["content_type"] ContentType.new(content_type.inject({}){|clone,(k,v)| clone[k.to_sym] = v; clone}) end |