Sha256: 83b5be51b322546ce7e889169767869aa1a14689871af5636b5d7e6e221c4381

Contents?: true

Size: 1.54 KB

Versions: 42

Compression:

Stored size: 1.54 KB

Contents

module Sportradar
  module Api
    module Baseball
      class Record < Data
        attr_accessor :id, :team, :wins, :losses, :win_pct, :streak, :games_back #, :runs_for, :runs_against, :run_diff, :games_behind, :streak
        alias :games_behind :games_back

        def initialize(data, type: 'overall', **opts)
          @team     = opts[:team]
          @type     = type

          update(data, **opts)
        end

        def profile
          Profile.new(self)
        end

        def update(data, **opts)
          @wins               = data["win"]
          @losses             = data["loss"]
          @win_pct            = data["win_p"]
          @home_win           = data["home_win"]
          @home_loss          = data["home_loss"]
          @away_win           = data["away_win"]
          @away_loss          = data["away_loss"]
          @streak             = data["streak"]
          @e_win              = data["e_win"]
          @e_loss             = data["e_loss"]
          @c_win              = data["c_win"]
          @c_loss             = data["c_loss"]
          @w_win              = data["w_win"]
          @w_loss             = data["w_loss"]
          @al_win             = data["al_win"]
          @al_loss            = data["al_loss"]
          @last_10_won        = data["last_10_won"]
          @last_10_lost       = data["last_10_lost"]
          @games_back         = data["games_back"]
          @wild_card_back     = data["wild_card_back"]
          @elimination_number = data["elimination_number"]
        end

      end
    end
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
sportradar-api-0.10.55 lib/sportradar/api/baseball/record.rb
sportradar-api-0.10.54 lib/sportradar/api/baseball/record.rb
sportradar-api-0.10.53 lib/sportradar/api/baseball/record.rb
sportradar-api-0.10.52 lib/sportradar/api/baseball/record.rb
sportradar-api-0.10.51 lib/sportradar/api/baseball/record.rb
sportradar-api-0.10.50 lib/sportradar/api/baseball/record.rb
sportradar-api-0.10.49 lib/sportradar/api/baseball/record.rb
sportradar-api-0.10.48 lib/sportradar/api/baseball/record.rb
sportradar-api-0.10.47 lib/sportradar/api/baseball/record.rb
sportradar-api-0.10.46 lib/sportradar/api/baseball/record.rb
sportradar-api-0.10.45 lib/sportradar/api/baseball/record.rb
sportradar-api-0.10.44 lib/sportradar/api/baseball/record.rb
sportradar-api-0.10.43 lib/sportradar/api/baseball/record.rb
sportradar-api-0.10.42 lib/sportradar/api/baseball/record.rb
sportradar-api-0.10.41 lib/sportradar/api/baseball/record.rb
sportradar-api-0.10.40 lib/sportradar/api/baseball/record.rb
sportradar-api-0.10.39 lib/sportradar/api/baseball/record.rb
sportradar-api-0.10.38 lib/sportradar/api/baseball/record.rb
sportradar-api-0.10.37 lib/sportradar/api/baseball/record.rb
sportradar-api-0.10.36 lib/sportradar/api/baseball/record.rb