Snipsnap API wrapper
Add this line to your application's Gemfile:
gem 'snipsnap-client', github: 'snipsnap/snipsnap-client'
And then execute:
$ bundle
Or install it yourself as:
$ gem install snipsnap-client
The default configuration will look for values set via environment variables
SNIPSNAP_PROTOCOL
-http
orhttps
. Defaults tohttps
SNIPSNAP_HOST
- The hostname to connect to. Defaults toapi.snipsnap.it
SNIPSNAP_VERSION
- The API version to use. Defaults to2
If you don't want to use environment variables, you can manually configure via
the configure
method (e.g. in a Rails initializer)
# config/initializers/snipsnap.rb
Snipsnap.configure do |config|
config.protocol = 'https'
config.host = 'api.snipsnap.it'
config.version = 2
end
Then, get an instance
client = Snipsnap.connect
To access the users
resource
users = client.users
To do a lookup,
# lookup account information for a user by ID
users.lookup(id: 1234) # => {
# "user_id":1234,
# "email_hash":"50M3_H45H",
# "facebook_username":"facebook_1234",
# "twitter_username":"twitter_1234",
# "facebook_email_hash":"50M3_H45H"
# }
# lookup account information for a user by email hash
users.lookup(hash: "50M3_H45H") # => {
# "user_id":1234,
# "email_hash":"50M3_H45H",
# "facebook_username":"facebook_1234",
# "twitter_username":"twitter_1234",
# "facebook_email_hash":"50M3_H45H"
# }
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request