Class: SportsOddsAPI::Resources::Players

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Players

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

Parameters:



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

def initialize(client:)
  @client = client
end

Instance Method Details

#get(cursor: nil, event_id: nil, limit: nil, player_id: nil, team_id: nil, request_options: {}) ⇒ SportsOddsAPI::Internal::NextCursorPage<SportsOddsAPI::Models::Player>

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

Get a list of Players for a specific Team or Event

Parameters:

  • cursor (String)

    The cursor for the request. Used to get the next group of Players. This should b

  • event_id (String)

    EventID to get Players data for

  • limit (Float)

    The maximum number of Players to return

  • player_id (String)

    PlayerID to get data for

  • team_id (String)

    TeamID to get Players 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/players.rb', line 28

def get(params = {})
  parsed, options = SportsOddsAPI::PlayerGetParams.dump_request(params)
  @client.request(
    method: :get,
    path: "players/",
    query: parsed.transform_keys(event_id: "eventID", player_id: "playerID", team_id: "teamID"),
    page: SportsOddsAPI::Internal::NextCursorPage,
    model: SportsOddsAPI::Player,
    options: options
  )
end