Class: NewsItem
- Inherits:
-
Object
- Object
- NewsItem
- Defined in:
- lib/Appolo/Models/secondary/news_item.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#date_created ⇒ Object
readonly
Returns the value of attribute date_created.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(json_str) ⇒ NewsItem
constructor
A new instance of NewsItem.
- #to_s ⇒ Object
Constructor Details
#initialize(json_str) ⇒ NewsItem
Returns a new instance of NewsItem.
5 6 7 8 9 10 11 12 |
# File 'lib/Appolo/Models/secondary/news_item.rb', line 5 def initialize json_str json_data = Appolo.check_json_info json_str @id = json_data[ModelUtils::ID] @content = json_data[ModelUtils::CONTENT] @date_created = json_data[ModelUtils::CREATED_WHEN] @title = json_data[ModelUtils::TITLE] end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
3 4 5 |
# File 'lib/Appolo/Models/secondary/news_item.rb', line 3 def content @content end |
#date_created ⇒ Object (readonly)
Returns the value of attribute date_created.
3 4 5 |
# File 'lib/Appolo/Models/secondary/news_item.rb', line 3 def date_created @date_created end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/Appolo/Models/secondary/news_item.rb', line 3 def id @id end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
3 4 5 |
# File 'lib/Appolo/Models/secondary/news_item.rb', line 3 def title @title end |
Instance Method Details
#to_s ⇒ Object
14 15 16 |
# File 'lib/Appolo/Models/secondary/news_item.rb', line 14 def to_s "#{@id} - NewsItem : #{@title} - #{@date_created}" end |