Sha256: c3e582a94fd0a9dd54189d106453924d9b8a5e0fa45acecc8aca2ae34c067741

Contents?: true

Size: 1.48 KB

Versions: 128

Compression:

Stored size: 1.48 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 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

128 entries across 128 versions & 1 rubygems

Version Path
sportradar-api-0.11.28 lib/sportradar/api/baseball/record.rb
sportradar-api-0.11.27 lib/sportradar/api/baseball/record.rb
sportradar-api-0.11.26 lib/sportradar/api/baseball/record.rb
sportradar-api-0.11.25 lib/sportradar/api/baseball/record.rb
sportradar-api-0.11.24 lib/sportradar/api/baseball/record.rb
sportradar-api-0.11.23 lib/sportradar/api/baseball/record.rb
sportradar-api-0.11.22 lib/sportradar/api/baseball/record.rb
sportradar-api-0.11.21 lib/sportradar/api/baseball/record.rb
sportradar-api-0.11.20 lib/sportradar/api/baseball/record.rb
sportradar-api-0.11.19 lib/sportradar/api/baseball/record.rb
sportradar-api-0.11.18 lib/sportradar/api/baseball/record.rb
sportradar-api-0.11.17 lib/sportradar/api/baseball/record.rb
sportradar-api-0.11.16 lib/sportradar/api/baseball/record.rb
sportradar-api-0.11.15 lib/sportradar/api/baseball/record.rb
sportradar-api-0.11.14 lib/sportradar/api/baseball/record.rb
sportradar-api-0.11.13 lib/sportradar/api/baseball/record.rb
sportradar-api-0.11.12 lib/sportradar/api/baseball/record.rb
sportradar-api-0.11.11 lib/sportradar/api/baseball/record.rb
sportradar-api-0.11.10 lib/sportradar/api/baseball/record.rb
sportradar-api-0.11.9 lib/sportradar/api/baseball/record.rb