Class: SportsOddsAPI::Resources::Events

Inherits:
Object
  • Object
show all
Defined in:
lib/sports_odds_api/resources/events.rb,
sig/sports_odds_api/resources/events.rbs

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Events

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Events.

Parameters:



92
93
94
# File 'lib/sports_odds_api/resources/events.rb', line 92

def initialize(client:)
  @client = client
end

Instance Method Details

#get(bookmaker_id: nil, cancelled: nil, cursor: nil, ended: nil, event_id: nil, event_ids: nil, finalized: nil, include_alt_lines: nil, include_opposing_odds: nil, league_id: nil, limit: nil, live: nil, odd_id: nil, odds_available: nil, odds_present: nil, player_id: nil, sport_id: nil, started: nil, starts_after: nil, starts_before: nil, team_id: nil, type: nil, request_options: {}) ⇒ SportsOddsAPI::Internal::NextCursorPage<SportsOddsAPI::Models::Event>

Some parameter documentations has been truncated, see Models::EventGetParams for more details.

Get a list of Events

Parameters:

  • bookmaker_id (String)

    A bookmakerID or comma-separated list of bookmakerIDs to include odds for

  • cancelled (Boolean)

    Only include cancelled Events (true), only non-cancelled Events (false) or all E

  • cursor (String)

    The cursor for the request. Used to get the next group of Events. This should be

  • ended (Boolean)

    Only include Events which have have ended (true), only Events which have not end

  • event_id (String)

    An eventID to get Event data for

  • event_ids (String)

    A comma separated list of eventIDs to get Event data for

  • finalized (Boolean)

    Only include finalized Events (true), exclude unfinalized Events (false) or all

  • include_alt_lines (Boolean)

    Whether to include alternate lines in the odds byBookmaker data

  • include_opposing_odds (Boolean)

    Whether to include opposing odds for each included oddID

  • league_id (String)

    A leagueID or comma-separated list of leagueIDs to get Events for

  • limit (Float)

    The maximum number of Events to return

  • live (Boolean)

    Only include live Events (true), only non-live Events (false) or all Events (omi

  • odd_id (String)

    An oddID or comma-separated list of oddIDs to include odds for

  • odds_available (Boolean)

    Whether you want only Events which do (true) or do not (false) have odds markets

  • odds_present (Boolean)

    Whether you want only Events which do (true) or do not (false) have any associat

  • player_id (String)

    A playerID or comma-separated list of playerIDs to include Events (and associate

  • sport_id (String)

    A sportID or comma-separated list of sportIDs to get Events for

  • started (Boolean)

    Only include Events which have have previously started (true), only Events which

  • starts_after (Time)

    Get Events that start after this date

  • starts_before (Time)

    Get Events that start before this date

  • team_id (String)

    A teamID or comma-separated list of teamIDs to include Events for

  • type (String)

    Only include Events of the specified type

  • request_options (SportsOddsAPI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/sports_odds_api/resources/events.rb', line 62

def get(params = {})
  parsed, options = SportsOddsAPI::EventGetParams.dump_request(params)
  @client.request(
    method: :get,
    path: "events/",
    query: parsed.transform_keys(
      bookmaker_id: "bookmakerID",
      event_id: "eventID",
      event_ids: "eventIDs",
      include_alt_lines: "includeAltLines",
      include_opposing_odds: "includeOpposingOdds",
      league_id: "leagueID",
      odd_id: "oddID",
      odds_available: "oddsAvailable",
      odds_present: "oddsPresent",
      player_id: "playerID",
      sport_id: "sportID",
      starts_after: "startsAfter",
      starts_before: "startsBefore",
      team_id: "teamID"
    ),
    page: SportsOddsAPI::Internal::NextCursorPage,
    model: SportsOddsAPI::Event,
    options: options
  )
end