lib/nhl/game.rb
# Retrieves all games in a range of time.
# Dates should be in the format YYYY-MM-DD.
Retrieves all games in a range of time.
Dates should be in the format YYYY-MM-DD.
Retrieves all games in a range of time . Dates should be in the format YYYY - MM - DD .
def in_time_period(start_date, end_date)
        response = Faraday.get("#{URL}?startDate=#{start_date}&endDate=#{end_date}")
        data = JSON.parse(response.body)
        dates = data['dates']
        games = []
        dates.each do |date|
          date['games'].each do |g| 
            games << new(g)
          end
        end
        games
      end
def in_time_period ( start_date , end_date ) response = Faraday . get ( "#{URL}?startDate=#{start_date}&endDate=#{end_date}" ) data = JSON . parse ( response . body ) dates = data [ 'dates' ] games = [ ] dates . each do | date | date [ 'games' ] . each do | g | games << new ( g ) end end games end
Retrieves all games in a range of time.
Retrieves all games in a range of time .
start_date
<not_specific>
end_date
<not_specific>