Skip to content

link108/giftrocket-ruby

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GiftRocket Gift Card Ruby API

Installation

$ gem install 'giftrocket_ruby'

or, add to your Gemfile

source 'https://rubygems.org'
gem 'giftrocket_ruby'

Usage

require 'giftrocket'

# Configure with your sandbox / production token.
Giftrocket.configure do |config|
  config[:access_token] = 'YOUR_ACCESS_TOKEN_HERE'
  config[:base_api_uri] = 'https://testflight.giftrocket.com/api/v1/'
end

funding_sources = Giftrocket::FundingSource.list
styles = Giftrocket::Style.list
orders = Giftrocket::Order.list # blank at first.
gifts = Giftrocket::Gift.list # blank at first.

#
# Generate an order.
#

# The funding source you select is how you are charged for the order.
funding_source_id = funding_sources.first.id

# Optionally pass a unique external_id for each order create call
# to guarantee that your order is idempotent and not executed multiple times.
external_id = "MY_UUID_FOR_THIS_ORDER"

# An array data representing the gifts you'd like to send.
gifts = [
  {
    "amount": 30,
    "message": "Thanks for your help this year!",
    "style_id": styles.first.id,
    "recipient": {
      "email": "jake@giftrocket.com",
      "name": "Jake Douglas"
    },
    "sender": {
      "name": "Kapil Kale"
    }
  }
]

# Submit the order to GiftRocket.
order = Giftrocket::Order.create!(funding_source_id, gifts, external_id)

# Retrieve the order and gift.
Giftrocket::Order.retrieve(order.id)
Giftrocket::Gift.retrieve(order.gifts.first.id)

Contributing

The gem is maintained by GiftRocket engineers, but all are welcome to contribute. Feel free to open an issue, submit a PR, or post a question.

About

Official GiftRocket Gift Card Ruby API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages