# Ringio API

## About

IMPORTANT: this project has just started, so the functionality is not complete yet.

Provides a wrapper for the [API of Ringio] in Ruby, using classes that inherit from [ActiveResource::Base] to access it.

Available classes at the moment are:

Account, Contact, Feed, Note, Ring, User

## Installing

gem install ringioAPI

### Dependencies

RubyGems >= 1.3.6 , ActiveResource >= 3.0.3

### Configuration

#### General Configuration

You can configure the API token like this:

require 'ringioAPI'
RingioAPI::Base.user = 'RINGIO API TOKEN'

Currently there is a bug in Rails 3.0.X that makes JSON objects be parsed wrong. Check the possible solutions and patches in [the corresponding thread in the Rails forums for developers]

#### Rails Configuration

In Rails, you could add a file named ringio.rb in config/initializers/ with the previous General Configuration content.

Add this line in the file named Gemfile:

gem 'ringioAPI'

In the root of the project, run:

bundle install
bundle check

## Usage

For example, to get the contact with id = 14 :

contact14 = RingioAPI::Contact.find(14)

To change the title of that contact:

contact14.title = "New title"
contact14.save

To destroy that contact:

contact14.destroy

To create a Contact for the user with person_id = 78 :

newContact = RingioAPI::Contact.new(:name => 'New contact name', :userId => 78)
newContact.save

If you have problems, check Ringio API specifications for details.

## License

Under the Mozilla Public License Version 1.1

## Author

Álvaro Martín Fraguas][alvaro

[ringio]: www.ringio.com [active-resource]: api.rubyonrails.org/classes/ActiveResource/Base.html [alvaro]: github.com/amartinfraguas [bug]: rails.lighthouseapp.com/projects/8994/tickets/5867-activeresource-is-not-parsing-json-correct