Module: ESPN::Client::Teams
- Included in:
- ESPN::Client
- Defined in:
- lib/espn/client/teams.rb
Overview
Instance Method Summary collapse
-
#team(id, *args) ⇒ Object
Public: Get a specific team from the ESPN API.
-
#teams(*args) ⇒ Object
Public: Get sport team stats and information from the ESPN API.
Instance Method Details
#team(id, *args) ⇒ Object
Public: Get a specific team from the ESPN API.
id - An id of a team. sport - A Symbol or String of the sport (optional). league - A Symbol or String of the league. If a league is passed, but
not a sport, an attempt will be made to map the league to a
sport (required).
opts - Hash options used to refine the selection. If sport and/or
league are passed in, they will override the mapped values
You can find a full list of options on the ESPN developer API
website (default: {}).
Returns a Hashie::Mash.
26 27 28 29 30 |
# File 'lib/espn/client/teams.rb', line 26 def team(id, *args) arguments = ESPN::Arguments.new(args, {}, [:league]) pattern = "sports/:sport/:league/teams/#{id}" get(pattern, arguments.).sports.first.leagues.first.teams.first end |
#teams(*args) ⇒ Object
Public: Get sport team stats and information from the ESPN API.
sport - A Symbol or String of the sport (optional). league - A Symbol or String of the league. If a league is passed, but
not a sport, an attempt will be made to map the league to a
sport (required).
opts - Hash options used to refine the selection. If sport and/or
league are passed in, they will override the mapped values
You can find a full list of options on the ESPN developer API
website (default: {}).
Returns an Array of Hashie::Mash.
44 45 46 47 48 |
# File 'lib/espn/client/teams.rb', line 44 def teams(*args) arguments = ESPN::Arguments.new(args, {}, [:league]) pattern = 'sports/:sport/:league/teams' get(pattern, arguments.).sports.first.leagues.first.teams end |