Class: ApiSports::OddsResource

Inherits:
Resource
  • Object
show all
Defined in:
lib/api_sports/resources/odds.rb

Instance Attribute Summary

Attributes inherited from Resource

#client

Instance Method Summary collapse

Methods inherited from Resource

#get_request, #get_single_resource, #handle_response, #initialize

Constructor Details

This class inherits a constructor from ApiSports::Resource

Instance Method Details

#bookmakersObject



17
18
19
20
# File 'lib/api_sports/resources/odds.rb', line 17

def bookmakers
  response = get_request("odds/bookmakers")
  Collection.from_response(response, type: Bookmaker)
end

#live_betsObject



34
35
36
37
# File 'lib/api_sports/resources/odds.rb', line 34

def live_bets
  response = get_request("odds/live/bets")
  Collection.from_response(response, type: Bet)
end

#live_odds(fixture_id:, bookmaker_id: nil, **params) ⇒ Object



27
28
29
30
31
32
# File 'lib/api_sports/resources/odds.rb', line 27

def live_odds(fixture_id:, bookmaker_id: nil, **params)
  response = get_request("odds/live",
                         params: { fixture: fixture_id,
                                   bookmaker: bookmaker_id }.compact.merge(params))
  Collection.from_response(response, type: Odds)
end

#mapping(**params) ⇒ Object



12
13
14
15
# File 'lib/api_sports/resources/odds.rb', line 12

def mapping(**params)
  response = get_request("odds/mapping", params: params)
  Collection.from_response(response, type: Fixture)
end

#pre_match_betsObject



22
23
24
25
# File 'lib/api_sports/resources/odds.rb', line 22

def pre_match_bets
  response = get_request("odds/bets")
  Collection.from_response(response, type: Bet)
end

#pre_match_odds(fixture_id:, bookmaker_id: nil, **params) ⇒ Object



5
6
7
8
9
10
# File 'lib/api_sports/resources/odds.rb', line 5

def pre_match_odds(fixture_id:, bookmaker_id: nil, **params)
  response = get_request("odds",
                         params: { fixture: fixture_id,
                                   bookmaker: bookmaker_id }.compact.merge(params))
  Collection.from_response(response, type: Odds)
end