Class: SportsDataApi::Nfl::Week

Inherits:
Object
  • Object
show all
Defined in:
lib/sports_data_api/nfl/week.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json, year, season) ⇒ Week

Returns a new instance of Week.



6
7
8
9
10
11
# File 'lib/sports_data_api/nfl/week.rb', line 6

def initialize(json, year, season)
  @json = json
  @year = year
  @season = season
  @number = json['sequence']
end

Instance Attribute Details

#numberObject (readonly)

Returns the value of attribute number.



4
5
6
# File 'lib/sports_data_api/nfl/week.rb', line 4

def number
  @number
end

#seasonObject (readonly)

Returns the value of attribute season.



4
5
6
# File 'lib/sports_data_api/nfl/week.rb', line 4

def season
  @season
end

#yearObject (readonly)

Returns the value of attribute year.



4
5
6
# File 'lib/sports_data_api/nfl/week.rb', line 4

def year
  @year
end

Instance Method Details

#gamesObject



13
14
15
16
17
# File 'lib/sports_data_api/nfl/week.rb', line 13

def games
  @games ||= json['games'].map do |game|
    Game.new(game, year: year, season: season, week: number)
  end
end