Freesound Ruby

Consume the Freesound.org API with Ruby.

Build Status Code Climate Gem Version

Installation

Add this line to your application's Gemfile:

gem 'freesound_ruby'

And then execute:

$ bundle

Or install it yourself as:

$ gem install freesound_ruby

Usage

You will need an API key to use the Freesound gem:

require 'freesound'
Freesound.api_key = "your_api_key"

And a client object:

client = Freesound::Client.new

Freesound exposes three resources: sounds, users, and packs. You can request them directly from the client:

sound = client.sound(17185)
user  = client.user("alexgenco")
pack  = client.pack(5107)

Resources will respond to any attributes returned by the API:

sound.bitrate # => 1411
user.username # => "alexgenco"
pack.name     # => "Iceland"

You can also search for sounds:

client.search("kick") # => (many sounds)

The Freesound API also supports pagination and robust search filters, but this library doesn't support them quite yet.

More features to come!

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

You will need a Freesound.org API key to run the integration tests. Get one here and assign it to the FREESOUND_KEY environment variable.