Project

ofx-rb

0.0
No commit activity in last 3 years
No release in over 3 years
Ruby gem for OFX APIs
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.0
~> 10.0
~> 3.0

Runtime

 Project Readme

OFX

Welcome to OFX ruby gem! The OFX Ruby gem provides a small SDK for convenient access to the OFX APIs from applications written in the Ruby language. It provides a pre-defined set of classes for API resources that initialize themselves dynamically from API responses which allows the bindings to tolerate a number of different versions of the API.

Installation

Add this line to your application's Gemfile:

gem 'ofx-rb'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install ofx-rb

Usage

The library needs to be configured with environment mode "test" or "live"

For live mode
Ofx.mode = "live"

For test mode
Ofx.mode = "test"

Development

Authentication

OFX resource APIs require access token to be sent as Authorization header. You can get the access token as following:

Ofx::Authentication.new("your client_id", "your client_secret").get_access_token

Quotes API

https://payments.developer.ofx.com/specs/quotes/create-quote Create a quote

quote_params = {
    "buyCurrency": "USD",
    "buyAmount": 0,
    "sellCurrency": "INR",
    "sellAmount": 50,
    "beneficiaries": 1
}
Ofx::Quote.create(quote_params, {"access_token" => "api access token"})

Get a already created quote https://payments.developer.ofx.com/specs/quotes/get-quote

Ofx::Quote.get("<existing quote id>", {"access_token" => "api access token"})