lib/nhl/team.rb
# Gets the teams next or previous game.
Gets the teams next or previous game.
Gets the teams next or previous game .
def last_or_previous_game(modifier)
      response = Faraday.get("#{URL}/#{@id}?expand=team.schedule.#{modifier}")
      data = JSON.parse(response.body)
      team_data = data[KEY][0]
      if team_data.key?("#{modifier}GameSchedule")
        Game.new(team_data["#{modifier}GameSchedule"]['dates'][0]['games'].first)
      end
    end
def last_or_previous_game ( modifier ) response = Faraday . get ( "#{URL}/#{@id}?expand=team.schedule.#{modifier}" ) data = JSON . parse ( response . body ) team_data = data [ KEY ] [ 0 ] if team_data . key? ( "#{modifier}GameSchedule" ) Game . new ( team_data [ "#{modifier}GameSchedule" ] [ 'dates' ] [ 0 ] [ 'games' ] . first ) end end
Gets the teams next or previous game.
Gets the teams next or previous game .
modifier
<not_specific>