Class: MLBStatsAPI::ColorFeed
- Defined in:
- lib/mlb_stats_api/color_feed.rb
Instance Attribute Summary collapse
-
#game_pk ⇒ Object
readonly
Returns the value of attribute game_pk.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(api, game_pk, data) ⇒ ColorFeed
constructor
A new instance of ColorFeed.
- #items ⇒ Object
- #reload! ⇒ Object (also: #update!)
Methods inherited from Base
Constructor Details
#initialize(api, game_pk, data) ⇒ ColorFeed
Returns a new instance of ColorFeed.
7 8 9 10 11 |
# File 'lib/mlb_stats_api/color_feed.rb', line 7 def initialize(api, game_pk, data) @api = api @data = data @game_pk = game_pk end |
Instance Attribute Details
#game_pk ⇒ Object (readonly)
Returns the value of attribute game_pk.
5 6 7 |
# File 'lib/mlb_stats_api/color_feed.rb', line 5 def game_pk @game_pk end |
Instance Method Details
#items ⇒ Object
13 14 15 16 17 |
# File 'lib/mlb_stats_api/color_feed.rb', line 13 def items return [] unless @data @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/#{@game_pk}/feed/color") true rescue Net::OpenTimeout false end |