class NflData::MySportsFeeds::SeasonalGamesFeed

Attributes

client[R]

Public Class Methods

new(client: MySportsFeeds::Client.new) click to toggle source
# File lib/nfl_data/my_sports_feeds/seasonal_games_feed.rb, line 8
def initialize(client: MySportsFeeds::Client.new)
  @client = client
end

Public Instance Methods

feed(season_start_year:) click to toggle source
# 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) click to toggle source
# File lib/nfl_data/my_sports_feeds/seasonal_games_feed.rb, line 17
def season_slug(year)
  "#{year}-#{year + 1}-regular"
end