Class: Svix::EndpointMessageOut
- Inherits:
-
Object
- Object
- Svix::EndpointMessageOut
- Defined in:
- lib/svix/models/endpoint_message_out.rb
Overview
A model containing information on a given message plus additional fields on the last attempt for that message.
Instance Attribute Summary collapse
-
#channels ⇒ Object
List of free-form identifiers that endpoints can filter by.
-
#deliver_at ⇒ Object
Returns the value of attribute deliver_at.
-
#event_id ⇒ Object
Optional unique identifier for the message.
-
#event_type ⇒ Object
The event type’s name.
-
#id ⇒ Object
The Message’s ID.
-
#next_attempt ⇒ Object
Returns the value of attribute next_attempt.
-
#payload ⇒ Object
Returns the value of attribute payload.
-
#status ⇒ Object
Returns the value of attribute status.
-
#status_text ⇒ Object
Returns the value of attribute status_text.
-
#tags ⇒ Object
Returns the value of attribute tags.
-
#timestamp ⇒ Object
Returns the value of attribute timestamp.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ EndpointMessageOut
constructor
A new instance of EndpointMessageOut.
- #serialize ⇒ Object
-
#to_json ⇒ Object
Serializes the object to a json string.
Constructor Details
#initialize(attributes = {}) ⇒ EndpointMessageOut
Returns a new instance of EndpointMessageOut.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/svix/models/endpoint_message_out.rb', line 39 def initialize(attributes = {}) unless attributes.is_a?(Hash) fail(ArgumentError, "The input argument (attributes) must be a hash in `Svix::EndpointMessageOut` new method") end attributes.each do |k, v| unless ALL_FIELD.include?(k.to_s) fail(ArgumentError, "The field #{k} is not part of Svix::EndpointMessageOut") end instance_variable_set("@#{k}", v) instance_variable_set("@__#{k}_is_defined", true) end end |
Instance Attribute Details
#channels ⇒ Object
List of free-form identifiers that endpoints can filter by
9 10 11 |
# File 'lib/svix/models/endpoint_message_out.rb', line 9 def channels @channels end |
#deliver_at ⇒ Object
Returns the value of attribute deliver_at.
10 11 12 |
# File 'lib/svix/models/endpoint_message_out.rb', line 10 def deliver_at @deliver_at end |
#event_id ⇒ Object
Optional unique identifier for the message
12 13 14 |
# File 'lib/svix/models/endpoint_message_out.rb', line 12 def event_id @event_id end |
#event_type ⇒ Object
The event type’s name
14 15 16 |
# File 'lib/svix/models/endpoint_message_out.rb', line 14 def event_type @event_type end |
#id ⇒ Object
The Message’s ID.
16 17 18 |
# File 'lib/svix/models/endpoint_message_out.rb', line 16 def id @id end |
#next_attempt ⇒ Object
Returns the value of attribute next_attempt.
17 18 19 |
# File 'lib/svix/models/endpoint_message_out.rb', line 17 def next_attempt @next_attempt end |
#payload ⇒ Object
Returns the value of attribute payload.
18 19 20 |
# File 'lib/svix/models/endpoint_message_out.rb', line 18 def payload @payload end |
#status ⇒ Object
Returns the value of attribute status.
19 20 21 |
# File 'lib/svix/models/endpoint_message_out.rb', line 19 def status @status end |
#status_text ⇒ Object
Returns the value of attribute status_text.
20 21 22 |
# File 'lib/svix/models/endpoint_message_out.rb', line 20 def status_text @status_text end |
#tags ⇒ Object
Returns the value of attribute tags.
21 22 23 |
# File 'lib/svix/models/endpoint_message_out.rb', line 21 def end |
#timestamp ⇒ Object
Returns the value of attribute timestamp.
22 23 24 |
# File 'lib/svix/models/endpoint_message_out.rb', line 22 def end |
Class Method Details
.deserialize(attributes = {}) ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/svix/models/endpoint_message_out.rb', line 54 def self.deserialize(attributes = {}) attributes = attributes.transform_keys(&:to_s) attrs = Hash.new attrs["channels"] = attributes["channels"] attrs["deliver_at"] = DateTime.rfc3339(attributes["deliverAt"]).to_time if attributes["deliverAt"] attrs["event_id"] = attributes["eventId"] attrs["event_type"] = attributes["eventType"] attrs["id"] = attributes["id"] attrs["next_attempt"] = DateTime.rfc3339(attributes["nextAttempt"]).to_time if attributes["nextAttempt"] attrs["payload"] = attributes["payload"] attrs["status"] = Svix::MessageStatus.deserialize(attributes["status"]) attrs["status_text"] = Svix::MessageStatusText.deserialize(attributes["statusText"]) attrs["tags"] = attributes["tags"] attrs["timestamp"] = DateTime.rfc3339(attributes["timestamp"]).to_time new(attrs) end |
Instance Method Details
#serialize ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/svix/models/endpoint_message_out.rb', line 71 def serialize out = Hash.new out["channels"] = Svix::serialize_primitive(@channels) if @channels out["deliverAt"] = Svix::serialize_primitive(@deliver_at) if @deliver_at out["eventId"] = Svix::serialize_primitive(@event_id) if @event_id out["eventType"] = Svix::serialize_primitive(@event_type) if @event_type out["id"] = Svix::serialize_primitive(@id) if @id out["nextAttempt"] = Svix::serialize_primitive(@next_attempt) if @next_attempt out["payload"] = Svix::serialize_primitive(@payload) if @payload out["status"] = Svix::serialize_schema_ref(@status) if @status out["statusText"] = Svix::serialize_schema_ref(@status_text) if @status_text out["tags"] = Svix::serialize_primitive() if out["timestamp"] = Svix::serialize_primitive() if out end |
#to_json ⇒ Object
Serializes the object to a json string
89 90 91 |
# File 'lib/svix/models/endpoint_message_out.rb', line 89 def to_json JSON.dump(serialize) end |