Class: Contentstack::Entry
- Inherits:
-
Object
- Object
- Contentstack::Entry
- Defined in:
- lib/contentstack/entry.rb
Instance Attribute Summary collapse
-
#content_type ⇒ Object
readonly
Returns the value of attribute content_type.
-
#fields ⇒ Object
readonly
Returns the value of attribute fields.
-
#owner ⇒ Object
readonly
Returns the value of attribute owner.
-
#uid ⇒ Object
readonly
Returns the value of attribute uid.
Instance Method Summary collapse
- #fetch ⇒ Object
- #get(field_uid) ⇒ Object
-
#initialize(attrs, content_type_uid = nil) ⇒ Entry
constructor
A new instance of Entry.
Constructor Details
#initialize(attrs, content_type_uid = nil) ⇒ Entry
Returns a new instance of Entry.
4 5 6 |
# File 'lib/contentstack/entry.rb', line 4 def initialize(attrs, content_type_uid=nil) setup(attrs, content_type_uid) end |
Instance Attribute Details
#content_type ⇒ Object (readonly)
Returns the value of attribute content_type.
3 4 5 |
# File 'lib/contentstack/entry.rb', line 3 def content_type @content_type end |
#fields ⇒ Object (readonly)
Returns the value of attribute fields.
3 4 5 |
# File 'lib/contentstack/entry.rb', line 3 def fields @fields end |
#owner ⇒ Object (readonly)
Returns the value of attribute owner.
3 4 5 |
# File 'lib/contentstack/entry.rb', line 3 def owner @owner end |
#uid ⇒ Object (readonly)
Returns the value of attribute uid.
3 4 5 |
# File 'lib/contentstack/entry.rb', line 3 def uid @uid end |
Instance Method Details
#fetch ⇒ Object
8 9 10 11 12 |
# File 'lib/contentstack/entry.rb', line 8 def fetch entry = API.fetch_entry(@content_type, self.fields[:uid]) setup(entry["entry"]) self end |
#get(field_uid) ⇒ Object
14 15 16 17 |
# File 'lib/contentstack/entry.rb', line 14 def get(field_uid) raise Contentstack::Error("Please send a valid Field UID") if field_uid.class != String @fields[field_uid.to_sym] end |