https://github.com/hunterae/cashstar-ruby
https://github.com/hunterae/cashstar-ruby
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/hunterae/cashstar-ruby
- Owner: hunterae
- Created: 2014-02-04T03:23:07.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2021-10-01T18:21:22.000Z (over 3 years ago)
- Last Synced: 2025-03-27T14:52:29.796Z (about 2 months ago)
- Language: Ruby
- Size: 20.5 KB
- Stars: 1
- Watchers: 2
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# A CashStar Ruby Gem
A Ruby wrapper for the CashStar REST APINote: This gem is a copy of the gem found here: https://github.com/crowdtap/cashstar. I created a copy of that gem because the cashstar team was not responding to my request to put their gem on Rubygems.
## Installation
gem install cashstar## Full Documentation
please consult your CashStar API documentation for full use cases and support## Current Limitations
as of v0.1.2, this gems supports json only and only one gift card is supported per order.## Usage Examples
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.
Cashstar.configure 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 Cashstar.merchants# Get all faceplates for a merchant
puts Cashstar.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 = Cashstar::Client::Delivery.new(:delivered_by => :CLIENT)
message = Cashstar::Client::Message.new(:body => 'Thanks for all the hard work!', :from => 'Santa Claus', :to => 'Rudolph')
gift_card = Cashstar::Client::GiftCard.new(:merchant_code => 'GAP', :initial_balance => '100.00', :delivery => delivery, :message => message)
order = Cashstar::Client::Order.new(:audit_number => '123456', :gift_card => gift_card) #Audit Number is required# Issue the built order
puts Cashstar.issue(order)