Class: SurgeAPI::Resources::Campaigns

Inherits:
Object
  • Object
show all
Defined in:
lib/surge_api/resources/campaigns.rb

Instance Method Summary collapse

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.

Parameters:



41
42
43
# File 'lib/surge_api/resources/campaigns.rb', line 41

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.

Parameters:

  • account_id (String)

    The account for which the campaign should be created.

  • campaign_params (SurgeAPI::CampaignParams)

    Parameters for creating a new campaign. Either provide full campaign details or

  • request_options (SurgeAPI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/surge_api/resources/campaigns.rb', line 22

def create(, params)
  parsed, options = SurgeAPI::CampaignCreateParams.dump_request(params)
  case parsed
  in {campaign_params: Hash => union, **rest}
    parsed = {**rest, **union}
  else
  end
  @client.request(
    method: :post,
    path: ["accounts/%1$s/campaigns", ],
    body: parsed,
    model: SurgeAPI::Campaign,
    options: options
  )
end