Class: Sentdm::Resources::Profiles::Campaigns
- Inherits:
-
Object
- Object
- Sentdm::Resources::Profiles::Campaigns
- Defined in:
- lib/sentdm/resources/profiles/campaigns.rb
Overview
Manage organization profiles
Instance Method Summary collapse
-
#create(profile_id, campaign:, sandbox: nil, idempotency_key: nil, x_profile_id: nil, request_options: {}) ⇒ Sentdm::Models::Profiles::APIResponseOfTcrCampaignWithUseCases
Some parameter documentations has been truncated, see Models::Profiles::CampaignCreateParams for more details.
-
#delete(campaign_id, profile_id:, body:, x_profile_id: nil, request_options: {}) ⇒ nil
Some parameter documentations has been truncated, see Models::Profiles::CampaignDeleteParams for more details.
-
#initialize(client:) ⇒ Campaigns
constructor
private
A new instance of Campaigns.
-
#list(profile_id, x_profile_id: nil, request_options: {}) ⇒ Sentdm::Models::Profiles::CampaignListResponse
Some parameter documentations has been truncated, see Models::Profiles::CampaignListParams for more details.
-
#update(campaign_id, profile_id:, campaign:, sandbox: nil, idempotency_key: nil, x_profile_id: nil, request_options: {}) ⇒ Sentdm::Models::Profiles::APIResponseOfTcrCampaignWithUseCases
Some parameter documentations has been truncated, see Models::Profiles::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.
154 155 156 |
# File 'lib/sentdm/resources/profiles/campaigns.rb', line 154 def initialize(client:) @client = client end |
Instance Method Details
#create(profile_id, campaign:, sandbox: nil, idempotency_key: nil, x_profile_id: nil, request_options: {}) ⇒ Sentdm::Models::Profiles::APIResponseOfTcrCampaignWithUseCases
Some parameter documentations has been truncated, see Models::Profiles::CampaignCreateParams for more details.
Creates a new campaign scoped under the brand of the specified profile. Each campaign must include at least one use case with sample messages.
31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/sentdm/resources/profiles/campaigns.rb', line 31 def create(profile_id, params) parsed, = Sentdm::Profiles::CampaignCreateParams.dump_request(params) header_params = {idempotency_key: "idempotency-key", x_profile_id: "x-profile-id"} @client.request( method: :post, path: ["v3/profiles/%1$s/campaigns", profile_id], headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Sentdm::Profiles::APIResponseOfTcrCampaignWithUseCases, options: ) end |
#delete(campaign_id, profile_id:, body:, x_profile_id: nil, request_options: {}) ⇒ nil
Some parameter documentations has been truncated, see Models::Profiles::CampaignDeleteParams for more details.
Deletes a campaign by ID from the brand of the specified profile. The profile must belong to the authenticated organization.
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 |
# File 'lib/sentdm/resources/profiles/campaigns.rb', line 135 def delete(campaign_id, params) parsed, = Sentdm::Profiles::CampaignDeleteParams.dump_request(params) profile_id = parsed.delete(:profile_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :delete, path: ["v3/profiles/%1$s/campaigns/%2$s", profile_id, campaign_id], headers: parsed.except(:body).transform_keys(x_profile_id: "x-profile-id"), body: parsed[:body], model: NilClass, options: ) end |
#list(profile_id, x_profile_id: nil, request_options: {}) ⇒ Sentdm::Models::Profiles::CampaignListResponse
Some parameter documentations has been truncated, see Models::Profiles::CampaignListParams for more details.
Retrieves all campaigns linked to the profile’s brand, including use cases and sample messages. Returns inherited campaigns if inherit_tcr_campaign=true.
103 104 105 106 107 108 109 110 111 112 |
# File 'lib/sentdm/resources/profiles/campaigns.rb', line 103 def list(profile_id, params = {}) parsed, = Sentdm::Profiles::CampaignListParams.dump_request(params) @client.request( method: :get, path: ["v3/profiles/%1$s/campaigns", profile_id], headers: parsed.transform_keys(x_profile_id: "x-profile-id"), model: Sentdm::Models::Profiles::CampaignListResponse, options: ) end |
#update(campaign_id, profile_id:, campaign:, sandbox: nil, idempotency_key: nil, x_profile_id: nil, request_options: {}) ⇒ Sentdm::Models::Profiles::APIResponseOfTcrCampaignWithUseCases
Some parameter documentations has been truncated, see Models::Profiles::CampaignUpdateParams for more details.
Updates an existing campaign under the brand of the specified profile. Cannot update campaigns that have already been submitted to TCR.
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/sentdm/resources/profiles/campaigns.rb', line 69 def update(campaign_id, params) parsed, = Sentdm::Profiles::CampaignUpdateParams.dump_request(params) profile_id = parsed.delete(:profile_id) do raise ArgumentError.new("missing required path argument #{_1}") end header_params = {idempotency_key: "idempotency-key", x_profile_id: "x-profile-id"} @client.request( method: :put, path: ["v3/profiles/%1$s/campaigns/%2$s", profile_id, campaign_id], headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Sentdm::Profiles::APIResponseOfTcrCampaignWithUseCases, options: ) end |