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.20.2 lib/sportradar/api/football/record.rb
sportradar-api-0.20.1 lib/sportradar/api/football/record.rb
sportradar-api-0.20.0 lib/sportradar/api/football/record.rb
sportradar-api-0.20.0.pre2 lib/sportradar/api/football/record.rb
sportradar-api-0.20.0.pre lib/sportradar/api/football/record.rb
sportradar-api-0.19.6 lib/sportradar/api/football/record.rb
sportradar-api-0.19.5 lib/sportradar/api/football/record.rb
sportradar-api-0.19.4 lib/sportradar/api/football/record.rb
sportradar-api-0.19.3 lib/sportradar/api/football/record.rb
sportradar-api-0.19.2 lib/sportradar/api/football/record.rb
sportradar-api-0.19.1 lib/sportradar/api/football/record.rb
sportradar-api-0.19.0 lib/sportradar/api/football/record.rb
sportradar-api-0.18.1 lib/sportradar/api/football/record.rb
sportradar-api-0.18.0 lib/sportradar/api/football/record.rb
sportradar-api-0.17.6 lib/sportradar/api/football/record.rb
sportradar-api-0.17.5 lib/sportradar/api/football/record.rb
sportradar-api-0.17.5.pre lib/sportradar/api/football/record.rb
sportradar-api-0.17.4 lib/sportradar/api/football/record.rb
sportradar-api-0.17.3 lib/sportradar/api/football/record.rb
sportradar-api-0.17.2 lib/sportradar/api/football/record.rb