Class: SportsDataApi::Nba::Games

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/sports_data_api/nba/games.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ Games



8
9
10
11
# File 'lib/sports_data_api/nba/games.rb', line 8

def initialize(json)
  @json = json
  @date = json['date']
end

Instance Attribute Details

#dateObject (readonly)

Returns the value of attribute date.



6
7
8
# File 'lib/sports_data_api/nba/games.rb', line 6

def date
  @date
end

Instance Method Details

#eachObject



19
20
21
22
# File 'lib/sports_data_api/nba/games.rb', line 19

def each
  return games.each unless block_given?
  games.each { |game| yield game }
end

#gamesObject



13
14
15
16
17
# File 'lib/sports_data_api/nba/games.rb', line 13

def games
  @games ||= json['games'].map do |game_json|
    Game.new(json: game_json)
  end
end