LYBC client

Build Status

This is a client for The Body Shop Greece LYBC API. It is written in Ruby and has very few dependencies.

Installation

Add this line to your application's Gemfile:

gem 'LYBC', :git => '[email protected]:artime-advertising/LYBC-ruby.git'

And then execute:

$ bundle

Usage

This libary tries to resemble CIP's js (in-browser) client.

Construct the client via:

lybc_client = LYBC::Client.new("session_id")

Then make calls:

> lybc_client.registerSession
 => {"action"=>"registerSession", "message"=>"Session expired", "sessionID"=>"session_id", "status"=>1}

Available methods:

> lybc_client.registerSession('session_id')
> lybc_client.getAssociation()
> lybc_client.getSelectedCoupons()   
> lybc_client.cashSelectedCoupons()   

All methods have a bang-ending alternative, ie lybc_client.getAssociation! which throws an error in case an error status returns.

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/artime-advertising/LYBC-ruby.