Class: Sportradar::Api::Football::Record

Inherits:
Data
  • Object
show all
Defined in:
lib/sportradar/api/football/record.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_behindObject

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

#idObject

Returns the value of attribute id.



5
6
7
# File 'lib/sportradar/api/football/record.rb', line 5

def id
  @id
end

#lossesObject

Returns the value of attribute losses.



5
6
7
# File 'lib/sportradar/api/football/record.rb', line 5

def losses
  @losses
end

#point_diffObject

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_againstObject

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_forObject

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

#streakObject

Returns the value of attribute streak.



5
6
7
# File 'lib/sportradar/api/football/record.rb', line 5

def streak
  @streak
end

#teamObject

Returns the value of attribute team.



5
6
7
# File 'lib/sportradar/api/football/record.rb', line 5

def team
  @team
end

#win_pctObject

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

#winsObject

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