Class: Remitano::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/remitano/client.rb

Defined Under Namespace

Modules: Helper Classes: ActionConfirmations, CoinAccounts, CoinCollection, CoinWithdrawals, Collection, FiatAccounts, FiatCollection, MerchantCharges, MerchantWithdrawals, Net, Offers, Orders, PriceLadders, PublicOffers, Rates, Request, Trades

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key:, secret:, authenticator_secret: nil, verbose: false) ⇒ Client

Returns a new instance of Client.



24
25
26
27
28
29
# File 'lib/remitano/client.rb', line 24

def initialize(key:, secret:, authenticator_secret: nil, verbose: false)
  self.key = key
  self.secret = secret
  self.authenticator_secret = authenticator_secret
  self.verbose = verbose
end

Class Attribute Details

.default_authenticator_secretObject

Returns the value of attribute default_authenticator_secret.



16
17
18
# File 'lib/remitano/client.rb', line 16

def default_authenticator_secret
  @default_authenticator_secret
end

.default_keyObject

Returns the value of attribute default_key.



16
17
18
# File 'lib/remitano/client.rb', line 16

def default_key
  @default_key
end

.default_secretObject

Returns the value of attribute default_secret.



16
17
18
# File 'lib/remitano/client.rb', line 16

def default_secret
  @default_secret
end

.default_verboseObject

Returns the value of attribute default_verbose.



16
17
18
# File 'lib/remitano/client.rb', line 16

def default_verbose
  @default_verbose
end

Instance Attribute Details

#authenticator_secretObject

Returns the value of attribute authenticator_secret.



22
23
24
# File 'lib/remitano/client.rb', line 22

def authenticator_secret
  @authenticator_secret
end

#keyObject

Returns the value of attribute key.



22
23
24
# File 'lib/remitano/client.rb', line 22

def key
  @key
end

#secretObject

Returns the value of attribute secret.



22
23
24
# File 'lib/remitano/client.rb', line 22

def secret
  @secret
end

#verboseObject

Returns the value of attribute verbose.



22
23
24
# File 'lib/remitano/client.rb', line 22

def verbose
  @verbose
end

Class Method Details

.defaultObject



17
18
19
# File 'lib/remitano/client.rb', line 17

def default
  @default ||= new(key: default_key, secret: default_secret, authenticator_secret: default_authenticator_secret, verbose: default_verbose)
end

Instance Method Details

#action_confirmationsObject



43
44
45
# File 'lib/remitano/client.rb', line 43

def action_confirmations
  @action_confirmations ||= ActionConfirmations.new(config: self)
end

#authenticator_tokenObject



31
32
33
# File 'lib/remitano/client.rb', line 31

def authenticator_token
  ROTP::TOTP.new(authenticator_secret).now
end

#coin_accounts(coin) ⇒ Object



47
48
49
50
# File 'lib/remitano/client.rb', line 47

def coin_accounts(coin)
  @coin_accounts ||= {}
  @coin_accounts[coin] ||= CoinAccounts.new(coin, config: self)
end

#coin_withdrawals(coin) ⇒ Object



67
68
69
# File 'lib/remitano/client.rb', line 67

def coin_withdrawals(coin)
  @coin_withdrawals ||= CoinWithdrawals.new(coin, config: self)
end

#fiat_accounts(currency) ⇒ Object



52
53
54
55
# File 'lib/remitano/client.rb', line 52

def fiat_accounts(currency)
  @fiat_accounts ||= {}
  @fiat_accounts[currency] ||= FiatAccounts.new(currency, config: self)
end

#hotp(otp_counter) ⇒ Object



35
36
37
# File 'lib/remitano/client.rb', line 35

def hotp(otp_counter)
  ROTP::HOTP.new(authenticator_secret).at(otp_counter)
end

#merchant_chargesObject



88
89
90
# File 'lib/remitano/client.rb', line 88

def merchant_charges
  @merchant_charges ||= MerchantCharges.new(config: self)
end

#merchant_withdrawalsObject



92
93
94
# File 'lib/remitano/client.rb', line 92

def merchant_withdrawals
  @merchant_withdrawals ||= MerchantWithdrawals.new(config: self)
end

#netObject



39
40
41
# File 'lib/remitano/client.rb', line 39

def net
  @net ||= Remitano::Client::Net.new(config: self)
end

#offers(coin) ⇒ Object



57
58
59
60
# File 'lib/remitano/client.rb', line 57

def offers(coin)
  @offers ||= {}
  @offers[coin] ||= Offers.new(coin, config: self)
end

#ordersObject



71
72
73
# File 'lib/remitano/client.rb', line 71

def orders
  @orders ||= Orders.new(config: self)
end

#price_laddersObject



84
85
86
# File 'lib/remitano/client.rb', line 84

def price_ladders
  @price_ladders ||= PriceLadders.new
end

#public_offers(coin) ⇒ Object



79
80
81
82
# File 'lib/remitano/client.rb', line 79

def public_offers(coin)
  @public_offers ||= {}
  @public_offers[coin] ||= PublicOffers.new(coin)
end

#ratesObject



75
76
77
# File 'lib/remitano/client.rb', line 75

def rates
  @rates ||= Rates.new
end

#trades(coin) ⇒ Object



62
63
64
65
# File 'lib/remitano/client.rb', line 62

def trades(coin)
  @trades ||= {}
  @trades[coin] ||= Trades.new(coin, config: self)
end