Class: SurgeAPI::Resources::Blasts

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Blasts

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 Blasts.

Parameters:



50
51
52
# File 'lib/surge_api/resources/blasts.rb', line 50

def initialize(client:)
  @client = client
end

Instance Method Details

#create(account_id, attachments: nil, body: nil, contacts: nil, from: nil, name: nil, segments: nil, send_at: nil, to: nil, request_options: {}) ⇒ SurgeAPI::Models::Blast

Some parameter documentations has been truncated, see Models::BlastCreateParams for more details.

Sends a Blast.

Parameters:

  • account_id (String)

    The account for which the blast should be sent.

  • attachments (Array<SurgeAPI::Models::BlastCreateParams::Attachment>)
  • body (String, nil)

    The message body.

  • contacts (Array<String>)

    Deprecated. Use ‘to` instead.

  • from (String)

    The phone number from which to send the blast. This can be either the phone numb

  • name (String)

    Optional name for the blast.

  • segments (Array<String>)

    Deprecated. Use ‘to` instead.

  • send_at (Time)

    When to send the blast. If not provided, sends immediately.

  • to (Array<String>)

    List of recipients to whom the blast should be sent. This can be a combination o

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

Returns:

See Also:



36
37
38
39
40
41
42
43
44
45
# File 'lib/surge_api/resources/blasts.rb', line 36

def create(, params = {})
  parsed, options = SurgeAPI::BlastCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["accounts/%1$s/blasts", ],
    body: parsed,
    model: SurgeAPI::Blast,
    options: options
  )
end