Module: ESPN::Client::Athletes
- Included in:
- ESPN::Client
- Defined in:
- lib/espn/client/athletes.rb
Instance Method Summary collapse
-
#athletes(opts = {}) ⇒ Object
Public: Get athlete stats and information from the ESPN API.
Instance Method Details
#athletes(opts = {}) ⇒ Object
Public: Get athlete 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).
- :athlete_id - The id of the athlete (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/athletes.rb', line 13 def athletes(opts={}) url = "sports" unless opts[:sport].to_s.empty? url += "/#{opts[:sport]}" unless opts[:league].to_s.empty? url += "/#{opts[:league]}" end end url += "/athletes" unless opts[:athlete_id].to_s.empty? url += "/#{opts[:athlete_id]}" end get(url, opts) end |