oos4ruby

Get Version

0.2.1

→ ‘oos4ruby’

What

oos4ruby is a ruby library to interact with the 11870 API.

Installing

sudo gem install oos4ruby

The basics

The class “Oos4ruby::Oos” is the endpoint to interact with the api. This class provides the authentication methods in addition to the search and user management methods.

oos = Oos4ruby::Oos.new

Authenticate as an application in order to perform searches or explore the user contents:

oos.auth_app 'your appToken', 'your secret key'

Authenticate as a user in order to manage his contents:

oos.auth_user 'user email in 11870.com', 'user authorization token'

Method to perform a search inside 11870:

oos.search :q => 'cheap restaurants in new york'

How to obtain the services or places saved by a user:

#if your app is authenticated with this user authorization token
user = oos.user
#if your app is authenticated to expore contents
user = oos.user 'user slug in 11870'

sites = user.sites

How to add a review from a site that doesn’t exist in 11870:

oos.user.sites.create! {:title => "this site doesn't exist", 
    :user_address => 'the address', 
    :locality => {:name => 'Madrid', :slug => '/es/madrid'},
    :country => {:name => 'EspaƱa', :slug => '/es'} 
    :summary => 'review title', :content => 'review content'
    :tags => ['tapas', 'tipical spanish'], :lists => ['food']}

How to add a review from a site that exists in 11870:

oos.user.sites.create! {:id => '11870 site id',
    :summary => 'review title', :content => 'review content'}

How to obtain all user contacts in 11870:

contacts = user.contacts

How to obtain the multimedia feed associated with a review:

media_collection = user.sites[0].multimedia

How to add a new image or video to a review:

user.sites[0].multimedia.create! {
  :file => 'image.png',
  :content_length => File.size('image.png'),
  :content_type => 'image/png'
}

Forum

http://groups.google.com/group/api-11870

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 http://api-11870.googlecode.com/svn/trunk/oos4ruby for anonymous access.

License

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

Contact

Comments are welcome. Send an email to David Calavera email via the forum

David Calavera, 19th November 2009
Theme extended from Paul Battley