Class: Monobank::Client

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(token: nil) ⇒ Client

Returns a new instance of Client.



12
13
14
# File 'lib/monobank/client.rb', line 12

def initialize(token: nil)
  @token = token
end

Instance Attribute Details

#tokenObject (readonly)

Returns the value of attribute token.



10
11
12
# File 'lib/monobank/client.rb', line 10

def token
  @token
end

Instance Method Details

#bank_currencyObject



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

def bank_currency
  Bank::Currency.new.call
end

#client_info(token: nil) ⇒ Object



20
21
22
# File 'lib/monobank/client.rb', line 20

def client_info(token: nil)
  Personal::ClientInfo.new(auth: auth(token: token || @token)).call
end

#set_webhook(url:, token: nil) ⇒ Object



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

def set_webhook(url:, token: nil)
  Personal::Webhook.new(url: url, auth: auth(token: token || @token)).call
end

#statement(account_id:, from:, to: nil, token: nil) ⇒ Object



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

def statement(account_id:, from:, to: nil, token: nil)
  Personal::Statement.new(
    account_id: ,
    from: from,
    to: to,
    auth: auth(token: token || @token)
  ).call
end