Sha256: 4e64a223e8f5ccc36ae560a893778abc206a7e43309f976daea4ef411d5350f4

Contents?: true

Size: 1.26 KB

Versions: 17

Compression:

Stored size: 1.26 KB

Contents

module Sportradar
  module Api
    module Odds
      class BookMarket < Data
        attr_accessor :response, :id, :book_id, :book_name, :removed, :external_sport_event_id, :external_market_id


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

          @id       = data['external_market_id']
          @market   = opts[:market]
          @outcomes_hash = {}

          update(data, **opts)
        end

        def outcomes
          @outcomes_hash.values
        end

        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

      end
    end
  end
end


Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
sportradar-api-0.20.2 lib/sportradar/api/odds/book_market.rb
sportradar-api-0.20.1 lib/sportradar/api/odds/book_market.rb
sportradar-api-0.20.0 lib/sportradar/api/odds/book_market.rb
sportradar-api-0.20.0.pre2 lib/sportradar/api/odds/book_market.rb
sportradar-api-0.20.0.pre lib/sportradar/api/odds/book_market.rb
sportradar-api-0.19.6 lib/sportradar/api/odds/book_market.rb
sportradar-api-0.19.5 lib/sportradar/api/odds/book_market.rb
sportradar-api-0.19.4 lib/sportradar/api/odds/book_market.rb
sportradar-api-0.19.3 lib/sportradar/api/odds/book_market.rb
sportradar-api-0.19.2 lib/sportradar/api/odds/book_market.rb
sportradar-api-0.19.1 lib/sportradar/api/odds/book_market.rb
sportradar-api-0.19.0 lib/sportradar/api/odds/book_market.rb
sportradar-api-0.18.1 lib/sportradar/api/odds/book_market.rb
sportradar-api-0.18.0 lib/sportradar/api/odds/book_market.rb
sportradar-api-0.17.6 lib/sportradar/api/odds/book_market.rb
sportradar-api-0.17.5 lib/sportradar/api/odds/book_market.rb
sportradar-api-0.17.5.pre lib/sportradar/api/odds/book_market.rb