Class: Kortana::Modules::Merchants
- Inherits:
-
Object
- Object
- Kortana::Modules::Merchants
- Defined in:
- lib/kortana/modules/merchants.rb
Instance Method Summary collapse
- #create(name:, email:, business_name: nil, metadata: nil) ⇒ Object
- #create_api_key(merchant_id, name:, permissions:, expires_at: nil) ⇒ Object
- #create_store(merchant_id, name:, currency: "DNR", settlement_currency: "DNR") ⇒ Object
- #create_terminal(merchant_id, name: nil, store_id: nil, location: nil) ⇒ Object
- #get(id) ⇒ Object
-
#initialize(client) ⇒ Merchants
constructor
A new instance of Merchants.
- #list_api_keys(merchant_id) ⇒ Object
- #list_stores(merchant_id) ⇒ Object
- #list_terminals(merchant_id) ⇒ Object
- #update(id, params) ⇒ Object
Constructor Details
#initialize(client) ⇒ Merchants
Returns a new instance of Merchants.
4 5 6 |
# File 'lib/kortana/modules/merchants.rb', line 4 def initialize(client) @client = client end |
Instance Method Details
#create(name:, email:, business_name: nil, metadata: nil) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/kortana/modules/merchants.rb', line 8 def create(name:, email:, business_name: nil, metadata: nil) @client.post("/merchants", { name: name, email: email, businessName: business_name, metadata: }) end |
#create_api_key(merchant_id, name:, permissions:, expires_at: nil) ⇒ Object
49 50 51 52 53 54 55 |
# File 'lib/kortana/modules/merchants.rb', line 49 def create_api_key(merchant_id, name:, permissions:, expires_at: nil) @client.post("/merchants/#{merchant_id}/api-keys", { name: name, permissions: , expiresAt: expires_at }) end |
#create_store(merchant_id, name:, currency: "DNR", settlement_currency: "DNR") ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/kortana/modules/merchants.rb', line 29 def create_store(merchant_id, name:, currency: "DNR", settlement_currency: "DNR") @client.post("/merchants/#{merchant_id}/stores", { name: name, currency: currency, settlementCurrency: settlement_currency }) end |
#create_terminal(merchant_id, name: nil, store_id: nil, location: nil) ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/kortana/modules/merchants.rb', line 41 def create_terminal(merchant_id, name: nil, store_id: nil, location: nil) @client.post("/merchants/#{merchant_id}/terminals", { name: name, storeId: store_id, location: location }) end |
#get(id) ⇒ Object
17 18 19 |
# File 'lib/kortana/modules/merchants.rb', line 17 def get(id) @client.get("/merchants/#{id}") end |
#list_api_keys(merchant_id) ⇒ Object
57 58 59 |
# File 'lib/kortana/modules/merchants.rb', line 57 def list_api_keys(merchant_id) @client.get("/merchants/#{merchant_id}/api-keys") end |
#list_stores(merchant_id) ⇒ Object
25 26 27 |
# File 'lib/kortana/modules/merchants.rb', line 25 def list_stores(merchant_id) @client.get("/merchants/#{merchant_id}/stores") end |
#list_terminals(merchant_id) ⇒ Object
37 38 39 |
# File 'lib/kortana/modules/merchants.rb', line 37 def list_terminals(merchant_id) @client.get("/merchants/#{merchant_id}/terminals") end |
#update(id, params) ⇒ Object
21 22 23 |
# File 'lib/kortana/modules/merchants.rb', line 21 def update(id, params) @client.put("/merchants/#{id}", params) end |