Xfers Ruby Bindings
You can sign up for a Xfers account at https://xfers.com.
Installation
You don't need this source code unless you want to modify the gem. If you just want to use the Xfers Ruby bindings, you should run:
gem install xfers
If you want to build the gem from source:
gem build xfers.gemspec
Requirements
- Ruby 2.0.0 or above.
- rest-client
Bundler
If you are installing via bundler, you should be sure to use the https rubygems source in your Gemfile, as any gems fetched over http could potentially be compromised in transit and alter the code of gems fetched securely over https:
source 'https://rubygems.org'
gem 'xfers'
Usage
The library needs to be configured with your account's secret key which is
available in the [Dashboard][dashboard]. Assign its value to Xfers.api_key
and the library will send it along automatically with every request:
require "xfers"
Xfers.set_api_key 'G-zsfAEScrqdU8GhWTEdjfdnb3XRdU8q1fH-nuWfSzo'
Xfers.set_sg_sandbox
# Retrieve user information
begin
resp = Xfers::User.retrieve
puts resp[:first_name]
puts resp[:last_name]
puts resp[:available_balance]
puts resp
rescue Xfers::XfersError => e
puts e.to_s
end
# Creating a charge
begin
Xfers::Charge.create(
:amount => '19.99',
:currency => 'SGD',
:order_id => 'A00834',
:description => 'Carousell user - Konsolidate'
)
rescue Xfers::XfersError => e
puts e.to_s
end
Documentation
Please see http://docs.xfers.io/ for up-to-date documentation.