Class: Mailkube::Email
- Inherits:
-
Object
- Object
- Mailkube::Email
- Defined in:
- lib/mailkube/types.rb,
sig/mailkube/types.rbs
Overview
The result of a successful send.
A scheduled send (one carrying scheduled_at) is acknowledged with 202 and a richer
body; status, scheduled_at and batch_id are populated only then, and #scheduled? is
the discriminator. An immediate send leaves all three nil.
This is the worked example of the contract's widen, never union rule: one call can return two shapes, and adding optional fields plus a predicate keeps every existing caller valid, where returning one of two classes would not.
Timestamps stay the verbatim ISO-8601 strings the server sent. The SDK does not validate or
reinterpret server data; call Time.iso8601 yourself if you want an object. Transport
metadata (response headers, the request id) belongs on the exception, not here.
Instance Attribute Summary collapse
-
#batch_id ⇒ String?
readonly
Returns the value of attribute batch_id.
-
#id ⇒ String
readonly
Returns the value of attribute id.
-
#idempotent_replayed ⇒ Boolean
readonly
Returns the value of attribute idempotent_replayed.
-
#message_id ⇒ String?
readonly
Returns the value of attribute message_id.
-
#scheduled_at ⇒ String?
readonly
Returns the value of attribute scheduled_at.
-
#status ⇒ String?
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(id:, message_id: nil, idempotent_replayed: false, status: nil, scheduled_at: nil, batch_id: nil) ⇒ Email
constructor
A new instance of Email.
-
#scheduled? ⇒ Boolean
True when the send was accepted for later delivery rather than sent now.
Constructor Details
#initialize(id:, message_id: nil, idempotent_replayed: false, status: nil, scheduled_at: nil, batch_id: nil) ⇒ Email
Returns a new instance of Email.
46 47 48 49 |
# File 'lib/mailkube/types.rb', line 46 def initialize(id:, message_id: nil, idempotent_replayed: false, status: nil, scheduled_at: nil, batch_id: nil) super end |
Instance Attribute Details
#batch_id ⇒ String? (readonly)
Returns the value of attribute batch_id.
38 39 40 |
# File 'sig/mailkube/types.rbs', line 38 def batch_id @batch_id end |
#id ⇒ String (readonly)
Returns the value of attribute id.
33 34 35 |
# File 'sig/mailkube/types.rbs', line 33 def id @id end |
#idempotent_replayed ⇒ Boolean (readonly)
Returns the value of attribute idempotent_replayed.
35 36 37 |
# File 'sig/mailkube/types.rbs', line 35 def idempotent_replayed @idempotent_replayed end |
#message_id ⇒ String? (readonly)
Returns the value of attribute message_id.
34 35 36 |
# File 'sig/mailkube/types.rbs', line 34 def @message_id end |
#scheduled_at ⇒ String? (readonly)
Returns the value of attribute scheduled_at.
37 38 39 |
# File 'sig/mailkube/types.rbs', line 37 def scheduled_at @scheduled_at end |
#status ⇒ String? (readonly)
Returns the value of attribute status.
36 37 38 |
# File 'sig/mailkube/types.rbs', line 36 def status @status end |
Instance Method Details
#scheduled? ⇒ Boolean
Returns true when the send was accepted for later delivery rather than sent now.
52 |
# File 'lib/mailkube/types.rb', line 52 def scheduled? = !scheduled_at.nil? |