Project

unloq

0.0
No commit activity in last 3 years
No release in over 3 years
Ruby gem for interacting with the Unloq API. See http://www.unloq.co/api_docs/index for more information.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.5
~> 10.3
~> 4.0
~> 3.0
~> 2.9
~> 1.18

Runtime

 Project Readme

unloq

Ruby wrapper for the Unloq API.

Both this library as well as portions of the Unloq API are in active development, please keep this in mind when implementing.

Installation

gem install unloq

Or add it to your Gemfile

gem 'unloq'

Usage

Instantiate an instance of Unloq::Client

This can be used for all requests within the scope of a given api_key and namespace - it should not need to be instantiated each time you make an API call.

client = Unloq::Client.new(api_key: 'your-api-key', namespace: 'foo-dev')

Events

Create an event:

author    = Unloq::Author.new(id: 12, type: 'User')
recipient = Unloq::Recipient.new(id: 13, type: 'User')

client.create_event(author, 'followed', recipient)

Lookup an event:

author    = Unloq::Author.new(id: 12, type: 'User')
recipient = Unloq::Recipient.new(id: 13, type: 'User')

# Note: this method will raise an Unloq::APIError::NotFoundError with 
# a status of 404 if the event is not found

client.lookup_event(author, 'followed', recipient)

Achievements

Create an achievement

# See the documentation for additional keyword arguments

# Creating achievements based only on author and recipient types 
# that are triggered after 2 observations

client.create_achievement('viewed-page', 2, author_type: 'User', recipient_type: 'Post')

# Creating achievements with author and recipient as specific entities 
# that are triggered after 2 observations

author    = Unloq::Author.new(id: 12, type: 'User')
recipient = Unloq::Recipient.new(id: 13, type: 'User')
client.create_achievement('poked', 2, author: author, recipient: recipient)

Scoreboards

Fetch scoreboards for the namespace

client.scoreboards

Ratings

Lookup ratings for an author in the namespace

author = Unloq::Author.new(id: 12, type: 'User')

client.lookup_author_ratings(author)

Documentation

See the documentation