A CashStar Ruby Gem
A Ruby wrapper for the CashStar REST API
gem install cashstar
please consult your CashStar API documentation for full use cases and support
as of v0.1.2, this gems supports json only and only one gift card is supported per order.
require "cashstar" # Configure your CashStar settings - for Rails, typically in /config/initializers/cashstar.rb # Optionally, store your credentials for each environment in a cashstar.yml file and load from there. . do |config| config.username = 'username' config.password = 'password' config.endpoint = 'production or semi-production url' config.format = 'json' #or 'xml' end # Gift Card numbers are not returned by default - only urls to the hosted Gift Card and the associated challenge phrase # If you need the gift card number and pin, include the following in your config block: config.return_card_numbers = true # Get all merchants enabled for this account puts .merchants # Get all faceplates for a merchant puts .faceplates(:merchant_code) # Build an Order Entity # An order is composed of one or many gift card entities, which are in turn composed of delivery and message entities delivery = ::::.(:delivered_by => :CLIENT) = ::::.(:body => 'Thanks for all the hard work!', :from => 'Santa Claus', :to => 'Rudolph') gift_card = ::::.(:merchant_code => 'GAP', :initial_balance => '100.00', :delivery => delivery, :message => ) order = ::::.(:audit_number => '123456', :gift_card => gift_card) #Audit Number is required # Issue the built order puts .issue(order)