Class: NOWPayments::Client

Inherits:
Object
  • Object
show all
Includes:
API::Authentication, API::Conversions, API::Currencies, API::Custody, API::Estimation, API::FiatPayouts, API::Invoices, API::Payments, API::Payouts, API::Status, API::Subscriptions
Defined in:
lib/nowpayments/client.rb

Overview

Main client for interacting with the NOWPayments API

Constant Summary collapse

BASE_URL =
"https://api.nowpayments.io/v1"
SANDBOX_URL =
"https://api-sandbox.nowpayments.io/v1"

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from API::FiatPayouts

#create_fiat_payout, #create_fiat_payout_account, #fiat_payout_accounts, #fiat_payout_payment_methods, #fiat_payout_rates, #fiat_payout_status, #fiat_payouts, #update_fiat_payout_account

Methods included from API::Custody

#create_sub_account, #create_sub_account_deposit, #create_sub_account_payment_deposit, #list_sub_accounts, #sub_account_balance, #sub_account_balances, #sub_account_transfer, #sub_account_transfers, #transfer_between_sub_accounts, #transfer_to_sub_account, #withdraw_from_sub_account

Methods included from API::Conversions

#conversion_status, #create_conversion, #list_conversions

Methods included from API::Subscriptions

#create_subscription, #create_subscription_plan, #delete_recurring_payment, #list_recurring_payments, #recurring_payment, #subscription_payments, #subscription_plan, #subscription_plans, #update_subscription_plan

Methods included from API::Payouts

#balance, #create_payout, #list_payouts, #min_payout_amount, #payout_fee, #payout_status, #validate_payout_address, #verify_payout

Methods included from API::Invoices

#create_invoice, #create_invoice_payment, #invoice

Methods included from API::Payments

#create_payment, #payment, #payments, #update_payment_estimate

Methods included from API::Estimation

#estimate, #min_amount

Methods included from API::Currencies

#currencies, #full_currencies, #merchant_coins

Methods included from API::Authentication

#authenticate, #clear_jwt_token, #jwt_expired?, #jwt_time_remaining

Methods included from API::Status

#status

Constructor Details

#initialize(api_key:, ipn_secret: nil, sandbox: false) ⇒ Client

Returns a new instance of Client.



38
39
40
41
42
43
44
# File 'lib/nowpayments/client.rb', line 38

def initialize(api_key:, ipn_secret: nil, sandbox: false)
  @api_key = api_key
  @ipn_secret = ipn_secret
  @sandbox = sandbox
  @jwt_token = nil
  @jwt_expires_at = nil
end

Instance Attribute Details

#api_keyObject (readonly)

Returns the value of attribute api_key.



32
33
34
# File 'lib/nowpayments/client.rb', line 32

def api_key
  @api_key
end

#ipn_secretObject (readonly)

Returns the value of attribute ipn_secret.



32
33
34
# File 'lib/nowpayments/client.rb', line 32

def ipn_secret
  @ipn_secret
end

#jwt_expires_atObject

Returns the value of attribute jwt_expires_at.



33
34
35
# File 'lib/nowpayments/client.rb', line 33

def jwt_expires_at
  @jwt_expires_at
end

#jwt_tokenObject

Returns the value of attribute jwt_token.



33
34
35
# File 'lib/nowpayments/client.rb', line 33

def jwt_token
  @jwt_token
end

#sandboxObject (readonly)

Returns the value of attribute sandbox.



32
33
34
# File 'lib/nowpayments/client.rb', line 32

def sandbox
  @sandbox
end

Instance Method Details

#base_urlObject



46
47
48
# File 'lib/nowpayments/client.rb', line 46

def base_url
  sandbox ? SANDBOX_URL : BASE_URL
end