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'

How 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! => 'this site doesn't exist',
:user_address => 'the address',
:locality => {:name => 'Madrid', :slug => '/es/madrid',
:country => => '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! => '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