Class: Sportradar::Api::Basketball::Record
- Defined in:
- lib/sportradar/api/basketball/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
-
#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/basketball/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/basketball/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/basketball/record.rb', line 5 def id @id end |
#losses ⇒ Object
Returns the value of attribute losses.
5 6 7 |
# File 'lib/sportradar/api/basketball/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/basketball/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/basketball/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/basketball/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/basketball/record.rb', line 5 def streak @streak end |
#team ⇒ Object
Returns the value of attribute team.
5 6 7 |
# File 'lib/sportradar/api/basketball/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/basketball/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/basketball/record.rb', line 5 def wins @wins end |
Instance Method Details
#update(data, **opts) ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/sportradar/api/basketball/record.rb', line 14 def update(data, **opts) @wins = data['wins'].to_i @losses = data['losses'].to_i @win_pct = data['win_pct'].to_f @points_for = data['points_for'] @points_against = data['points_against'] @point_diff = data['point_diff'] @games_behind = data['games_behind'] @streak = data['streak'] end |