No description or website provided.
Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
examples
lib
.gitignore
Gemfile
README.md
Rakefile
xfers.gemspec

README.md

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

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

Documentation

Please see http://docs.xfers.io/ for up-to-date documentation.