Xfers Ruby Bindings
You can sign up for a Xfers account at https://xfers.com.
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
- Ruby 2.0.0 or above.
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'
Set the Xfers API key, the endpoint you are using and you are good to go!
These settings can either be placed in
config/initializers/xfers.rb or right before the API call as shown below.
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
Please see http://docs.xfers.io/ for up-to-date documentation.