Class: BitPayClient
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- BitPayClient
- Defined in:
- app/models/bit_pay_client.rb
Instance Method Summary collapse
- #cancel_refund(params = {}) ⇒ Object
- #create_invoice(params = {}) ⇒ Object
- #get_all_refunds_for_invoice(params = {}) ⇒ Object
- #get_invoice(params = {}) ⇒ Object
- #get_pairing_code(params = {}) ⇒ Object
- #get_refund(params = {}) ⇒ Object
- #get_tokens ⇒ Object
- #refund_invoice(params = {}) ⇒ Object
Instance Method Details
#cancel_refund(params = {}) ⇒ Object
36 37 38 |
# File 'app/models/bit_pay_client.rb', line 36 def cancel_refund(params = {}) get_or_cancel_refund(:cancel_refund, params) end |
#create_invoice(params = {}) ⇒ Object
13 14 15 16 |
# File 'app/models/bit_pay_client.rb', line 13 def create_invoice(params = {}) price, currency = params.delete(:price), params.delete(:currency) tell_client(:create_invoice, price: price, currency: currency, facade: self.facade, params: params) end |
#get_all_refunds_for_invoice(params = {}) ⇒ Object
27 28 29 30 |
# File 'app/models/bit_pay_client.rb', line 27 def get_all_refunds_for_invoice(params = {}) id = params[:id] tell_client(:get_all_refunds_for_invoice, id: id) end |
#get_invoice(params = {}) ⇒ Object
18 19 20 |
# File 'app/models/bit_pay_client.rb', line 18 def get_invoice(params = {}) tell_client(:get_invoice, params) end |
#get_pairing_code(params = {}) ⇒ Object
7 8 9 10 11 |
# File 'app/models/bit_pay_client.rb', line 7 def get_pairing_code(params = {}) params[:facade] = self.facade bp_token = tell_client(:pair_client, params) bp_token[0]['pairingCode'] end |
#get_refund(params = {}) ⇒ Object
32 33 34 |
# File 'app/models/bit_pay_client.rb', line 32 def get_refund(params = {}) get_or_cancel_refund(:get_refund, params) end |
#get_tokens ⇒ Object
40 41 42 |
# File 'app/models/bit_pay_client.rb', line 40 def get_tokens tell_client(:get, path: "tokens")['data'] end |
#refund_invoice(params = {}) ⇒ Object
22 23 24 25 |
# File 'app/models/bit_pay_client.rb', line 22 def refund_invoice(params = {}) invoice_id = params.delete(:id) tell_client(:refund_invoice, id: invoice_id, params: params) end |