Module: OfficialFM::Projects
- Included in:
- Client
- Defined in:
- lib/officialfm/projects.rb
Defined Under Namespace
Modules: ProjectMethods
Instance Method Summary collapse
-
#project(id, options = {}) ⇒ Object
Retrieve information about a specific project.
- #project_playlists(id, options = {}) ⇒ Object
- #project_tracks(id, options = {}) ⇒ Object
-
#projects(search_param, options = {}) ⇒ Object
Search for a project.
Instance Method Details
#project(id, options = {}) ⇒ Object
Retrieve information about a specific project
21 22 23 24 25 26 |
# File 'lib/officialfm/projects.rb', line 21 def project(id, ={}) url = resource_url(id, parent: 'projects') response = get(url, ).body.project extend_response(response, ProjectMethods) end |
#project_playlists(id, options = {}) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/officialfm/projects.rb', line 28 def project_playlists(id, ={}) url = resource_url(id, { parent: 'projects', child: 'playlists' }) response = get url, playlists = response.body.playlists.map do |p| # remove the unnecessary root p.playlist end playlists end |
#project_tracks(id, options = {}) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/officialfm/projects.rb', line 41 def project_tracks(id, ={}) url = resource_url(id, { parent: 'projects', child: 'tracks' }) response = get url, tracks = response.body.tracks.map do |t| # remove the unnecessary root t.track end tracks end |
#projects(search_param, options = {}) ⇒ Object
Search for a project
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/officialfm/projects.rb', line 5 def projects(search_param, ={}) response = get '/projects/search', .merge(:q => search_param) response.body.projects.map! do |p| # remove the unnecessary root actual_project = p.project extend_response(actual_project, ProjectMethods) actual_project end response.body end |