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.
-
#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_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.
156 157 158 |
# File 'lib/surge_api/resources/accounts.rb', line 156 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.
119 120 121 122 123 124 125 126 |
# File 'lib/surge_api/resources/accounts.rb', line 119 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.
86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/surge_api/resources/accounts.rb', line 86 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_status(account_id, capabilities: nil, request_options: {}) ⇒ SurgeAPI::Models::AccountStatus
Check an account’s status and capabilities
141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/surge_api/resources/accounts.rb', line 141 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
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 |