Sha256: f3f5d916bb5a1679da94dcefc22b57e530e6f7461b2723d02e86b5441b2f85a3

Contents?: true

Size: 1.26 KB

Versions: 4

Compression:

Stored size: 1.26 KB

Contents

module SportsDataApi
  module Nfl
    extend SportsDataApi::Request

    API_VERSION = 2
    BASE_URL = 'https://api.sportradar.us/nfl-%{access_level}%{version}'.freeze
    SPORT = :nfl
    DIR = File.join(File.dirname(__FILE__), SPORT.to_s)

    autoload :Broadcast, File.join(DIR, 'broadcast')
    autoload :Game, File.join(DIR, 'game')
    autoload :Player, File.join(DIR, 'player')
    autoload :Season, File.join(DIR, 'season')
    autoload :Team, File.join(DIR, 'team')
    autoload :Teams, File.join(DIR, 'teams')
    autoload :Venue, File.join(DIR, 'venue')
    autoload :Week, File.join(DIR, 'week')

    class << self
      def schedule(year, season)
        Season.new(response_json("/games/#{year}/#{season}/schedule.json"))
      end

      def team_roster(team_id)
        Team.new(response_json("/teams/#{team_id}/full_roster.json"))
      end

      def boxscore(game_id)
        Game.new(response_json("/games/#{game_id}/boxscore.json"))
      end

      def game_statistics(game_id)
        Game.new(response_json("/games/#{game_id}/statistics.json"))
      end

      def game_roster(game_id)
        Game.new(response_json("/games/#{game_id}/roster.json"))
      end

      def teams
        Teams.new(response_json('/league/hierarchy.json'))
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sports_data_api-0.15.3 lib/sports_data_api/nfl.rb
sports_data_api-0.15.2 lib/sports_data_api/nfl.rb
sports_data_api-0.15.1 lib/sports_data_api/nfl.rb
sports_data_api-0.15.0 lib/sports_data_api/nfl.rb