Sha256: d41317d66d5dfb035b322ac8ff0721c2655f4e29a069f0c63bbc46193694f27a

Contents?: true

Size: 1.46 KB

Versions: 8

Compression:

Stored size: 1.46 KB

Contents

module Sportradar
  module Api
    module Odds
      class Base < Data
        attr_reader :api

        def initialize
          @api = self.class.api
          @books_hash = {}
          @sports_hash = {}
        end

        def books
          @books_hash.values
        end

        def sports
          @sports_hash.values
        end

        def get_books
          data = api.get_data(path_books);
          create_data(@books_hash, data['books'], klass: Book, api: api)
          data
        end

        def get_sports
          data = api.get_data(path_sports);
          create_data(@sports_hash, data['sports'], klass: Sport, api: api)
          data
        end

        def get_event_mappings
          data = api.get_data(path_event_mappings)
        end

        def get_player_mappings
          data = api.get_data(path_player_mappings)
        end

        def get_competitor_mappings
          data = api.get_data(path_competitor_mappings)
        end

        # url path helpers
        def path_base
          ""
        end

        def path_books
          "books"
        end

        def path_sports
          "sports"
        end

        def path_event_mappings
          'sport_events/mappings'
        end

        def path_player_mappings
          'players/mappings'
        end

        def path_competitor_mappings
          'competitors/mappings'
        end

        def self.api
          Api.new(base_path: api_base)
        end

      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
sportradar-api-0.19.2 lib/sportradar/api/odds/base.rb
sportradar-api-0.19.1 lib/sportradar/api/odds/base.rb
sportradar-api-0.19.0 lib/sportradar/api/odds/base.rb
sportradar-api-0.18.1 lib/sportradar/api/odds/base.rb
sportradar-api-0.18.0 lib/sportradar/api/odds/base.rb
sportradar-api-0.17.6 lib/sportradar/api/odds/base.rb
sportradar-api-0.17.5 lib/sportradar/api/odds/base.rb
sportradar-api-0.17.5.pre lib/sportradar/api/odds/base.rb