Class: Freesound::Client
- Inherits:
-
Object
- Object
- Freesound::Client
- Defined in:
- lib/freesound/client.rb
Instance Method Summary collapse
Instance Method Details
#pack(id) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/freesound/client.rb', line 23 def pack(id) begin Resources::Pack.find(id, params: query_params) rescue ActiveResource::BadRequest raise ResourceNotFound, "Pack with id #{id} not found" end end |
#search(query) ⇒ Object
31 32 33 34 |
# File 'lib/freesound/client.rb', line 31 def search(query) params = query_params(q: query) Resources::Sound.find(:all, from: :search, params: params) end |
#sound(id) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/freesound/client.rb', line 7 def sound(id) begin Resources::Sound.find(id, params: query_params) rescue ActiveResource::BadRequest raise ResourceNotFound, "Sound with id #{id} not found" end end |
#user(username) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/freesound/client.rb', line 15 def user(username) begin Resources::User.find(username, params: query_params) rescue ActiveResource::BadRequest raise ResourceNotFound, "User with username '#{username}' not found" end end |