Class: NflData::MySportsFeeds::WeeklyPlayerGamelogs

Inherits:
Object
  • Object
show all
Defined in:
lib/nfl_data/my_sports_feeds/weekly_player_gamelogs.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client: MySportsFeeds::Client.new) ⇒ WeeklyPlayerGamelogs

Returns a new instance of WeeklyPlayerGamelogs.



8
9
10
# File 'lib/nfl_data/my_sports_feeds/weekly_player_gamelogs.rb', line 8

def initialize(client: MySportsFeeds::Client.new)
  @client = client
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



6
7
8
# File 'lib/nfl_data/my_sports_feeds/weekly_player_gamelogs.rb', line 6

def client
  @client
end

Instance Method Details

#feed(season_start_year:, week:) ⇒ Object



12
13
14
# File 'lib/nfl_data/my_sports_feeds/weekly_player_gamelogs.rb', line 12

def feed(season_start_year:, week:)
  client.get(endpoint: "#{season_slug(season_start_year)}/week/#{week}/player_gamelogs")["gamelogs"]
end

#season_slug(year) ⇒ Object



16
17
18
# File 'lib/nfl_data/my_sports_feeds/weekly_player_gamelogs.rb', line 16

def season_slug(year)
  "#{year}-#{year + 1}-regular"
end