Class: Sportradar::Api::Odds::BookMarket
- Defined in:
- lib/sportradar/api/odds/book_market.rb
Instance Attribute Summary collapse
-
#book_id ⇒ Object
Returns the value of attribute book_id.
-
#book_name ⇒ Object
Returns the value of attribute book_name.
-
#external_market_id ⇒ Object
Returns the value of attribute external_market_id.
-
#external_sport_event_id ⇒ Object
Returns the value of attribute external_sport_event_id.
-
#id ⇒ Object
Returns the value of attribute id.
-
#removed ⇒ Object
Returns the value of attribute removed.
-
#response ⇒ Object
Returns the value of attribute response.
Instance Method Summary collapse
-
#initialize(data, **opts) ⇒ BookMarket
constructor
A new instance of BookMarket.
- #outcomes ⇒ Object
- #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) ⇒ BookMarket
Returns a new instance of BookMarket.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/sportradar/api/odds/book_market.rb', line 8 def initialize(data, **opts) @response = data @api = opts[:api] @id = data['external_market_id'] @market = opts[:market] @outcomes_hash = {} update(data, **opts) end |
Instance Attribute Details
#book_id ⇒ Object
Returns the value of attribute book_id.
5 6 7 |
# File 'lib/sportradar/api/odds/book_market.rb', line 5 def book_id @book_id end |
#book_name ⇒ Object
Returns the value of attribute book_name.
5 6 7 |
# File 'lib/sportradar/api/odds/book_market.rb', line 5 def book_name @book_name end |
#external_market_id ⇒ Object
Returns the value of attribute external_market_id.
5 6 7 |
# File 'lib/sportradar/api/odds/book_market.rb', line 5 def external_market_id @external_market_id end |
#external_sport_event_id ⇒ Object
Returns the value of attribute external_sport_event_id.
5 6 7 |
# File 'lib/sportradar/api/odds/book_market.rb', line 5 def external_sport_event_id @external_sport_event_id end |
#id ⇒ Object
Returns the value of attribute id.
5 6 7 |
# File 'lib/sportradar/api/odds/book_market.rb', line 5 def id @id end |
#removed ⇒ Object
Returns the value of attribute removed.
5 6 7 |
# File 'lib/sportradar/api/odds/book_market.rb', line 5 def removed @removed end |
#response ⇒ Object
Returns the value of attribute response.
5 6 7 |
# File 'lib/sportradar/api/odds/book_market.rb', line 5 def response @response end |
Instance Method Details
#outcomes ⇒ Object
19 20 21 |
# File 'lib/sportradar/api/odds/book_market.rb', line 19 def outcomes @outcomes_hash.values end |
#update(data, **opts) ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/sportradar/api/odds/book_market.rb', line 23 def update(data, **opts) @book_id = data['id'] if data['id'] # "sr:book:17324", @book_name = data['name'] if data['name'] # "MGM", @removed = data['removed'] if data['removed'] # false, @external_sport_event_id = data['external_sport_event_id'] if data['external_sport_event_id'] # "12959106", @external_market_id = data['external_market_id'] if data['external_market_id'] # "773486499", create_data(@outcomes_hash, data['outcomes'], klass: Outcome, api: @api) if data['outcomes'] end |