Class: Vonage::Subaccounts
- Inherits:
-
Namespace
- Object
- Namespace
- Vonage::Subaccounts
- Defined in:
- lib/vonage/subaccounts.rb
Defined Under Namespace
Classes: ListResponse
Instance Method Summary collapse
-
#create(name:, **params) ⇒ Object
Create a subaccount.
-
#find(subaccount_key:) ⇒ Object
Retrieve a subaccount.
-
#list ⇒ Object
Retrieve list of subaccounts.
-
#list_balance_transfers(start_date: "1970-01-01T00:00:00Z", **params) ⇒ Object
Retrieve list of balance transfers.
-
#list_credit_transfers(start_date: "1970-01-01T00:00:00Z", **params) ⇒ Object
Retrieve list of credit transfers.
-
#transfer_balance(from:, to:, amount:, **params) ⇒ Object
Transfer balance.
-
#transfer_credit(from:, to:, amount:, **params) ⇒ Object
Transfer credit.
-
#transfer_number(from:, to:, number:, country:) ⇒ Object
Transfer number.
-
#update(subaccount_key:, **params) ⇒ Object
Modify a subaccount.
Instance Method Details
#create(name:, **params) ⇒ Object
Create a subaccount.
58 59 60 |
# File 'lib/vonage/subaccounts.rb', line 58 def create(name:, **params) request("/accounts/#{@config.api_key}/subaccounts", params: params.merge(name: name), type: Post) end |
#find(subaccount_key:) ⇒ Object
Retrieve a subaccount.
31 32 33 |
# File 'lib/vonage/subaccounts.rb', line 31 def find(subaccount_key:) request("/accounts/#{@config.api_key}/subaccounts/#{subaccount_key}") end |
#list ⇒ Object
Retrieve list of subaccounts.
17 18 19 |
# File 'lib/vonage/subaccounts.rb', line 17 def list request("/accounts/#{@config.api_key}/subaccounts", response_class: ListResponse) end |
#list_balance_transfers(start_date: "1970-01-01T00:00:00Z", **params) ⇒ Object
Retrieve list of balance transfers.
151 152 153 154 155 |
# File 'lib/vonage/subaccounts.rb', line 151 def list_balance_transfers(start_date: "1970-01-01T00:00:00Z", **params) path = "/accounts/#{@config.api_key}/balance-transfers?#{Params.encode(params.merge(start_date: start_date))}" request(path, response_class: BalanceTransfers::ListResponse) end |
#list_credit_transfers(start_date: "1970-01-01T00:00:00Z", **params) ⇒ Object
Retrieve list of credit transfers.
104 105 106 107 108 |
# File 'lib/vonage/subaccounts.rb', line 104 def list_credit_transfers(start_date: "1970-01-01T00:00:00Z", **params) path = "/accounts/#{@config.api_key}/credit-transfers?#{Params.encode(params.merge(start_date: start_date))}" request(path, response_class: CreditTransfers::ListResponse) end |
#transfer_balance(from:, to:, amount:, **params) ⇒ Object
Transfer balance.
176 177 178 |
# File 'lib/vonage/subaccounts.rb', line 176 def transfer_balance(from:, to:, amount:, **params) request("/accounts/#{@config.api_key}/balance-transfers", params: params.merge(from: from, to: to, amount: amount), type: Post) end |
#transfer_credit(from:, to:, amount:, **params) ⇒ Object
Transfer credit.
129 130 131 |
# File 'lib/vonage/subaccounts.rb', line 129 def transfer_credit(from:, to:, amount:, **params) request("/accounts/#{@config.api_key}/credit-transfers", params: params.merge(from: from, to: to, amount: amount), type: Post) end |
#transfer_number(from:, to:, number:, country:) ⇒ Object
Transfer number.
199 200 201 |
# File 'lib/vonage/subaccounts.rb', line 199 def transfer_number(from:, to:, number:, country:) request("/accounts/#{@config.api_key}/transfer-number", params: {from: from, to: to, number: number, country: country}, type: Post) end |
#update(subaccount_key:, **params) ⇒ Object
Modify a subaccount.
82 83 84 |
# File 'lib/vonage/subaccounts.rb', line 82 def update(subaccount_key:, **params) request("/accounts/#{@config.api_key}/subaccounts/#{subaccount_key}", params: params, type: Patch) end |