Class: Sportradar::Api::Odds::Market
- Defined in:
- lib/sportradar/api/odds/market.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#player ⇒ Object
Returns the value of attribute player.
-
#response ⇒ Object
Returns the value of attribute response.
Instance Method Summary collapse
- #book_markets ⇒ Object
-
#initialize(data, **opts) ⇒ Market
constructor
A new instance of Market.
- #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, **opts) ⇒ Market
Returns a new instance of Market.
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/sportradar/api/odds/market.rb', line 8 def initialize(data, **opts) @response = data @api = opts[:api] @id = data['id'] @name = data['name'] @player = opts['player'] @book_markets_hash = {} update(data, **opts) end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
5 6 7 |
# File 'lib/sportradar/api/odds/market.rb', line 5 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/sportradar/api/odds/market.rb', line 5 def name @name end |
#player ⇒ Object
Returns the value of attribute player.
5 6 7 |
# File 'lib/sportradar/api/odds/market.rb', line 5 def player @player end |
#response ⇒ Object
Returns the value of attribute response.
5 6 7 |
# File 'lib/sportradar/api/odds/market.rb', line 5 def response @response end |
Instance Method Details
#book_markets ⇒ Object
21 22 23 |
# File 'lib/sportradar/api/odds/market.rb', line 21 def book_markets @book_markets_hash.values end |
#update(data, **opts) ⇒ Object
25 26 27 |
# File 'lib/sportradar/api/odds/market.rb', line 25 def update(data, **opts) create_data(@book_markets_hash, data['books'], klass: BookMarket, api: @api, market: self, player: @player) if data['books'] end |