WishSimple

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.

Installation

gem install wishsimple

Authentication

If you're using Rails, you may want to add the following to config/initializers/wishsimple.rb:

WishSimple.configure do |config|
  config.api_key = '<your API key>'
end

You can also set the key directly:

WishSimple.api_key = '<your API key>'

Usage

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 = WishSimple::User.create(facebook_uid, access_token)
product = WishSimple::Product.create(product_uid)
user.purchase!(product)

You can interact with objects as you would expect:

user = WishSimple::User.new(facebook_uid)
user.access_token = access_token
user.save

purchase = WishSimple::Purchase.new
purchase.user = user
purchase.product = product
purchase.save

You can delete data like so:

# Purchases
purchase = WishSimple::Purchase.new(user: user, product: product)
purchase.destroy

# Users (this will also delete the user's purchases)
user = WishSimple::User.new(facebook_uid)
user.destroy

# Products (this will also delete the product's purchases)
product = WishSimple::Product.new(product_uid)
product.destroy

Permissions

You'll want to request the following Facebook permissions when generating the access token:

user_birthday, user_interests, user_likes

Gift Recommendations

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.