Class: Sportradar::Api::Odds::Outcome

Inherits:
Data
  • Object
show all
Defined in:
lib/sportradar/api/odds/outcome.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, **opts) ⇒ Outcome

Returns a new instance of Outcome.



9
10
11
12
13
14
15
16
# File 'lib/sportradar/api/odds/outcome.rb', line 9

def initialize(data, **opts)
  @response = data
  @api      = opts[:api]

  @id       = data['id']

  update(data, **opts)
end

Instance Attribute Details

#external_outcome_idObject

Returns the value of attribute external_outcome_id.



6
7
8
# File 'lib/sportradar/api/odds/outcome.rb', line 6

def external_outcome_id
  @external_outcome_id
end

#idObject

Returns the value of attribute id.



5
6
7
# File 'lib/sportradar/api/odds/outcome.rb', line 5

def id
  @id
end

#odds_americanObject

Returns the value of attribute odds_american.



6
7
8
# File 'lib/sportradar/api/odds/outcome.rb', line 6

def odds_american
  @odds_american
end

#odds_decimalObject

Returns the value of attribute odds_decimal.



6
7
8
# File 'lib/sportradar/api/odds/outcome.rb', line 6

def odds_decimal
  @odds_decimal
end

#odds_fractionObject

Returns the value of attribute odds_fraction.



6
7
8
# File 'lib/sportradar/api/odds/outcome.rb', line 6

def odds_fraction
  @odds_fraction
end

#open_odds_americanObject

Returns the value of attribute open_odds_american.



6
7
8
# File 'lib/sportradar/api/odds/outcome.rb', line 6

def open_odds_american
  @open_odds_american
end

#open_odds_decimalObject

Returns the value of attribute open_odds_decimal.



6
7
8
# File 'lib/sportradar/api/odds/outcome.rb', line 6

def open_odds_decimal
  @open_odds_decimal
end

#open_odds_fractionObject

Returns the value of attribute open_odds_fraction.



6
7
8
# File 'lib/sportradar/api/odds/outcome.rb', line 6

def open_odds_fraction
  @open_odds_fraction
end

#open_totalObject

Returns the value of attribute open_total.



6
7
8
# File 'lib/sportradar/api/odds/outcome.rb', line 6

def open_total
  @open_total
end

#removedObject

Returns the value of attribute removed.



6
7
8
# File 'lib/sportradar/api/odds/outcome.rb', line 6

def removed
  @removed
end

#responseObject

Returns the value of attribute response.



5
6
7
# File 'lib/sportradar/api/odds/outcome.rb', line 5

def response
  @response
end

#totalObject

Returns the value of attribute total.



6
7
8
# File 'lib/sportradar/api/odds/outcome.rb', line 6

def total
  @total
end

#typeObject

Returns the value of attribute type.



6
7
8
# File 'lib/sportradar/api/odds/outcome.rb', line 6

def type
  @type
end

Instance Method Details

#update(data, **opts) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/sportradar/api/odds/outcome.rb', line 18

def update(data, **opts)
  @type                 = data['type']                  if data['type']
  @odds_decimal         = data['odds_decimal']          if data['odds_decimal']
  @odds_american        = data['odds_american']         if data['odds_american']
  @odds_fraction        = data['odds_fraction']         if data['odds_fraction']
  @open_odds_decimal    = data['open_odds_decimal']     if data['open_odds_decimal']
  @open_odds_american   = data['open_odds_american']    if data['open_odds_american']
  @open_odds_fraction   = data['open_odds_fraction']    if data['open_odds_fraction']
  @total                = data['total']                 if data['total']
  @open_total           = data['open_total']            if data['open_total']
  @external_outcome_id  = data['external_outcome_id']   if data['external_outcome_id']
  @removed              = data['removed']               if data['removed']
end