Skip to content

grabr/treasury_prime-ruby

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Treasury Prime

Ruby bindings of Treasury Prime API

Installation

Add this line to your application's Gemfile:

gem 'treasury_prime', github: "grabr/treasury_prime-ruby"

And then execute:

$ bundle

Usage

Class method APIs

At first, set TreasuryPrime.api_key or TreasuryPrime.access_token.

TreasuryPrime.username = "XXX"
TreasuryPrime.token = "XXX"
TreasuryPrime.api_base = "XXX"

Instance method APIs

client = TreasuryPrime.client
#or
client = TreasuryPrime::Client.new(username: "XXX", token: "XXX")

Then call instance methods.

e.g. create card.

client.create_card(account_id: "acc_123", person_id: "per_123", card_product_id: "cprd_123")

All available APIs are followings.

Tips

Dry::Struct

All successful API methods returns Dry::Struct instance wrapped in Success monad.

https://github.com/dry-rb/dry-struct https://github.com/dry-rb/dry-monads

All unsuccessful API Methods return one of the error instances wrapped in Failure monad.

Block arguments

All API methods supports block argument.

If block was given, return response body and response header through block arguments.

client.create_account_application(person_application_id: "123", product: :personal_savings) do |body, header|
  body

  header["X-RateLimit-Limit"]
  #=> "100"
end

Play around

cp .env.example .env
vi .env

./bin/console

About

Ruby bindings for the Treasury Prime API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published