Sha256: d467d5c2d69926484f705a2af94a56a3258628a177c148943578950be99348a0

Contents?: true

Size: 1.25 KB

Versions: 128

Compression:

Stored size: 1.25 KB

Contents

module Sportradar
  module Api
    module Football
      class Record < Data
        attr_accessor :id, :team, :wins, :losses, :win_pct, :points_for, :points_against, :point_diff, :games_behind, :streak

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

          update(data, **opts)
        end

        def update(data, **opts)
          @wins           = data['wins']
          @losses         = data['losses']
          @win_pct        = data['win_pct']
          @points_for     = data['points_for']
          @points_against = data['points_against']
          @point_diff     = data['point_diff']
          @games_behind   = data['games_behind']
          @streak         = data['streak']
        end

        def <=>(other)
          self.win_pct <=> other.win_pct
        end

      end
    end
  end
end

__END__

"wins"=>14,
"losses"=>2,
"ties"=>0,
"win_pct"=>0.875,
"points_for"=>441,
"points_against"=>250,
"points_rank"=>4,
"touchdown_diff"=>24,
"conf_h2h"=>0,
"rank"=>{"conference"=>1, "division"=>1},
"streak"=>{"type"=>"win", "length"=>7, "desc"=>"Won 7"},
"strength_of_schedule"=>{"sos"=>0.439453, "wins"=>113, "total"=>256},
"strength_of_victory"=>{"sov"=>0.424, "wins"=>95, "total"=>224},

Version data entries

128 entries across 128 versions & 1 rubygems

Version Path
sportradar-api-0.13.14 lib/sportradar/api/football/record.rb
sportradar-api-0.13.13 lib/sportradar/api/football/record.rb
sportradar-api-0.13.12 lib/sportradar/api/football/record.rb
sportradar-api-0.13.11 lib/sportradar/api/football/record.rb
sportradar-api-0.13.10 lib/sportradar/api/football/record.rb
sportradar-api-0.13.9 lib/sportradar/api/football/record.rb
sportradar-api-0.13.8 lib/sportradar/api/football/record.rb
sportradar-api-0.13.7 lib/sportradar/api/football/record.rb
sportradar-api-0.13.6 lib/sportradar/api/football/record.rb
sportradar-api-0.13.5 lib/sportradar/api/football/record.rb
sportradar-api-0.13.4 lib/sportradar/api/football/record.rb
sportradar-api-0.13.3 lib/sportradar/api/football/record.rb
sportradar-api-0.13.2 lib/sportradar/api/football/record.rb
sportradar-api-0.13.1 lib/sportradar/api/football/record.rb
sportradar-api-0.13.0 lib/sportradar/api/football/record.rb
sportradar-api-0.12.3 lib/sportradar/api/football/record.rb
sportradar-api-0.12.2 lib/sportradar/api/football/record.rb
sportradar-api-0.12.1 lib/sportradar/api/football/record.rb
sportradar-api-0.12.0 lib/sportradar/api/football/record.rb
sportradar-api-0.11.69 lib/sportradar/api/football/record.rb