Class: Sportradar::Api::Football::Record
- Defined in:
- lib/sportradar/api/football/record.rb
Instance Attribute Summary collapse
-
#games_behind ⇒ Object
Returns the value of attribute games_behind.
-
#id ⇒ Object
Returns the value of attribute id.
-
#losses ⇒ Object
Returns the value of attribute losses.
-
#point_diff ⇒ Object
Returns the value of attribute point_diff.
-
#points_against ⇒ Object
Returns the value of attribute points_against.
-
#points_for ⇒ Object
Returns the value of attribute points_for.
-
#streak ⇒ Object
Returns the value of attribute streak.
-
#team ⇒ Object
Returns the value of attribute team.
-
#win_pct ⇒ Object
Returns the value of attribute win_pct.
-
#wins ⇒ Object
Returns the value of attribute wins.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(data, type: 'overall', **opts) ⇒ Record
constructor
A new instance of Record.
- #update(data, **opts) ⇒ Object
Methods inherited from Data
#all_attributes, #attributes, #create_data, #parse_into_array, #parse_into_array_with_options, #parse_out_hashes, #structure_links, #update_data
Constructor Details
#initialize(data, type: 'overall', **opts) ⇒ Record
Returns a new instance of Record.
7 8 9 10 11 12 |
# File 'lib/sportradar/api/football/record.rb', line 7 def initialize(data, type: 'overall', **opts) @team = opts[:team] @type = type update(data, **opts) end |
Instance Attribute Details
#games_behind ⇒ Object
Returns the value of attribute games_behind.
5 6 7 |
# File 'lib/sportradar/api/football/record.rb', line 5 def games_behind @games_behind end |
#id ⇒ Object
Returns the value of attribute id.
5 6 7 |
# File 'lib/sportradar/api/football/record.rb', line 5 def id @id end |
#losses ⇒ Object
Returns the value of attribute losses.
5 6 7 |
# File 'lib/sportradar/api/football/record.rb', line 5 def losses @losses end |
#point_diff ⇒ Object
Returns the value of attribute point_diff.
5 6 7 |
# File 'lib/sportradar/api/football/record.rb', line 5 def point_diff @point_diff end |
#points_against ⇒ Object
Returns the value of attribute points_against.
5 6 7 |
# File 'lib/sportradar/api/football/record.rb', line 5 def points_against @points_against end |
#points_for ⇒ Object
Returns the value of attribute points_for.
5 6 7 |
# File 'lib/sportradar/api/football/record.rb', line 5 def points_for @points_for end |
#streak ⇒ Object
Returns the value of attribute streak.
5 6 7 |
# File 'lib/sportradar/api/football/record.rb', line 5 def streak @streak end |
#team ⇒ Object
Returns the value of attribute team.
5 6 7 |
# File 'lib/sportradar/api/football/record.rb', line 5 def team @team end |
#win_pct ⇒ Object
Returns the value of attribute win_pct.
5 6 7 |
# File 'lib/sportradar/api/football/record.rb', line 5 def win_pct @win_pct end |
#wins ⇒ Object
Returns the value of attribute wins.
5 6 7 |
# File 'lib/sportradar/api/football/record.rb', line 5 def wins @wins end |
Instance Method Details
#<=>(other) ⇒ Object
25 26 27 |
# File 'lib/sportradar/api/football/record.rb', line 25 def <=>(other) self.win_pct <=> other.win_pct end |
#update(data, **opts) ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/sportradar/api/football/record.rb', line 14 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 |