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.
6 7 8 |
# File 'lib/contentstack/entry.rb', line 6 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.
5 6 7 |
# File 'lib/contentstack/entry.rb', line 5 def content_type @content_type end |
#fields ⇒ Object (readonly)
Returns the value of attribute fields.
5 6 7 |
# File 'lib/contentstack/entry.rb', line 5 def fields @fields end |
#owner ⇒ Object (readonly)
Returns the value of attribute owner.
5 6 7 |
# File 'lib/contentstack/entry.rb', line 5 def owner @owner end |
#uid ⇒ Object (readonly)
Returns the value of attribute uid.
5 6 7 |
# File 'lib/contentstack/entry.rb', line 5 def uid @uid end |
Instance Method Details
#fetch ⇒ Object
10 11 12 13 14 |
# File 'lib/contentstack/entry.rb', line 10 def fetch entry = API.fetch_entry(@content_type, self.fields[:uid]) setup(entry["entry"]) self end |
#get(field_uid) ⇒ Object
16 17 18 19 |
# File 'lib/contentstack/entry.rb', line 16 def get(field_uid) raise Contentstack::Error("Please send a valid Field UID") if field_uid.class != String @fields[field_uid.to_sym] end |