This is a Ruby library for interfacing with the Sugestio recommendation service. Data is submitted as JSON.
Sugestio is a scalable and fault tolerant service that now brings the power of web personalisation to all developers. The RESTful web service provides an easy to use interface and a set of developer libraries that enable you to enrich your content portals, e-commerce sites and other content based websites.
To access the Sugestio service, you need an account name and a secret key. To run the examples from the tutorial, you can use the following credentials:
-
account name: sandbox
-
secret key: demo
The Sandbox is a read-only account. You can use these credentials to experiment with the service. The Sandbox can give personal recommendations for users 1 through 5, and similar items for items 1 through 5.
When you are ready to work with real data, you may apply for a developer account through the Sugestio website.
The following API features are implemented:
-
get personalized recommendations for a given user
-
get items that are similar to a given item
-
get users that are similar to a given user
-
(bulk) submit user activity (consumptions): clicks, purchases, ratings, …
-
(bulk) submit item metadata: description, location, tags, categories, …
-
(bulk) submit user metadata: gender, location, birthday, …
-
delete consumptions
-
delete item metadata
-
delete user metadata
-
get performance data (analytics): precision, recall, …
-
oauth gem (github.com/pelle/oauth)
Written by Martin May (github.com/HiroProt). Portions inspired by (github.com/archfear/simplegeo-ruby).
Copyright © 2010 Martin May. See LICENSE for details.
require 'sugestio' client = Sugestio.new('sandbox', 'demo') result = client.get_recommendations(user_id) result.each { |recommendation| print "Item #{recommendation['itemid']}, score #{recommendation['score']}\n" }
require 'sugestio' client = Sugestio.new('sandbox', 'demo') consumption = {:userid=>'A', :itemid=>'X', :type=>'VIEW'} client.add_consumption(consumption)
require 'sugestio' client = Sugestio.new('sandbox', 'demo') item = {:id=>123, :title=>"Product 123", :"category"=>['A', 'B']} client.add_item(item)
require 'sugestio' client = Sugestio.new('sandbox', 'demo') item1 = {:id=>1, :title=>"Product 1", :"category"=>['A', 'B']} item2 = {:id=>2, :title=>"Product 2", :"category"=>['C', 'D']} client.add_item([item1, item2])