Class: HookSniff::MessageAttemptFailingEventData

Inherits:
Object
  • Object
show all
Defined in:
lib/hooksniff/webhook_event.rb,
lib/hooksniff/models/message_attempt_failing_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 = {}) ⇒ MessageAttemptFailingEventData

Returns a new instance of MessageAttemptFailingEventData.



101
102
103
104
105
106
# File 'lib/hooksniff/webhook_event.rb', line 101

def initialize(app_id:, msg_id:, attempt:, app_uid: nil)
  @app_id = app_id
  @msg_id = msg_id
  @attempt = attempt
  @app_uid = app_uid
end

Instance Attribute Details

#app_idObject

The Application’s ID.



9
10
11
# File 'lib/hooksniff/models/message_attempt_failing_event_data.rb', line 9

def app_id
  @app_id
end

#app_uidObject

The Application’s UID.



11
12
13
# File 'lib/hooksniff/models/message_attempt_failing_event_data.rb', line 11

def app_uid
  @app_uid
end

#attemptObject (readonly)

Returns the value of attribute attempt.



99
100
101
# File 'lib/hooksniff/webhook_event.rb', line 99

def attempt
  @attempt
end

#endpoint_idObject

The Endpoint’s ID.



13
14
15
# File 'lib/hooksniff/models/message_attempt_failing_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/hooksniff/models/message_attempt_failing_event_data.rb', line 14

def last_attempt
  @last_attempt
end

#msg_event_idObject

The Message’s UID.



16
17
18
# File 'lib/hooksniff/models/message_attempt_failing_event_data.rb', line 16

def msg_event_id
  @msg_event_id
end

#msg_idObject

The Message’s ID.



18
19
20
# File 'lib/hooksniff/models/message_attempt_failing_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/hooksniff/models/message_attempt_failing_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"] = HookSniff::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/hooksniff/models/message_attempt_failing_event_data.rb', line 53

def serialize
  out = Hash.new
  out["appId"] = HookSniff::serialize_primitive(@app_id) if @app_id
  out["appUid"] = HookSniff::serialize_primitive(@app_uid) if @app_uid
  out["endpointId"] = HookSniff::serialize_primitive(@endpoint_id) if @endpoint_id
  out["lastAttempt"] = HookSniff::serialize_schema_ref(@last_attempt) if @last_attempt
  out["msgEventId"] = HookSniff::serialize_primitive(@msg_event_id) if @msg_event_id
  out["msgId"] = HookSniff::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/hooksniff/models/message_attempt_failing_event_data.rb', line 66

def to_json
  JSON.dump(serialize)
end