Class: Sendly::GroupMessage

Inherits:
Object
  • Object
show all
Defined in:
lib/sendly/types.rb

Overview

Represents the result of sending a group MMS to 2-8 recipients.

Unlike Message, to is an array of recipients and the response carries a group_message_id identifying the shared conversation. The raw parsed response is preserved on #raw so callers can read any field the server adds.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ GroupMessage

Returns a new instance of GroupMessage.



239
240
241
242
243
244
245
246
247
# File 'lib/sendly/types.rb', line 239

def initialize(data)
  @raw = data
  @id = data["id"]
  @status = data["status"]
  @to = data["to"] || []
  @group_message_id = data["group_message_id"] || data["groupMessageId"]
  @simulated = data["simulated"] || false
  @message = data["message"]
end

Instance Attribute Details

#group_message_idString? (readonly)

Returns Identifier for the group conversation (present on live sends).

Returns:

  • (String, nil)

    Identifier for the group conversation (present on live sends)



228
229
230
# File 'lib/sendly/types.rb', line 228

def group_message_id
  @group_message_id
end

#idString (readonly)

Returns Message id — matches the id in delivery webhooks.

Returns:

  • (String)

    Message id — matches the id in delivery webhooks



219
220
221
# File 'lib/sendly/types.rb', line 219

def id
  @id
end

#messageString? (readonly)

Returns Human-readable note, present on simulated sends.

Returns:

  • (String, nil)

    Human-readable note, present on simulated sends



234
235
236
# File 'lib/sendly/types.rb', line 234

def message
  @message
end

#rawHash (readonly)

Returns The raw parsed response.

Returns:

  • (Hash)

    The raw parsed response



237
238
239
# File 'lib/sendly/types.rb', line 237

def raw
  @raw
end

#simulatedBoolean (readonly)

Returns True when the send was simulated and nothing reached the carrier.

Returns:

  • (Boolean)

    True when the send was simulated and nothing reached the carrier



231
232
233
# File 'lib/sendly/types.rb', line 231

def simulated
  @simulated
end

#statusString (readonly)

Returns Delivery status ("sent" on a live send, "delivered" when simulated).

Returns:

  • (String)

    Delivery status ("sent" on a live send, "delivered" when simulated)



222
223
224
# File 'lib/sendly/types.rb', line 222

def status
  @status
end

#toArray<String> (readonly)

Returns The recipients the group message was sent to.

Returns:

  • (Array<String>)

    The recipients the group message was sent to



225
226
227
# File 'lib/sendly/types.rb', line 225

def to
  @to
end

Instance Method Details

#simulated?Boolean

Returns Whether the send was simulated.

Returns:

  • (Boolean)

    Whether the send was simulated



250
251
252
# File 'lib/sendly/types.rb', line 250

def simulated?
  simulated
end

#to_hObject



254
255
256
257
258
259
260
# File 'lib/sendly/types.rb', line 254

def to_h
  {
    id: id, status: status, to: to,
    group_message_id: group_message_id,
    simulated: simulated, message: message
  }.compact
end