Class: Kortana::Modules::Banking

Inherits:
Object
  • Object
show all
Defined in:
lib/kortana/modules/banking.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Banking

Returns a new instance of Banking.



4
5
6
# File 'lib/kortana/modules/banking.rb', line 4

def initialize(client)
  @client = client
end

Instance Method Details

#create_bank_account(customer_id:, bank_name:, account_number:, routing_number:, account_type: "checking") ⇒ Object



29
30
31
32
33
34
35
36
37
# File 'lib/kortana/modules/banking.rb', line 29

def (customer_id:, bank_name:, account_number:, routing_number:, account_type: "checking")
  @client.post("/banking/accounts", {
    customerId: customer_id,
    bankName: bank_name,
    accountNumber: ,
    routingNumber: routing_number,
    accountType: 
  })
end

#create_customer(name:, email:, phone: nil, address: nil) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/kortana/modules/banking.rb', line 8

def create_customer(name:, email:, phone: nil, address: nil)
  @client.post("/banking/customers", {
    name: name,
    email: email,
    phone: phone,
    address: address
  })
end

#create_transfer(from_address:, to_address:, amount:, currency: "USD") ⇒ Object



47
48
49
50
51
52
53
54
# File 'lib/kortana/modules/banking.rb', line 47

def create_transfer(from_address:, to_address:, amount:, currency: "USD")
  @client.post("/banking/transfers", {
    fromAddress: from_address,
    toAddress: to_address,
    amount: amount.to_s,
    currency: currency
  })
end

#get_bank_account(id) ⇒ Object



39
40
41
# File 'lib/kortana/modules/banking.rb', line 39

def (id)
  @client.get("/banking/accounts/#{id}")
end

#get_customer(id) ⇒ Object



17
18
19
# File 'lib/kortana/modules/banking.rb', line 17

def get_customer(id)
  @client.get("/banking/customers/#{id}")
end

#get_transfer(id) ⇒ Object



56
57
58
# File 'lib/kortana/modules/banking.rb', line 56

def get_transfer(id)
  @client.get("/banking/transfers/#{id}")
end

#list_bank_accounts(customer_id) ⇒ Object



43
44
45
# File 'lib/kortana/modules/banking.rb', line 43

def list_bank_accounts(customer_id)
  @client.get("/banking/accounts", { customerId: customer_id })
end

#list_customers(options = {}) ⇒ Object



25
26
27
# File 'lib/kortana/modules/banking.rb', line 25

def list_customers(options = {})
  @client.get("/banking/customers", options)
end

#update_customer(id, params) ⇒ Object



21
22
23
# File 'lib/kortana/modules/banking.rb', line 21

def update_customer(id, params)
  @client.put("/banking/customers/#{id}", params)
end