Module: OfficialFM::Tracks

Included in:
Client
Defined in:
lib/officialfm/tracks.rb

Instance Method Summary collapse

Instance Method Details

#track(id, options = {}) ⇒ Object

Retrieve information about a specific track



17
18
19
20
21
22
# File 'lib/officialfm/tracks.rb', line 17

def track(id, options={})
  url = resource_url(id, parent: 'tracks')

  response = get url, options
  response.body.track
end

#tracks(search_param, options = {}) ⇒ Object

Search for tracks



5
6
7
8
9
10
11
12
13
14
# File 'lib/officialfm/tracks.rb', line 5

def tracks(search_param, options={})
  response = get '/tracks/search', options.merge(:q => search_param)

  response.body.tracks.map! do |t|
    # remove useless root
    t.track
  end

  response.body
end