acoffman / rapleaf_api

This ruby gem will serve as an interface to Rapleaf's person and graph apis. Note that this library is not maintained by or affiliated with Rapleaf in any way and you will still need a (free) api key from Rapleaf to use this.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rapleaf_api

NOTE: The Rapleaf API has changed versions and formats since this gem was created. I am going to leave it up here for reference but for production code you should look for Rapleaf's officially maintained repository Personalization-Dev-Kits

Getting Started

You need to first get an API key found here:

http://www.rapleaf.com/developer/

Installation

sudo gem install rapleaf_api

Usage

require 'rubygems'
require 'rapleaf_api'

rapAPI = RapleafApi::Api.new("your api key")

Person API

#by email
person = rapAPI.query({:type => :person, :opts => {:email => "email"}})

#by md5 hash of email
person = rapAPI.query({:type => :person, :opts => {:hash => RapleafApi::MD5, :id => "md5 hash of email"}})

#by site id
person = rapAPI.query({:type => :person, :opts => {:site => RapleafApi::TWITTER, :id => "twitter username"}})

Graph API

#by email (note this query will only work if you have an email set stored with Rapleaf)
friendList = rapAPI.query({:type => :graph, :opts => {:id => "email address"}})

#by email, return Rapleaf IDs instead of scoped emails
friendList = rapAPI.query({:type => :graph, :opts => {:id => "email address", :return_rapid => true}})

#by Rapleaf ID, this will return a list of Rapleaf IDs
friendList = rapAPI.query({:type => :graph, :opts => {:id => "rapleaf id", :by_rapid => true}})

More Advanced Examples :: Combine the APIs for interesting results.

Authors

Special Thanks

Dave Paola - Pointing out a bug in the sample code

About

This ruby gem will serve as an interface to Rapleaf's person and graph apis. Note that this library is not maintained by or affiliated with Rapleaf in any way and you will still need a (free) api key from Rapleaf to use this.


Languages

Language:Ruby 100.0%