Sha256: 1711372332cdb7a5b668398cb0cad92f71603f70c620a7b3a1003d66a1833656

Contents?: true

Size: 1.22 KB

Versions: 3

Compression:

Stored size: 1.22 KB

Contents

module Sportradar
  module Api
    module Odds
      class Competition < Data
        attr_accessor :response, :api, :id, :name, :gender, :markets, :futures, :player_props


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

          @name         = data['name']
          @gender       = data['gender']
          @has_markets      = data['markets']       # boolean
          @has_futures      = data['futures']       # boolean
          @has_player_props = data['player_props']  # boolean

          @sport_events_hash = {}
        end

        def update(data, **opts)

        end

        def sport_events
          @sport_events_hash.values
        end

        def get_player_props
          data = api.get_data(path_player_props)
          create_data(@sport_events_hash, data["competition_sport_events_players_props"], klass: SportEvent, api: api)
          data
        end

        # url path helpers
        def path_base
          "competitions/#{id}"
        end

        def path_player_props
          "#{path_base}/players_props"
        end

        def path_player_props
          "#{path_base}/players_props"
        end

      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sportradar-api-0.17.6 lib/sportradar/api/odds/competition.rb
sportradar-api-0.17.5 lib/sportradar/api/odds/competition.rb
sportradar-api-0.17.5.pre lib/sportradar/api/odds/competition.rb