0.0
No commit activity in last 3 years
No release in over 3 years
Full documentation of the API is at http://api.loyaltylab.com/loyaltyapi/help/index.html.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 0.1

Runtime

~> 0.9
~> 0.5
~> 0.9
 Project Readme

Loyalty Lab SDK¶ ↑

A ruby library for accessing the Loyalty Lab API documented here: api.loyaltylab.com/loyaltyapi/help/index.html

This library attempts to be as transparent as possible by making all method calls, parameters, and objects identical to those documented at the above URL. Capitalization goes against typical ruby conventions, and is instead as documented by Loyalty Lab.

NOTE: This software is in no way affiliated with the Loyalty Lab organization.

Synopsis¶ ↑

LoyaltyLabSDK.config(:username => 'foo', :password => 'bar')

api = LoyaltyLabSDK::LoyaltyAPI.new
shopper = api.GetShopper 'shopperId' => 1234
shopper_id = shopper['ShopperId']
point_balance = api.AdjustShopperPoints 'shopperId' => shopper_id,
 'pointChange' => 1000,
 'pointType' => 'Base',
 'description' => 'Surprise bonus'

new_retailer_shopper_id = 1234
new_shopper = api.build_default_shopper(new_retailer_shopper_id)
new_shopper['EmailAddress'] = 'test@gmail.com'
new_shopper['FirstName'] = 'Joe'
new_shopper['LastName'] = 'Schmoe'
new_card = api.build_default_card(new_retailer_shopper_id)
api.CreateShopperWithCard 'shopper' => new_shopper, 'card' => new_card

Authentication¶ ↑

By default, a new LoyaltyAPI instance will authenticate itself against the API (using #authenticate!) and store the authentication token when it is constructed. Authentication may be skipped by setting the :lazy_authentication option to true when calling the constructor. In this case, authentication will occur when the first API call is made (or it may be done explicitly).

According to Loyalty Lab, the authentication token will expire after 20 minutes of inactivity. By default, LoyaltyAPI has an option :allow_reauthenticate that defaults to true (may be overridden). If it’s true, then when you receive an AuthenticationError while making an API call on an already-authenticated LoyaltyAPI instance, it will try once to re-authenticate automatically. This behavior could be overridden by the client by setting :allow_reauthenticate to false and then either ignoring the error, pro-actively calling #authenticate!, or catching AuthenticationError exceptions and re-authenticating then.

Timeouts¶ ↑

By default, all requests will timeout (for opening connections and making requests) after 15 seconds. This may be overridden by setting the :open_timeout and :read_timeout options when calling LoyaltyLabSDK.config.

Environment Variables¶ ↑

For convenience in a command-line environment, configuration of username and password may be skipped by setting the LOYALTY_LAB_SDK_USERNAME and LOYALTY_LAB_SDK_PASSWORD environment variables.

Rails¶ ↑

If running in a rails environment, this configuration will automatically use the global Rails.logger instance. This behavior may be overridden by passing in a :logger option to LoyaltyLabSDK.config.