Class: Sendly::GroupMessage
- Inherits:
-
Object
- Object
- Sendly::GroupMessage
- 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
-
#group_message_id ⇒ String?
readonly
Identifier for the group conversation (present on live sends).
-
#id ⇒ String
readonly
Message id — matches the id in delivery webhooks.
-
#message ⇒ String?
readonly
Human-readable note, present on simulated sends.
-
#raw ⇒ Hash
readonly
The raw parsed response.
-
#simulated ⇒ Boolean
readonly
True when the send was simulated and nothing reached the carrier.
-
#status ⇒ String
readonly
Delivery status ("sent" on a live send, "delivered" when simulated).
-
#to ⇒ Array<String>
readonly
The recipients the group message was sent to.
Instance Method Summary collapse
-
#initialize(data) ⇒ GroupMessage
constructor
A new instance of GroupMessage.
-
#simulated? ⇒ Boolean
Whether the send was simulated.
- #to_h ⇒ Object
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_id ⇒ String? (readonly)
Returns Identifier for the group conversation (present on live sends).
228 229 230 |
# File 'lib/sendly/types.rb', line 228 def @group_message_id end |
#id ⇒ String (readonly)
Returns Message id — matches the id in delivery webhooks.
219 220 221 |
# File 'lib/sendly/types.rb', line 219 def id @id end |
#message ⇒ String? (readonly)
Returns Human-readable note, present on simulated sends.
234 235 236 |
# File 'lib/sendly/types.rb', line 234 def @message end |
#raw ⇒ Hash (readonly)
Returns The raw parsed response.
237 238 239 |
# File 'lib/sendly/types.rb', line 237 def raw @raw end |
#simulated ⇒ Boolean (readonly)
Returns 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 |
#status ⇒ String (readonly)
Returns Delivery status ("sent" on a live send, "delivered" when simulated).
222 223 224 |
# File 'lib/sendly/types.rb', line 222 def status @status end |
#to ⇒ Array<String> (readonly)
Returns 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.
250 251 252 |
# File 'lib/sendly/types.rb', line 250 def simulated? simulated end |
#to_h ⇒ Object
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: , simulated: simulated, message: }.compact end |