Class: Billrb::CustomerBankAccount
- Defined in:
- lib/billrb/resources/customer_bank_account.rb
Overview
Bank account on file for a customer, required for charging them. Nested under a customer, so every operation takes the customer id first.
Instance Attribute Summary
Attributes inherited from Resource
Class Method Summary collapse
-
.archive(customer_id, id, options = {}) ⇒ Object
Archived customer bank accounts cannot be restored.
- .create(customer_id, params, options = {}) ⇒ Object
- .list(customer_id, params = {}, options = {}) ⇒ Object
- .resource_path(customer_id) ⇒ Object
- .retrieve(customer_id, id, options = {}) ⇒ Object
-
.update(customer_id, id, params, options = {}) ⇒ Object
Only ‘nickname` and `ownerType` can change; for anything else, create a new bank account.
Methods inherited from Resource
#[], #id, #initialize, #inspect, #method_missing, #respond_to_missing?, #to_h
Constructor Details
This class inherits a constructor from Billrb::Resource
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Billrb::Resource
Class Method Details
.archive(customer_id, id, options = {}) ⇒ Object
Archived customer bank accounts cannot be restored.
34 35 36 |
# File 'lib/billrb/resources/customer_bank_account.rb', line 34 def self.archive(customer_id, id, = {}) new(Operations.client_from().post("#{resource_path(customer_id)}/#{id}/archive")) end |
.create(customer_id, params, options = {}) ⇒ Object
21 22 23 24 |
# File 'lib/billrb/resources/customer_bank_account.rb', line 21 def self.create(customer_id, params, = {}) new(Operations.client_from().post(resource_path(customer_id), Util.camelize_keys(params))) end |
.list(customer_id, params = {}, options = {}) ⇒ Object
11 12 13 14 15 |
# File 'lib/billrb/resources/customer_bank_account.rb', line 11 def self.list(customer_id, params = {}, = {}) client = Operations.client_from() data = client.get(resource_path(customer_id), Util.camelize_keys(params)) ListPage.new(self, data, params: params, client: client, list_args: [customer_id]) end |
.resource_path(customer_id) ⇒ Object
7 8 9 |
# File 'lib/billrb/resources/customer_bank_account.rb', line 7 def self.resource_path(customer_id) "/customers/#{customer_id}/bank-accounts" end |
.retrieve(customer_id, id, options = {}) ⇒ Object
17 18 19 |
# File 'lib/billrb/resources/customer_bank_account.rb', line 17 def self.retrieve(customer_id, id, = {}) new(Operations.client_from().get("#{resource_path(customer_id)}/#{id}")) end |
.update(customer_id, id, params, options = {}) ⇒ Object
Only ‘nickname` and `ownerType` can change; for anything else, create a new bank account.
28 29 30 31 |
# File 'lib/billrb/resources/customer_bank_account.rb', line 28 def self.update(customer_id, id, params, = {}) new(Operations.client_from().patch("#{resource_path(customer_id)}/#{id}", Util.camelize_keys(params))) end |