Ruby bindings of Treasury Prime API
Add this line to your application's Gemfile:
gem 'treasury_prime', github: "grabr/treasury_prime-ruby"
And then execute:
$ bundle
At first, set TreasuryPrime.api_key
or TreasuryPrime.access_token
.
TreasuryPrime.username = "XXX"
TreasuryPrime.token = "XXX"
TreasuryPrime.api_base = "XXX"
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.
- TreasuryPrime::Account
- TreasuryPrime::Person
- TreasuryPrime::Card
- TreasuryPrime::CardProduct
- TreasuryPrime::AccountApplication
- TreasuryPrime::PersonApplication
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.
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
cp .env.example .env
vi .env
./bin/console