Class: SurgeAPI::Resources::Accounts
- Inherits:
-
Object
- Object
- SurgeAPI::Resources::Accounts
- Defined in:
- lib/surge_api/resources/accounts.rb,
sig/surge_api/resources/accounts.rbs
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.
-
#list(after: nil, before: nil, request_options: {}) ⇒ SurgeAPI::Internal::Cursor<SurgeAPI::Models::Account>
Some parameter documentations has been truncated, see Models::AccountListParams for more details.
-
#retrieve(id, request_options: {}) ⇒ SurgeAPI::Models::Account
Retrieves an Account object.
-
#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.
176 177 178 |
# File 'lib/surge_api/resources/accounts.rb', line 176 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.
139 140 141 142 143 144 145 146 |
# File 'lib/surge_api/resources/accounts.rb', line 139 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 |
#list(after: nil, before: nil, request_options: {}) ⇒ SurgeAPI::Internal::Cursor<SurgeAPI::Models::Account>
Some parameter documentations has been truncated, see Models::AccountListParams for more details.
List all accounts for the calling platform with cursor-based pagination.
106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/surge_api/resources/accounts.rb', line 106 def list(params = {}) parsed, = SurgeAPI::AccountListParams.dump_request(params) query = SurgeAPI::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "accounts", query: query, page: SurgeAPI::Internal::Cursor, model: SurgeAPI::Account, options: ) end |
#retrieve(id, request_options: {}) ⇒ SurgeAPI::Models::Account
Retrieves an Account object.
48 49 50 51 52 53 54 55 |
# File 'lib/surge_api/resources/accounts.rb', line 48 def retrieve(id, params = {}) @client.request( method: :get, path: ["accounts/%1$s", id], model: SurgeAPI::Account, options: params[:request_options] ) end |
#retrieve_status(account_id, capabilities: nil, request_options: {}) ⇒ SurgeAPI::Models::AccountStatus
Check an account's status and capabilities
161 162 163 164 165 166 167 168 169 170 171 |
# File 'lib/surge_api/resources/accounts.rb', line 161 def retrieve_status(account_id, params = {}) parsed, = SurgeAPI::AccountRetrieveStatusParams.dump_request(params) query = SurgeAPI::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["accounts/%1$s/status", account_id], query: query, 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
79 80 81 82 83 84 85 86 87 88 |
# File 'lib/surge_api/resources/accounts.rb', line 79 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 |