Class: MLBStatsAPI::ColorFeed
- Defined in:
- lib/mlb_stats_api/color_feed.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(api, data) ⇒ ColorFeed
constructor
A new instance of ColorFeed.
- #items ⇒ Object
- #reload! ⇒ Object (also: #update!)
Methods inherited from Base
Constructor Details
#initialize(api, data) ⇒ ColorFeed
Returns a new instance of ColorFeed.
7 8 9 10 11 12 13 |
# File 'lib/mlb_stats_api/color_feed.rb', line 7 def initialize(api, data) @api = api @data = data # If we need to nuke and start over, keep this piece @id = data['game_pk'] end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/mlb_stats_api/color_feed.rb', line 5 def id @id end |
Instance Method Details
#items ⇒ Object
15 16 17 |
# File 'lib/mlb_stats_api/color_feed.rb', line 15 def items @data['items'] end |
#reload! ⇒ Object Also known as: update!
19 20 21 22 23 24 25 |
# File 'lib/mlb_stats_api/color_feed.rb', line 19 def reload! @data = @api.get("/game/#{@id}/feed/color") true rescue Net::OpenTimeout false end |