0.0
No commit activity in last 3 years
No release in over 3 years
Interact with LoyaltyLion from Ruby. See https://loyaltylion.com/docs for more
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Runtime

>= 0.8.1
 Project Readme

LoyaltyLion ruby-client

Use this to interact with the LoyaltyLion API from Ruby

Installation

Add this line to your application's Gemfile:

gem 'loyaltylion'

And then execute:

$ bundle

Or install it yourself as:

$ gem install loyaltylion

Requirements

  • Ruby 1.9.3 or above

Usage

Create a new instance of LoyaltyLion with your LoyaltyLion token and secret, which are available from your dashboard. You can then

require 'loyaltylion'

loyaltylion = LoyaltyLion::Client.new(:token => 'abc', :secret => '123')

Send a new order to LoyaltyLion

loyaltylion.orders.create(
  :merchant_id => '34b8c96a3b',
  :customer_id => '71674',
  :customer_email => 'alice@example.com',
  :total => '59.95',
  :total_shipping => '5.95',
  :payment_status => 'unpaid',
)

The orders.create method accepts a hash containing all supported fields

Update an existing order

LoyaltyLion order updates are idempotent PUT operations. You can push an update to an existing order any time the order changes - our API will determine what changed and perform the appropriate action (e.g. approving points).

The first parameter should be the order's merchant_id, i.e. the id of the order in your system.

loyaltylion.orders.update('34b8c96a3b',
  :payment_status => 'paid',
  :cancellation_status => 'not_cancelled',
  :refund_status => 'not_refunded',
  :total_paid => '59.95',
  :total_refunded => '0',
)

Trigger an activity

loyaltylion.activities.create(
  :name => '$signup',
  :customer_id => '1001',
  :customer_email => 'alice@example.com',
)

Approve/decline an activity

If you've triggered a custom activity with a merchant_id, you can approve or decline the activity at a later date using the activities.approve and activities.decline methods.

These methods both expect the name of the custom activity (e.g. review) and the merchant_id.

loyaltylion.activities.approve('review', '1001')
# or...
loyaltylion.activities.decline('review', '1001')

Changelog

  • v1.0.0 - overhaul client API, bring in-line with v2 LoyaltyLion API