Class: HackernewsApi::Story
- Inherits:
-
Object
- Object
- HackernewsApi::Story
- Defined in:
- lib/hackernews_api/story.rb
Instance Attribute Summary collapse
-
#by ⇒ Object
readonly
Returns the value of attribute by.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#kids ⇒ Object
readonly
Returns the value of attribute kids.
-
#score ⇒ Object
readonly
Returns the value of attribute score.
-
#time ⇒ Object
readonly
Returns the value of attribute time.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(json) ⇒ Story
constructor
A new instance of Story.
Constructor Details
#initialize(json) ⇒ Story
Returns a new instance of Story.
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/hackernews_api/story.rb', line 10 def initialize json @id = json['id'] @by = json['by'] @kids = json['kids'] @score = json['score'] @time = DateTime.strptime(json['time'].to_s, '%s') @title = json['title'] @type = json['type'] @url = json['url'] end |
Instance Attribute Details
#by ⇒ Object (readonly)
Returns the value of attribute by.
8 9 10 |
# File 'lib/hackernews_api/story.rb', line 8 def by @by end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
8 9 10 |
# File 'lib/hackernews_api/story.rb', line 8 def id @id end |
#kids ⇒ Object (readonly)
Returns the value of attribute kids.
8 9 10 |
# File 'lib/hackernews_api/story.rb', line 8 def kids @kids end |
#score ⇒ Object (readonly)
Returns the value of attribute score.
8 9 10 |
# File 'lib/hackernews_api/story.rb', line 8 def score @score end |
#time ⇒ Object (readonly)
Returns the value of attribute time.
8 9 10 |
# File 'lib/hackernews_api/story.rb', line 8 def time @time end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
8 9 10 |
# File 'lib/hackernews_api/story.rb', line 8 def title @title end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
8 9 10 |
# File 'lib/hackernews_api/story.rb', line 8 def type @type end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
8 9 10 |
# File 'lib/hackernews_api/story.rb', line 8 def url @url end |