Module: ESPN::Client::Teams
- Included in:
- ESPN::Client
- Defined in:
- lib/espn/client/teams.rb
Instance Method Summary collapse
-
#teams(opts = {}) ⇒ Object
Public: Get sport team stats and information from the ESPN API.
Instance Method Details
#teams(opts = {}) ⇒ Object
Public: Get sport team stats and information from the ESPN API.
opts - Hash options used to refine the selection (default: {}).
- :sport - The name of the sport (default: nil).
- :league - The name of the league (default: nil).
- :team_id - The id of the team (default: nil).
Returns an Array of Hashie::Mash.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/espn/client/teams.rb', line 13 def teams(opts={}) url = 'sports' unless opts[:sport].to_s.empty? url += "/#{opts[:sport]}" unless opts[:league].to_s.empty? url += "/#{opts[:league]}" end end url += '/teams' unless opts[:team_id].to_s.empty? url += "/#{opts[:team_id]}" end get(url, opts) end |