Class: NflData::MySportsFeeds::SeasonalGamesFeed
- Inherits:
-
Object
- Object
- NflData::MySportsFeeds::SeasonalGamesFeed
- Defined in:
- lib/nfl_data/my_sports_feeds/seasonal_games_feed.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
- #feed(season_start_year:) ⇒ Object
-
#initialize(client: MySportsFeeds::Client.new) ⇒ SeasonalGamesFeed
constructor
A new instance of SeasonalGamesFeed.
- #season_slug(year) ⇒ Object
Constructor Details
#initialize(client: MySportsFeeds::Client.new) ⇒ SeasonalGamesFeed
Returns a new instance of SeasonalGamesFeed.
8 9 10 |
# File 'lib/nfl_data/my_sports_feeds/seasonal_games_feed.rb', line 8 def initialize(client: MySportsFeeds::Client.new) @client = client end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
6 7 8 |
# File 'lib/nfl_data/my_sports_feeds/seasonal_games_feed.rb', line 6 def client @client end |
Instance Method Details
#feed(season_start_year:) ⇒ Object
12 13 14 15 |
# File 'lib/nfl_data/my_sports_feeds/seasonal_games_feed.rb', line 12 def feed(season_start_year:) response = client.get(endpoint: "#{season_slug(season_start_year)}/games") response["games"].map { |data| data["schedule"] } end |
#season_slug(year) ⇒ Object
17 18 19 |
# File 'lib/nfl_data/my_sports_feeds/seasonal_games_feed.rb', line 17 def season_slug(year) "#{year}-#{year + 1}-regular" end |