Class: SurgeAPI::Resources::Accounts
- Inherits:
-
Object
- Object
- SurgeAPI::Resources::Accounts
- Defined in:
- lib/surge_api/resources/accounts.rb
Instance Method Summary collapse
-
#archive(id, request_options: {}) ⇒ SurgeAPI::Models::Account
Archives an account and releases all associated resources.
-
#create(name:, brand_name: nil, organization: nil, time_zone: nil, request_options: {}) ⇒ SurgeAPI::Models::Account
Some parameter documentations has been truncated, see Models::AccountCreateParams for more details.
-
#initialize(client:) ⇒ Accounts
constructor
private
A new instance of Accounts.
-
#retrieve_status(account_id, capabilities: nil, request_options: {}) ⇒ SurgeAPI::Models::AccountStatus
Check an account’s status and capabilities.
-
#update(id, brand_name: nil, name: nil, organization: nil, time_zone: nil, request_options: {}) ⇒ SurgeAPI::Models::Account
Some parameter documentations has been truncated, see Models::AccountUpdateParams for more details.
Constructor Details
#initialize(client:) ⇒ Accounts
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Accounts.
126 127 128 |
# File 'lib/surge_api/resources/accounts.rb', line 126 def initialize(client:) @client = client end |
Instance Method Details
#archive(id, request_options: {}) ⇒ SurgeAPI::Models::Account
Archives an account and releases all associated resources.
Warning: This action will:
-
Release all phone numbers associated with the account
-
Deactivate all campaigns
-
Make the account unusable for sending messages
This operation is irreversible. If you need to send SMS in the future, you will need to re-register new phone numbers and campaigns.
90 91 92 93 94 95 96 97 |
# File 'lib/surge_api/resources/accounts.rb', line 90 def archive(id, params = {}) @client.request( method: :delete, path: ["accounts/%1$s", id], model: SurgeAPI::Account, options: params[:request_options] ) end |
#create(name:, brand_name: nil, organization: nil, time_zone: nil, request_options: {}) ⇒ SurgeAPI::Models::Account
Some parameter documentations has been truncated, see Models::AccountCreateParams for more details.
Creates a new Account within the calling Platform.
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/surge_api/resources/accounts.rb', line 26 def create(params) parsed, = SurgeAPI::AccountCreateParams.dump_request(params) @client.request( method: :post, path: "accounts", body: parsed, model: SurgeAPI::Account, options: ) end |
#retrieve_status(account_id, capabilities: nil, request_options: {}) ⇒ SurgeAPI::Models::AccountStatus
Check an account’s status and capabilities
112 113 114 115 116 117 118 119 120 121 |
# File 'lib/surge_api/resources/accounts.rb', line 112 def retrieve_status(account_id, params = {}) parsed, = SurgeAPI::AccountRetrieveStatusParams.dump_request(params) @client.request( method: :get, path: ["accounts/%1$s/status", account_id], query: parsed, model: SurgeAPI::AccountStatus, options: ) end |
#update(id, brand_name: nil, name: nil, organization: nil, time_zone: nil, request_options: {}) ⇒ SurgeAPI::Models::Account
Some parameter documentations has been truncated, see Models::AccountUpdateParams for more details.
Updates an Account
59 60 61 62 63 64 65 66 67 68 |
# File 'lib/surge_api/resources/accounts.rb', line 59 def update(id, params = {}) parsed, = SurgeAPI::AccountUpdateParams.dump_request(params) @client.request( method: :patch, path: ["accounts/%1$s", id], body: parsed, model: SurgeAPI::Account, options: ) end |