Ruby wrapper for the WishSimple API
WishSimple provides gift recommendations as a service. It's currently in private beta and you can request an API key here.
gem install wishsimple
If you're using Rails, you may want to add the following to
. do |config| config.api_key = '<your API key>' end
You can also set the key directly:
.api_key = '<your API key>'
WishSimple uses a Facebook user's interactions with products to generate gift recommendations. Currently, only purchases are supported, though more types of interactions will be supported in the near future (e.g. ratings, adding to a wish list, etc.).
To begin, you'll need the following data:
facebook_uid- The Facebook user's numerical UID
access_token- The Facebook user's OAuth access token (see "Permissions" below)
product_uid- Whatever you use to identify the product; usually the database ID
Recording a purchase is as easy as:
user = ::.(facebook_uid, access_token) product = ::.(product_uid) user.purchase!(product)
You can interact with objects as you would expect:
user = ::.(facebook_uid) user.access_token = access_token user.save purchase = ::. purchase.user = user purchase.product = product purchase.save
You can delete data like so:
# Purchases purchase = ::.(user: user, product: product) purchase.destroy # Users (this will also delete the user's purchases) user = ::.(facebook_uid) user.destroy # Products (this will also delete the product's purchases) product = ::.(product_uid) product.destroy
You'll want to request the following Facebook permissions when generating the access token:
Here's a funny riddle:
Q: What kind of gift recommendation service doesn't actually have the
ability to request the gift recommendations?
A: One that's in private beta.
Okay, that was terrible, but jokes aside, we're working hard to make the gift recommendations awesome. You can expect them soon.
Copyright (c) 2012 Shaun Chapman and WishSimple, Inc. See LICENSE for details.