Class: Svix::MessageAttemptExhaustedEventData

Inherits:
Object
  • Object
show all
Defined in:
lib/svix/models/message_attempt_exhausted_event_data.rb

Overview

Sent when a message delivery has failed (all of the retry attempts have been exhausted) as a “message.attempt.exhausted” type or after it’s failed four times as a “message.attempt.failing” event.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ MessageAttemptExhaustedEventData

Returns a new instance of MessageAttemptExhaustedEventData.



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/svix/models/message_attempt_exhausted_event_data.rb', line 23

def initialize(attributes = {})
  unless attributes.is_a?(Hash)
    fail(
      ArgumentError,
      "The input argument (attributes) must be a hash in `Svix::MessageAttemptExhaustedEventData` 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::MessageAttemptExhaustedEventData")
    end

    instance_variable_set("@#{k}", v)
    instance_variable_set("@__#{k}_is_defined", true)
  end
end

Instance Attribute Details

#app_idObject

The Application’s ID.



9
10
11
# File 'lib/svix/models/message_attempt_exhausted_event_data.rb', line 9

def app_id
  @app_id
end

#app_uidObject

The Application’s UID.



11
12
13
# File 'lib/svix/models/message_attempt_exhausted_event_data.rb', line 11

def app_uid
  @app_uid
end

#endpoint_idObject

The Endpoint’s ID.



13
14
15
# File 'lib/svix/models/message_attempt_exhausted_event_data.rb', line 13

def endpoint_id
  @endpoint_id
end

#last_attemptObject

Returns the value of attribute last_attempt.



14
15
16
# File 'lib/svix/models/message_attempt_exhausted_event_data.rb', line 14

def last_attempt
  @last_attempt
end

#msg_event_idObject

The Message’s UID.



16
17
18
# File 'lib/svix/models/message_attempt_exhausted_event_data.rb', line 16

def msg_event_id
  @msg_event_id
end

#msg_idObject

The Message’s ID.



18
19
20
# File 'lib/svix/models/message_attempt_exhausted_event_data.rb', line 18

def msg_id
  @msg_id
end

Class Method Details

.deserialize(attributes = {}) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
# File 'lib/svix/models/message_attempt_exhausted_event_data.rb', line 41

def self.deserialize(attributes = {})
  attributes = attributes.transform_keys(&:to_s)
  attrs = Hash.new
  attrs["app_id"] = attributes["appId"]
  attrs["app_uid"] = attributes["appUid"]
  attrs["endpoint_id"] = attributes["endpointId"]
  attrs["last_attempt"] = Svix::MessageAttemptFailedData.deserialize(attributes["lastAttempt"])
  attrs["msg_event_id"] = attributes["msgEventId"]
  attrs["msg_id"] = attributes["msgId"]
  new(attrs)
end

Instance Method Details

#serializeObject



53
54
55
56
57
58
59
60
61
62
# File 'lib/svix/models/message_attempt_exhausted_event_data.rb', line 53

def serialize
  out = Hash.new
  out["appId"] = Svix::serialize_primitive(@app_id) if @app_id
  out["appUid"] = Svix::serialize_primitive(@app_uid) if @app_uid
  out["endpointId"] = Svix::serialize_primitive(@endpoint_id) if @endpoint_id
  out["lastAttempt"] = Svix::serialize_schema_ref(@last_attempt) if @last_attempt
  out["msgEventId"] = Svix::serialize_primitive(@msg_event_id) if @msg_event_id
  out["msgId"] = Svix::serialize_primitive(@msg_id) if @msg_id
  out
end

#to_jsonObject

Serializes the object to a json string

Returns:

  • String



66
67
68
# File 'lib/svix/models/message_attempt_exhausted_event_data.rb', line 66

def to_json
  JSON.dump(serialize)
end