class Bitcoinpay::Client
Public Class Methods
new(api_key)
click to toggle source
# File lib/bitcoinpay/client.rb, line 8 def initialize(api_key) @api_key = api_key end
Public Instance Methods
create_new_payment_request(values = {})
click to toggle source
# File lib/bitcoinpay/client.rb, line 19 def create_new_payment_request(values = {}) params = { body: values.to_json, headers: headers } self.class.post('/payment/btc', params).parsed_response end
get_payment(payment_id: nil)
click to toggle source
# File lib/bitcoinpay/client.rb, line 24 def get_payment(payment_id: nil) self.class.get("/payment/btc/#{ payment_id }", { headers: headers }).parsed_response end
get_rate(currency = 'USD')
click to toggle source
Returns explicit rate for given currency
@example
Bitcoinpay::Client.new('api_key').get_rate('USD') => 663.17
# File lib/bitcoinpay/client.rb, line 38 def get_rate(currency = 'USD') get_rates.reduce({}){ |h, v| h.merge v }[currency].to_f end
get_rates()
click to toggle source
# File lib/bitcoinpay/client.rb, line 28 def get_rates self.class.get('/rates/btc').parsed_response end
get_settlement(options = {})
click to toggle source
# File lib/bitcoinpay/client.rb, line 54 def get_settlement(options = {}) raise NotImplemented end
get_settlement_history(options = {})
click to toggle source
# File lib/bitcoinpay/client.rb, line 50 def get_settlement_history(options = {}) raise NotImplemented end
get_transaction_detail(options = {})
click to toggle source
# File lib/bitcoinpay/client.rb, line 46 def get_transaction_detail(options = {}) raise NotImplemented end
get_transaction_history(options = {})
click to toggle source
# File lib/bitcoinpay/client.rb, line 42 def get_transaction_history(options = {}) raise NotImplemented end
headers()
click to toggle source
# File lib/bitcoinpay/client.rb, line 12 def headers { 'Content-Type' => 'application/json', 'Authorization' => "Token #{ @api_key }" } end