Module: ESPN::Client::Standings

Included in:
ESPN::Client
Defined in:
lib/espn/client/standings.rb

Instance Method Summary collapse

Instance Method Details

#standings(opts = {}) ⇒ Object

Public: Get the latest league and divisional standings from ESPN.

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).

Returns an Array of Hashie::Mash.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/espn/client/standings.rb', line 12

def standings(opts={})
  url = 'sports'

  unless opts[:sport].to_s.empty?
    url += "/#{opts[:sport]}"
    unless opts[:league].to_s.empty?
      url += "/#{opts[:league]}"
    end
  end

  url += '/standings'

  get(url, opts)
end