Class: SportsOddsAPI::Resources::Teams

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Teams

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 Teams.

Parameters:



43
44
45
# File 'lib/sports_odds_api/resources/teams.rb', line 43

def initialize(client:)
  @client = client
end

Instance Method Details

#get(cursor: nil, league_id: nil, limit: nil, sport_id: nil, team_id: nil, request_options: {}) ⇒ SportsOddsAPI::Internal::NextCursorPage<SportsOddsAPI::Models::Team>

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

Get a list of Teams by ID or league

Parameters:

  • cursor (String)

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

  • league_id (String)

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

  • limit (Float)

    The maximum number of Teams to return

  • sport_id (String)

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

  • team_id (String)

    A single teamID or comma-separated list of teamIDs to get data for

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

Returns:

See Also:



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/sports_odds_api/resources/teams.rb', line 28

def get(params = {})
  parsed, options = SportsOddsAPI::TeamGetParams.dump_request(params)
  @client.request(
    method: :get,
    path: "teams/",
    query: parsed.transform_keys(league_id: "leagueID", sport_id: "sportID", team_id: "teamID"),
    page: SportsOddsAPI::Internal::NextCursorPage,
    model: SportsOddsAPI::Team,
    options: options
  )
end