Class: SportsApi::Football::TeamResource

Inherits:
Resource
  • Object
show all
Defined in:
lib/sports_api/football/resources/teams/team.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(id:) ⇒ Object



20
21
22
23
# File 'lib/sports_api/football/resources/teams/team.rb', line 20

def find(id:)
  response = get_request('teams', params: { id: id.to_s })
  SportsApi::Football::Team.new(response.body['response'][0])
end

#list(**params) ⇒ Object

Arguments: id: [Integer](optional) - The team ID. name: [String](optional) - The name of the team. league: [Integer](optional) - The league ID. season: [Integer](optional) - The season year (= YYYY). country: [String] (optional) - The name of the country. code: [String] (optional) - The country code (= XXX). venue: [Integer] (optional) - The venue ID. search: [String] (optional) - The team or country name, can be some letters (>= XXX).



15
16
17
18
# File 'lib/sports_api/football/resources/teams/team.rb', line 15

def list(**params)
  response = get_request('teams', params:)
  Collection.from_response(response, type: SportsApi::Football::Team)
end