Class: SportsApi::Football::TeamStatisticResource

Inherits:
Resource
  • Object
show all
Defined in:
lib/sports_api/football/resources/teams/team_statistic.rb

Instance Attribute Summary

Attributes inherited from Resource

#client

Instance Method Summary collapse

Methods inherited from Resource

#get_request, #initialize

Constructor Details

This class inherits a constructor from SportsApi::Resource

Instance Method Details

#find(league:, season:, team:, date: nil) ⇒ Object

Arguments: league: [Integer](required) - The league ID. season: [Integer](required) - The season year (= YYYY). team: [Integer](required) - The team ID. date: [String](optional) - The limit date (YYYY-MM-DD).



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/sports_api/football/resources/teams/team_statistic.rb', line 11

def find(league:, season:, team:, date: nil)
  params = {
    league: league.to_s,
    season: season.to_s,
    team: team.to_s
  }
  params[:date] = date.to_s if date

  response = get_request('teams/statistics', params:)
  SportsApi::Football::TeamStatistic.new(response.body['response'])
end