Skip to content

Latest commit

 

History

History
49 lines (35 loc) · 1.73 KB

README.rdoc

File metadata and controls

49 lines (35 loc) · 1.73 KB

Hyves API Library for Ruby

Copyright Joost Hietbrink (joost@joopp.com) 2008.

A very quickly created API for the Hyves.net API 1.0, see trac.hyves-api.nl/. Check blog.joopp.com/tag/hyves for more info. Check the code for most info :)

Changes

  • 2009-07-24: Added suggested changes by Consti and some documentation changes. Should now work with oauth 0.2.7.

Installation

For a Rails install just put the hyves_api dir in your vendor dir. This version of the API depends on two gems: oauth (0.2.2) and xml-simple (1.0.11). Install them both using:

sudo gem install xml-simple
sudo gem install oauth

Note that this overwrites some methods of the oauth gem. This means that any other code depending on oauth is BROKEN!

Usage

Simplest usage is shown below. For more examples check the examples dir.

require 'hyves_api/hyves_api'
# You need to apply for a key via http://www.hyves.nl/api/apply/
key     = 'key' # Your key here
secret  = 'secret' # Your secret here

h = Hyves.new(key, secret)
# Go and login on the following URL
h.authorize_url('http://your_return_url/')
h.get_access_token
h.users_getByUsername(:username => 'claude')

You can probably call all of Hyves API methods (see trac.hyves-api.nl/hyves-api/wiki/APIMethods). Although I haven’t tested them all. Just replace the . with an _, like:

h.wwws_getByUser(:userid => 'someuserid')
h.wwws_getForFriends

Make sure you have the proper user’s authorizations. By default this is only [‘users.get’, ‘users.getByUsername’]. You can specify this using:

h = Hyves.new(key, secret, :methods => ['users.get', 'users.getByUsername'], :ha_fancylayout => true, :expirationtype => 'infinite')

TODO

  • Leave the OAuth gem or only use a small part.