module ESPN::Client::Audio

Public: The mapping to the AUDIO API of the ESPN developer API.

Examples

class Client
  include ESPN::Client::Audio
end

Public Instance Methods

audio(opts={}) click to toggle source

Public: Get audio podcasts and clips from ESPN.

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: {}).
:method       - The name of the sport (default: 'podcasts').
:podcast_id   - The id of the podcast (default: nil).
:recording_id - The id of the recording (default: nil).

Returns an Array of Hashie::Mash.

# File lib/espn/client/audio.rb, line 24
def audio(opts={})
  opts[:method] ||= 'podcasts'

  # Correct invalid method.
  if opts[:method] == 'podcast_recordings'
    opts[:method] = 'podcasts/recordings'
  end

  pattern = "audio/#{opts[:method]}/:podcast_id/:recording_id"
  get(pattern, opts).recordings
end