Class: SportsOddsAPI::Resources::Stats

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Stats

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

Parameters:



39
40
41
# File 'lib/sports_odds_api/resources/stats.rb', line 39

def initialize(client:)
  @client = client
end

Instance Method Details

#get(sport_id: nil, stat_id: nil, stat_level: nil, request_options: {}) ⇒ Array<SportsOddsAPI::Models::Stat>

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

Get a list of StatIDs

Parameters:

  • sport_id (String)

    SportID to get StatIDs for

  • stat_id (String)

    StatID to get data for

  • stat_level (String)

    Level of the stat, must be used in combination with sportID. Must be one of all,

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

Returns:

See Also:



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/sports_odds_api/resources/stats.rb', line 24

def get(params = {})
  parsed, options = SportsOddsAPI::StatGetParams.dump_request(params)
  @client.request(
    method: :get,
    path: "stats/",
    query: parsed.transform_keys(sport_id: "sportID", stat_id: "statID", stat_level: "statLevel"),
    unwrap: :data,
    model: SportsOddsAPI::Internal::Type::ArrayOf[SportsOddsAPI::Stat],
    options: options
  )
end