Sha256: 93adae60d4446b2bee0d4bb25e5064d49e6aa70e2950e42da9dd2c1cdc8de453

Contents?: true

Size: 1.94 KB

Versions: 28

Compression:

Stored size: 1.94 KB

Contents

module Sportradar
  module Api
    class Nfl::Player < Data
      attr_accessor :response, :id, :sequence, :title, :game, :name, :jersey, :reference, :position, :depth, :injury, :age, :birth_date, :birth_place, :college, :college_conf, :draft, :first_name, :height, :high_school, :last_name, :preferred_name, :references, :rookie_year, :status, :weight, :abbr_name, :seasons, :team

      def initialize(data)
        @response = data
        @depth = data["depth"]
        @game = data["game"] # Games
        @id = data["id"]
        @jersey = data["jersey"]
        @name = data["name"]
        @position = data["position"]
        @reference = data["reference"]
        @sequence = data["sequence"]
        @title = data["title"]
        @age = data["age"]
        @birth_date = data["birth_date"]
        @birth_place = data["birth_place"]
        @college = data["college"]
        @college_conf = data["college_conf"]
        @first_name = data["first_name"]
        @height = data["height"]
        @high_school = data["high_school"]
        @last_name = data["last_name"]
        @preferred_name = data["preferred_name"]
        @references = data["references"]
        @rookie_year = data["rookie_year"]
        @status = data["status"]
        @weight = data["weight"]
        @abbr_name = data["abbr_name"]
        @team = Sportradar::Api::Nfl::Team.new data["team"] if data["team"]
        @injury = Sportradar::Api::Nfl::Injury.new data["injury"] if data["injury"]
        @draft = Sportradar::Api::Nfl::Draft.new data["draft"] if data["draft"]
        set_seasons
      end

      private

      def set_seasons
        if response["season"]
          if response["season"].is_a?(Array)
            @seasons = response["season"].map {|season| Sportradar::Api::Nfl::Season.new season }
          elsif response["season"].is_a?(Hash)
            @seasons = [ Sportradar::Api::Nfl::Season.new(response["season"]) ]
          end
        end
      end

    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
sportradar-api-0.1.34 lib/sportradar/api/nfl/player.rb
sportradar-api-0.1.33 lib/sportradar/api/nfl/player.rb
sportradar-api-0.1.32 lib/sportradar/api/nfl/player.rb
sportradar-api-0.1.31 lib/sportradar/api/nfl/player.rb
sportradar-api-0.1.30 lib/sportradar/api/nfl/player.rb
sportradar-api-0.1.29 lib/sportradar/api/nfl/player.rb
sportradar-api-0.1.28 lib/sportradar/api/nfl/player.rb
sportradar-api-0.1.27 lib/sportradar/api/nfl/player.rb
sportradar-api-0.1.26 lib/sportradar/api/nfl/player.rb
sportradar-api-0.1.25 lib/sportradar/api/nfl/player.rb
sportradar-api-0.1.24 lib/sportradar/api/nfl/player.rb
sportradar-api-0.1.23 lib/sportradar/api/nfl/player.rb
sportradar-api-0.1.22 lib/sportradar/api/nfl/player.rb
sportradar-api-0.1.21 lib/sportradar/api/nfl/player.rb
sportradar-api-0.1.19 lib/sportradar/api/nfl/player.rb
sportradar-api-0.1.18 lib/sportradar/api/nfl/player.rb
sportradar-api-0.1.17 lib/sportradar/api/nfl/player.rb
sportradar-api-0.1.16 lib/sportradar/api/nfl/player.rb
sportradar-api-0.1.15 lib/sportradar/api/nfl/player.rb
sportradar-api-0.1.14 lib/sportradar/api/nfl/player.rb