Class: SurgeAPI::Resources::Campaigns
- Inherits:
-
Object
- Object
- SurgeAPI::Resources::Campaigns
- Defined in:
- lib/surge_api/resources/campaigns.rb,
sig/surge_api/resources/campaigns.rbs
Instance Method Summary collapse
-
#create(account_id, campaign_params:, request_options: {}) ⇒ SurgeAPI::Models::Campaign
Some parameter documentations has been truncated, see Models::CampaignCreateParams for more details.
-
#initialize(client:) ⇒ Campaigns
constructor
private
A new instance of Campaigns.
-
#list(account_id, after: nil, before: nil, request_options: {}) ⇒ SurgeAPI::Internal::Cursor<SurgeAPI::Models::Campaign>
Some parameter documentations has been truncated, see Models::CampaignListParams for more details.
-
#resend_brand_verification_message(account_id, request_options: {}) ⇒ SurgeAPI::Models::CampaignResendBrandVerificationMessageResponse
Enqueues an SMS OTP for a sole proprietor brand awaiting identity verification.
-
#retrieve(id, request_options: {}) ⇒ SurgeAPI::Models::Campaign
Retrieves a Campaign object.
-
#update(id, campaign_params:, request_options: {}) ⇒ SurgeAPI::Models::Campaign
Some parameter documentations has been truncated, see Models::CampaignUpdateParams for more details.
Constructor Details
#initialize(client:) ⇒ Campaigns
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 Campaigns.
137 138 139 |
# File 'lib/surge_api/resources/campaigns.rb', line 137 def initialize(client:) @client = client end |
Instance Method Details
#create(account_id, campaign_params:, request_options: {}) ⇒ SurgeAPI::Models::Campaign
Some parameter documentations has been truncated, see Models::CampaignCreateParams for more details.
Creates a campaign to register account to send text messages.
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/surge_api/resources/campaigns.rb', line 22 def create(account_id, params) parsed, = SurgeAPI::CampaignCreateParams.dump_request(params) @client.request( method: :post, path: ["accounts/%1$s/campaigns", account_id], body: parsed[:campaign_params], model: SurgeAPI::Campaign, options: ) end |
#list(account_id, after: nil, before: nil, request_options: {}) ⇒ SurgeAPI::Internal::Cursor<SurgeAPI::Models::Campaign>
Some parameter documentations has been truncated, see Models::CampaignListParams for more details.
List all campaigns for an account with cursor-based pagination.
101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/surge_api/resources/campaigns.rb', line 101 def list(account_id, params = {}) parsed, = SurgeAPI::CampaignListParams.dump_request(params) query = SurgeAPI::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["accounts/%1$s/campaigns", account_id], query: query, page: SurgeAPI::Internal::Cursor, model: SurgeAPI::Campaign, options: ) end |
#resend_brand_verification_message(account_id, request_options: {}) ⇒ SurgeAPI::Models::CampaignResendBrandVerificationMessageResponse
Enqueues an SMS OTP for a sole proprietor brand awaiting identity verification.
125 126 127 128 129 130 131 132 |
# File 'lib/surge_api/resources/campaigns.rb', line 125 def (account_id, params = {}) @client.request( method: :post, path: ["accounts/%1$s/brand_verification_messages", account_id], model: SurgeAPI::Models::CampaignResendBrandVerificationMessageResponse, options: params[:request_options] ) end |
#retrieve(id, request_options: {}) ⇒ SurgeAPI::Models::Campaign
Retrieves a Campaign object.
44 45 46 47 48 49 50 51 |
# File 'lib/surge_api/resources/campaigns.rb', line 44 def retrieve(id, params = {}) @client.request( method: :get, path: ["campaigns/%1$s", id], model: SurgeAPI::Campaign, options: params[:request_options] ) end |
#update(id, campaign_params:, request_options: {}) ⇒ SurgeAPI::Models::Campaign
Some parameter documentations has been truncated, see Models::CampaignUpdateParams for more details.
Updates a campaign that has not yet been approved. This can be used to fix issues flagged during review and resubmit the campaign. Returns an error if the campaign is currently in review, has already been approved, or has been deactivated.
72 73 74 75 76 77 78 79 80 81 |
# File 'lib/surge_api/resources/campaigns.rb', line 72 def update(id, params) parsed, = SurgeAPI::CampaignUpdateParams.dump_request(params) @client.request( method: :patch, path: ["campaigns/%1$s", id], body: parsed[:campaign_params], model: SurgeAPI::Campaign, options: ) end |