earfl

Get Version

0.1.3

→ ‘earfl’

What

A simple client to the earfl REST API. You can use this gem in standalone ruby or rails applications to collect/attach voice content for anything!

Installing

sudo gem install earfl --include-dependencies 

The basics

An earfl is a great audio moment. A story. A reaction. A review. An opinion. A once-in-a-lifetime event captured in real time. Everybody’s got a story. What’s yours? Do tell. www.earfl.com

Use this gem to quickly add Earfl’s phone services to your web application to allow users to record, tag, search, and share audio content.

Demonstration of usage

  @earfl = Earfl::Client.new("YOUR_API_KEY", "YOUR_API_SECRET")

  #create audio groups/buckets for collecting stories
  group = @earfl.groups_create(
      'group[title]' => 'A Thousand Tales',
      'group[description]' => 'Welcome to the group of one thousand special tales.',
      'group[default_tags]' => 'special, specialstories')

  #access the group's attributes the same way
  puts group.title
  puts group.call_in_number

  #retrieve a group by id
  retrieved_group = @earfl.groups_read('id' => group.id)

  # Search for one term.
  # basic search defaults most parameters
  recording_list = @earfl.recordings_search('query' => 'ugh')
  # Search for multiple terms concatenated together with a '+'
  recording_list = @earfl.recordings_search('query' => 'ugh+bear')

  # extended search with optional parameters.
  recording_list = @earfl.recordings_search('query' => 'ugh+bear+rabbit',
      'sort_by' => 'title', 'results_per_page' => '5', 'page' => '2')

Forum

http://groups.google.com/group/earfl

How to submit patches

Read the 8 steps for fixing other people’s code and for section 8b: Submit patch to Google Groups, use the Google Group above.

The trunk repository is svn://rubyforge.org/var/svn/earfl/trunk for anonymous access.

License

This code is free to use under the terms of the MIT license.

Contact

Comments are welcome. Send an email to Matthew Wilson via the forum

Ruby on Rails Configuration

environment.rb

require 'earfl'
EARFL = Earfl::Client.new("YOUR_API_KEY", "YOUR_API_SECRET")

Examples for Ruby on Rails

In a controller

  def show
    @voice_bucket = EARFL.groups_read('id' => @model.voice_bucket_id)
  end

  def create
    @voice_bucket = EARFL.groups_create('group[title]' => 'New Group',
        'group[description]' => 'Group Description')
    @model.voice_group_id = @voice_bucket.id
  end

In a View

<p>
  <b>Voice bucket:</b>
  <%=h @model.voice_bucket_id %>
    <br/>
    Call <%= @voice_bucket.call_in_number %> to leave voice comments.
</p>
<p>
    Audio Comments:
    <br/>
    <% @voice_bucket.recordings.each do |rec| %>
      <%= rec.pinner_player  %><br/>
    <% end %>
</p>

Earfl Inc., 19th March 2008