This is the unofficial CoinJar Ruby gem which combines all of the outstanding PRs and then some, and is now the best way to interact with the CoinJar API in your Ruby applications.
This gem is not currently released on RubyGems.
For information on using the CoinJar API directly, see the documentation.
Add this line to your application's Gemfile:
gem 'coinjar'
And then execute:
$ bundle
Or install it yourself as:
$ gem install coinjar
First you need to configure the api_key, which is the CoinJar authentication token. You can obtain it from CoinJar Account Settings > API Access.
require 'coinjar'
CoinJar.api_key = "pJ451Sk8tXz9LdUbGg1sobLUZuVzuJwdyr4sD3owFW4WYHxo"
Optionally you can also set the endpoint class variable, if you need to change the endpoint (for example, to use the Sandbox environment):
CoinJar.endpoint = "https://secure.sandbox.coinjar.io/api/v1"
New payment
p = CoinJar::Payment.new(payee: "mx8Dv1SmdoahsFxv1FrtgygMh6SkvzHG3o", amount: 0.5)
p.create
# => #<CoinJar::Payment:0x007fba13b9d1e0 @payee="mx8Dv1SmdoahsFxv1FrtgygMh6SkvzHG3o", @amount="0.5", @uuid="d1fd373b-f116-4c30-9ba6-4c38ede1dbe1", @payee_name="mx8Dv1SmdoahsFxv1FrtgygMh6SkvzHG3o", @payee_type="ADDRESS", @status="PENDING", @created_at="2013-06-25T21:17:05.517+10:00", @updated_at="2013-06-25T21:17:05.517+10:00">
Confirm the payment
p.confirm!
Find a payment by uuid
payment = CoinJar::Payment.find('d1fd373b-f116-4c30-9ba6-4c38ede1dbe1')
account = CoinJar::Account.find
address = CoinJar::Address.generate('Label')
BTC, USD, AUD, NZD, CAD, EUR, GBP, SGD, HKD, CHF and JPY are all currently supported
fair_rate = CoinJar::FairRate.new('AUD')
transactions = CoinJar::Transaction.list
This will return an array of CoinJar::Transaction objects
transaction = CoinJar::Transaction.find('a350ff8e-725d-4000-a45e-8ca4c1ff329a')
- Document and test pagination
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request