hooksniff 0.1.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +7 -0
  3. data/Gemfile.lock +56 -0
  4. data/README.md +24 -197
  5. data/Rakefile +2 -0
  6. data/hooksniff.gemspec +48 -0
  7. data/lib/hooksniff/api/authentication.rb +36 -0
  8. data/lib/hooksniff/api/endpoint.rb +102 -0
  9. data/lib/hooksniff/api/event_type.rb +66 -0
  10. data/lib/hooksniff/api/health.rb +16 -0
  11. data/lib/hooksniff/api/message.rb +48 -0
  12. data/lib/hooksniff/api/message_attempt.rb +38 -0
  13. data/lib/hooksniff/api/statistics.rb +37 -0
  14. data/lib/hooksniff/api_error.rb +48 -0
  15. data/lib/hooksniff/errors.rb +107 -21
  16. data/lib/hooksniff/hooksniff.rb +36 -0
  17. data/lib/hooksniff/hooksniff_http_client.rb +128 -0
  18. data/lib/hooksniff/http_error_out.rb +18 -0
  19. data/lib/hooksniff/http_validation_error.rb +18 -0
  20. data/lib/hooksniff/internal.rb +7 -0
  21. data/lib/hooksniff/models/aggregate_event_types_out.rb +59 -0
  22. data/lib/hooksniff/models/endpoint_created_event.rb +50 -0
  23. data/lib/hooksniff/models/endpoint_created_event_data.rb +63 -0
  24. data/lib/hooksniff/models/endpoint_deleted_event.rb +50 -0
  25. data/lib/hooksniff/models/endpoint_deleted_event_data.rb +63 -0
  26. data/lib/hooksniff/models/endpoint_disabled_event.rb +53 -0
  27. data/lib/hooksniff/models/endpoint_disabled_event_data.rb +69 -0
  28. data/lib/hooksniff/models/endpoint_enabled_event.rb +50 -0
  29. data/lib/hooksniff/models/endpoint_enabled_event_data.rb +63 -0
  30. data/lib/hooksniff/models/endpoint_headers_in.rb +46 -0
  31. data/lib/hooksniff/models/endpoint_headers_out.rb +52 -0
  32. data/lib/hooksniff/models/endpoint_headers_patch_in.rb +53 -0
  33. data/lib/hooksniff/models/endpoint_in.rb +102 -0
  34. data/lib/hooksniff/models/endpoint_out.rb +104 -0
  35. data/lib/hooksniff/models/endpoint_patch.rb +97 -0
  36. data/lib/hooksniff/models/endpoint_secret_out.rb +50 -0
  37. data/lib/hooksniff/models/endpoint_secret_rotate_in.rb +53 -0
  38. data/lib/hooksniff/models/endpoint_update.rb +90 -0
  39. data/lib/hooksniff/models/endpoint_updated_event.rb +50 -0
  40. data/lib/hooksniff/models/endpoint_updated_event_data.rb +63 -0
  41. data/lib/hooksniff/models/event_in.rb +50 -0
  42. data/lib/hooksniff/models/event_out.rb +53 -0
  43. data/lib/hooksniff/models/event_type_in.rb +80 -0
  44. data/lib/hooksniff/models/event_type_out.rb +87 -0
  45. data/lib/hooksniff/models/event_type_patch.rb +66 -0
  46. data/lib/hooksniff/models/event_type_update.rb +67 -0
  47. data/lib/hooksniff/models/list_response_endpoint_out.rb +58 -0
  48. data/lib/hooksniff/models/list_response_event_type_out.rb +58 -0
  49. data/lib/hooksniff/models/list_response_message_attempt_out.rb +58 -0
  50. data/lib/hooksniff/models/list_response_message_out.rb +58 -0
  51. data/lib/hooksniff/models/message_attempt_exhausted_event.rb +53 -0
  52. data/lib/hooksniff/models/message_attempt_exhausted_event_data.rb +70 -0
  53. data/lib/hooksniff/models/message_attempt_failed_data.rb +56 -0
  54. data/lib/hooksniff/models/message_attempt_failing_event.rb +54 -0
  55. data/lib/hooksniff/models/message_attempt_failing_event_data.rb +70 -0
  56. data/lib/hooksniff/models/message_attempt_log.rb +112 -0
  57. data/lib/hooksniff/models/message_attempt_log_event.rb +53 -0
  58. data/lib/hooksniff/models/message_attempt_out.rb +96 -0
  59. data/lib/hooksniff/models/message_attempt_recovered_event.rb +53 -0
  60. data/lib/hooksniff/models/message_attempt_recovered_event_data.rb +70 -0
  61. data/lib/hooksniff/models/message_attempt_trigger_type.rb +33 -0
  62. data/lib/hooksniff/models/message_endpoint_out.rb +112 -0
  63. data/lib/hooksniff/models/message_in.rb +100 -0
  64. data/lib/hooksniff/models/message_out.rb +71 -0
  65. data/lib/hooksniff/models/message_status.rb +39 -0
  66. data/lib/hooksniff/models/message_status_text.rb +32 -0
  67. data/lib/hooksniff/models/ordering.rb +30 -0
  68. data/lib/hooksniff/models/status_code_class.rb +41 -0
  69. data/lib/hooksniff/util.rb +69 -0
  70. data/lib/hooksniff/validation_error.rb +28 -0
  71. data/lib/hooksniff/version.rb +1 -1
  72. data/lib/hooksniff/webhook.rb +84 -0
  73. data/lib/hooksniff.rb +71 -12
  74. data/test/test_hooksniff.rb +86 -0
  75. metadata +124 -31
  76. data/lib/hooksniff/client.rb +0 -213
  77. data/lib/hooksniff/models.rb +0 -136
  78. data/lib/hooksniff/verification.rb +0 -134
@@ -0,0 +1,66 @@
1
+ # frozen_string_literal: true
2
+ # This file is @generated
3
+ require "json"
4
+
5
+ module HookSniff
6
+ class EventTypePatch
7
+ attr_accessor :archived
8
+ attr_accessor :deprecated
9
+ attr_accessor :description
10
+ # Deprecated, use `featureFlags` instead.
11
+ attr_accessor :feature_flag
12
+ attr_accessor :feature_flags
13
+ # The event type group's name
14
+ attr_accessor :group_name
15
+ attr_accessor :schemas
16
+
17
+ ALL_FIELD ||= ["archived", "deprecated", "description", "feature_flag", "feature_flags", "group_name", "schemas"].freeze
18
+ private_constant :ALL_FIELD
19
+
20
+ def initialize(attributes = {})
21
+ unless attributes.is_a?(Hash)
22
+ fail(ArgumentError, "The input argument (attributes) must be a hash in `HookSniff::EventTypePatch` new method")
23
+ end
24
+
25
+ attributes.each do |k, v|
26
+ unless ALL_FIELD.include?(k.to_s)
27
+ fail(ArgumentError, "The field #{k} is not part of HookSniff::EventTypePatch")
28
+ end
29
+
30
+ instance_variable_set("@#{k}", v)
31
+ instance_variable_set("@__#{k}_is_defined", true)
32
+ end
33
+ end
34
+
35
+ def self.deserialize(attributes = {})
36
+ attributes = attributes.transform_keys(&:to_s)
37
+ attrs = Hash.new
38
+ attrs["archived"] = attributes["archived"]
39
+ attrs["deprecated"] = attributes["deprecated"]
40
+ attrs["description"] = attributes["description"]
41
+ attrs["feature_flag"] = attributes["featureFlag"]
42
+ attrs["feature_flags"] = attributes["featureFlags"]
43
+ attrs["group_name"] = attributes["groupName"]
44
+ attrs["schemas"] = attributes["schemas"]
45
+ new(attrs)
46
+ end
47
+
48
+ def serialize
49
+ out = Hash.new
50
+ out["archived"] = HookSniff::serialize_primitive(@archived) if @archived
51
+ out["deprecated"] = HookSniff::serialize_primitive(@deprecated) if @deprecated
52
+ out["description"] = HookSniff::serialize_primitive(@description) if @description
53
+ out["featureFlag"] = HookSniff::serialize_primitive(@feature_flag) if @__feature_flag_is_defined
54
+ out["featureFlags"] = HookSniff::serialize_primitive(@feature_flags) if @__feature_flags_is_defined
55
+ out["groupName"] = HookSniff::serialize_primitive(@group_name) if @__group_name_is_defined
56
+ out["schemas"] = HookSniff::serialize_primitive(@schemas) if @__schemas_is_defined
57
+ out
58
+ end
59
+
60
+ # Serializes the object to a json string
61
+ # @return String
62
+ def to_json
63
+ JSON.dump(serialize)
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,67 @@
1
+ # frozen_string_literal: true
2
+ # This file is @generated
3
+ require "json"
4
+
5
+ module HookSniff
6
+ class EventTypeUpdate
7
+ attr_accessor :archived
8
+ attr_accessor :deprecated
9
+ attr_accessor :description
10
+ # Deprecated, use `featureFlags` instead.
11
+ attr_accessor :feature_flag
12
+ attr_accessor :feature_flags
13
+ # The event type group's name
14
+ attr_accessor :group_name
15
+ # The schema for the event type for a specific version as a JSON schema.
16
+ attr_accessor :schemas
17
+
18
+ ALL_FIELD ||= ["archived", "deprecated", "description", "feature_flag", "feature_flags", "group_name", "schemas"].freeze
19
+ private_constant :ALL_FIELD
20
+
21
+ def initialize(attributes = {})
22
+ unless attributes.is_a?(Hash)
23
+ fail(ArgumentError, "The input argument (attributes) must be a hash in `HookSniff::EventTypeUpdate` new method")
24
+ end
25
+
26
+ attributes.each do |k, v|
27
+ unless ALL_FIELD.include?(k.to_s)
28
+ fail(ArgumentError, "The field #{k} is not part of HookSniff::EventTypeUpdate")
29
+ end
30
+
31
+ instance_variable_set("@#{k}", v)
32
+ instance_variable_set("@__#{k}_is_defined", true)
33
+ end
34
+ end
35
+
36
+ def self.deserialize(attributes = {})
37
+ attributes = attributes.transform_keys(&:to_s)
38
+ attrs = Hash.new
39
+ attrs["archived"] = attributes["archived"]
40
+ attrs["deprecated"] = attributes["deprecated"]
41
+ attrs["description"] = attributes["description"]
42
+ attrs["feature_flag"] = attributes["featureFlag"]
43
+ attrs["feature_flags"] = attributes["featureFlags"]
44
+ attrs["group_name"] = attributes["groupName"]
45
+ attrs["schemas"] = attributes["schemas"]
46
+ new(attrs)
47
+ end
48
+
49
+ def serialize
50
+ out = Hash.new
51
+ out["archived"] = HookSniff::serialize_primitive(@archived) if @archived
52
+ out["deprecated"] = HookSniff::serialize_primitive(@deprecated) if @deprecated
53
+ out["description"] = HookSniff::serialize_primitive(@description) if @description
54
+ out["featureFlag"] = HookSniff::serialize_primitive(@feature_flag) if @feature_flag
55
+ out["featureFlags"] = HookSniff::serialize_primitive(@feature_flags) if @feature_flags
56
+ out["groupName"] = HookSniff::serialize_primitive(@group_name) if @group_name
57
+ out["schemas"] = HookSniff::serialize_primitive(@schemas) if @schemas
58
+ out
59
+ end
60
+
61
+ # Serializes the object to a json string
62
+ # @return String
63
+ def to_json
64
+ JSON.dump(serialize)
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+ # This file is @generated
3
+ require "json"
4
+
5
+ module HookSniff
6
+ class ListResponseEndpointOut
7
+ attr_accessor :data
8
+ attr_accessor :done
9
+ attr_accessor :iterator
10
+ attr_accessor :prev_iterator
11
+
12
+ ALL_FIELD ||= ["data", "done", "iterator", "prev_iterator"].freeze
13
+ private_constant :ALL_FIELD
14
+
15
+ def initialize(attributes = {})
16
+ unless attributes.is_a?(Hash)
17
+ fail(
18
+ ArgumentError,
19
+ "The input argument (attributes) must be a hash in `HookSniff::ListResponseEndpointOut` new method"
20
+ )
21
+ end
22
+
23
+ attributes.each do |k, v|
24
+ unless ALL_FIELD.include?(k.to_s)
25
+ fail(ArgumentError, "The field #{k} is not part of HookSniff::ListResponseEndpointOut")
26
+ end
27
+
28
+ instance_variable_set("@#{k}", v)
29
+ instance_variable_set("@__#{k}_is_defined", true)
30
+ end
31
+ end
32
+
33
+ def self.deserialize(attributes = {})
34
+ attributes = attributes.transform_keys(&:to_s)
35
+ attrs = Hash.new
36
+ attrs["data"] = attributes["data"].map { |v| HookSniff::EndpointOut.deserialize(v) }
37
+ attrs["done"] = attributes["done"]
38
+ attrs["iterator"] = attributes["iterator"]
39
+ attrs["prev_iterator"] = attributes["prevIterator"]
40
+ new(attrs)
41
+ end
42
+
43
+ def serialize
44
+ out = Hash.new
45
+ out["data"] = @data.map { |v| v.serialize } if @data
46
+ out["done"] = HookSniff::serialize_primitive(@done) if @done
47
+ out["iterator"] = HookSniff::serialize_primitive(@iterator) if @iterator
48
+ out["prevIterator"] = HookSniff::serialize_primitive(@prev_iterator) if @prev_iterator
49
+ out
50
+ end
51
+
52
+ # Serializes the object to a json string
53
+ # @return String
54
+ def to_json
55
+ JSON.dump(serialize)
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+ # This file is @generated
3
+ require "json"
4
+
5
+ module HookSniff
6
+ class ListResponseEventTypeOut
7
+ attr_accessor :data
8
+ attr_accessor :done
9
+ attr_accessor :iterator
10
+ attr_accessor :prev_iterator
11
+
12
+ ALL_FIELD ||= ["data", "done", "iterator", "prev_iterator"].freeze
13
+ private_constant :ALL_FIELD
14
+
15
+ def initialize(attributes = {})
16
+ unless attributes.is_a?(Hash)
17
+ fail(
18
+ ArgumentError,
19
+ "The input argument (attributes) must be a hash in `HookSniff::ListResponseEventTypeOut` new method"
20
+ )
21
+ end
22
+
23
+ attributes.each do |k, v|
24
+ unless ALL_FIELD.include?(k.to_s)
25
+ fail(ArgumentError, "The field #{k} is not part of HookSniff::ListResponseEventTypeOut")
26
+ end
27
+
28
+ instance_variable_set("@#{k}", v)
29
+ instance_variable_set("@__#{k}_is_defined", true)
30
+ end
31
+ end
32
+
33
+ def self.deserialize(attributes = {})
34
+ attributes = attributes.transform_keys(&:to_s)
35
+ attrs = Hash.new
36
+ attrs["data"] = attributes["data"].map { |v| HookSniff::EventTypeOut.deserialize(v) }
37
+ attrs["done"] = attributes["done"]
38
+ attrs["iterator"] = attributes["iterator"]
39
+ attrs["prev_iterator"] = attributes["prevIterator"]
40
+ new(attrs)
41
+ end
42
+
43
+ def serialize
44
+ out = Hash.new
45
+ out["data"] = @data.map { |v| v.serialize } if @data
46
+ out["done"] = HookSniff::serialize_primitive(@done) if @done
47
+ out["iterator"] = HookSniff::serialize_primitive(@iterator) if @iterator
48
+ out["prevIterator"] = HookSniff::serialize_primitive(@prev_iterator) if @prev_iterator
49
+ out
50
+ end
51
+
52
+ # Serializes the object to a json string
53
+ # @return String
54
+ def to_json
55
+ JSON.dump(serialize)
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+ # This file is @generated
3
+ require "json"
4
+
5
+ module HookSniff
6
+ class ListResponseMessageAttemptOut
7
+ attr_accessor :data
8
+ attr_accessor :done
9
+ attr_accessor :iterator
10
+ attr_accessor :prev_iterator
11
+
12
+ ALL_FIELD ||= ["data", "done", "iterator", "prev_iterator"].freeze
13
+ private_constant :ALL_FIELD
14
+
15
+ def initialize(attributes = {})
16
+ unless attributes.is_a?(Hash)
17
+ fail(
18
+ ArgumentError,
19
+ "The input argument (attributes) must be a hash in `HookSniff::ListResponseMessageAttemptOut` new method"
20
+ )
21
+ end
22
+
23
+ attributes.each do |k, v|
24
+ unless ALL_FIELD.include?(k.to_s)
25
+ fail(ArgumentError, "The field #{k} is not part of HookSniff::ListResponseMessageAttemptOut")
26
+ end
27
+
28
+ instance_variable_set("@#{k}", v)
29
+ instance_variable_set("@__#{k}_is_defined", true)
30
+ end
31
+ end
32
+
33
+ def self.deserialize(attributes = {})
34
+ attributes = attributes.transform_keys(&:to_s)
35
+ attrs = Hash.new
36
+ attrs["data"] = attributes["data"].map { |v| HookSniff::MessageAttemptOut.deserialize(v) }
37
+ attrs["done"] = attributes["done"]
38
+ attrs["iterator"] = attributes["iterator"]
39
+ attrs["prev_iterator"] = attributes["prevIterator"]
40
+ new(attrs)
41
+ end
42
+
43
+ def serialize
44
+ out = Hash.new
45
+ out["data"] = @data.map { |v| v.serialize } if @data
46
+ out["done"] = HookSniff::serialize_primitive(@done) if @done
47
+ out["iterator"] = HookSniff::serialize_primitive(@iterator) if @iterator
48
+ out["prevIterator"] = HookSniff::serialize_primitive(@prev_iterator) if @prev_iterator
49
+ out
50
+ end
51
+
52
+ # Serializes the object to a json string
53
+ # @return String
54
+ def to_json
55
+ JSON.dump(serialize)
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+ # This file is @generated
3
+ require "json"
4
+
5
+ module HookSniff
6
+ class ListResponseMessageOut
7
+ attr_accessor :data
8
+ attr_accessor :done
9
+ attr_accessor :iterator
10
+ attr_accessor :prev_iterator
11
+
12
+ ALL_FIELD ||= ["data", "done", "iterator", "prev_iterator"].freeze
13
+ private_constant :ALL_FIELD
14
+
15
+ def initialize(attributes = {})
16
+ unless attributes.is_a?(Hash)
17
+ fail(
18
+ ArgumentError,
19
+ "The input argument (attributes) must be a hash in `HookSniff::ListResponseMessageOut` new method"
20
+ )
21
+ end
22
+
23
+ attributes.each do |k, v|
24
+ unless ALL_FIELD.include?(k.to_s)
25
+ fail(ArgumentError, "The field #{k} is not part of HookSniff::ListResponseMessageOut")
26
+ end
27
+
28
+ instance_variable_set("@#{k}", v)
29
+ instance_variable_set("@__#{k}_is_defined", true)
30
+ end
31
+ end
32
+
33
+ def self.deserialize(attributes = {})
34
+ attributes = attributes.transform_keys(&:to_s)
35
+ attrs = Hash.new
36
+ attrs["data"] = attributes["data"].map { |v| HookSniff::MessageOut.deserialize(v) }
37
+ attrs["done"] = attributes["done"]
38
+ attrs["iterator"] = attributes["iterator"]
39
+ attrs["prev_iterator"] = attributes["prevIterator"]
40
+ new(attrs)
41
+ end
42
+
43
+ def serialize
44
+ out = Hash.new
45
+ out["data"] = @data.map { |v| v.serialize } if @data
46
+ out["done"] = HookSniff::serialize_primitive(@done) if @done
47
+ out["iterator"] = HookSniff::serialize_primitive(@iterator) if @iterator
48
+ out["prevIterator"] = HookSniff::serialize_primitive(@prev_iterator) if @prev_iterator
49
+ out
50
+ end
51
+
52
+ # Serializes the object to a json string
53
+ # @return String
54
+ def to_json
55
+ JSON.dump(serialize)
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+ # This file is @generated
3
+ require "json"
4
+
5
+ module HookSniff
6
+ # Sent when a message delivery has failed (all of the retry attempts have been exhausted).
7
+ class MessageAttemptExhaustedEvent
8
+ attr_accessor :data
9
+ attr_accessor :type
10
+
11
+ ALL_FIELD ||= ["data", "type"].freeze
12
+ private_constant :ALL_FIELD
13
+
14
+ def initialize(attributes = {})
15
+ unless attributes.is_a?(Hash)
16
+ fail(
17
+ ArgumentError,
18
+ "The input argument (attributes) must be a hash in `HookSniff::MessageAttemptExhaustedEvent` new method"
19
+ )
20
+ end
21
+
22
+ attributes.each do |k, v|
23
+ unless ALL_FIELD.include?(k.to_s)
24
+ fail(ArgumentError, "The field #{k} is not part of HookSniff::MessageAttemptExhaustedEvent")
25
+ end
26
+
27
+ instance_variable_set("@#{k}", v)
28
+ instance_variable_set("@__#{k}_is_defined", true)
29
+ end
30
+ end
31
+
32
+ def self.deserialize(attributes = {})
33
+ attributes = attributes.transform_keys(&:to_s)
34
+ attrs = Hash.new
35
+ attrs["data"] = HookSniff::MessageAttemptExhaustedEventData.deserialize(attributes["data"])
36
+ attrs["type"] = attributes["type"]
37
+ new(attrs)
38
+ end
39
+
40
+ def serialize
41
+ out = Hash.new
42
+ out["data"] = HookSniff::serialize_schema_ref(@data) if @data
43
+ out["type"] = HookSniff::serialize_primitive(@type) if @type
44
+ out
45
+ end
46
+
47
+ # Serializes the object to a json string
48
+ # @return String
49
+ def to_json
50
+ JSON.dump(serialize)
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,70 @@
1
+ # frozen_string_literal: true
2
+ # This file is @generated
3
+ require "json"
4
+
5
+ module HookSniff
6
+ # 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.
7
+ class MessageAttemptExhaustedEventData
8
+ # The Application's ID.
9
+ attr_accessor :app_id
10
+ # The Application's UID.
11
+ attr_accessor :app_uid
12
+ # The Endpoint's ID.
13
+ attr_accessor :endpoint_id
14
+ attr_accessor :last_attempt
15
+ # The Message's UID.
16
+ attr_accessor :msg_event_id
17
+ # The Message's ID.
18
+ attr_accessor :msg_id
19
+
20
+ ALL_FIELD ||= ["app_id", "app_uid", "endpoint_id", "last_attempt", "msg_event_id", "msg_id"].freeze
21
+ private_constant :ALL_FIELD
22
+
23
+ def initialize(attributes = {})
24
+ unless attributes.is_a?(Hash)
25
+ fail(
26
+ ArgumentError,
27
+ "The input argument (attributes) must be a hash in `HookSniff::MessageAttemptExhaustedEventData` new method"
28
+ )
29
+ end
30
+
31
+ attributes.each do |k, v|
32
+ unless ALL_FIELD.include?(k.to_s)
33
+ fail(ArgumentError, "The field #{k} is not part of HookSniff::MessageAttemptExhaustedEventData")
34
+ end
35
+
36
+ instance_variable_set("@#{k}", v)
37
+ instance_variable_set("@__#{k}_is_defined", true)
38
+ end
39
+ end
40
+
41
+ def self.deserialize(attributes = {})
42
+ attributes = attributes.transform_keys(&:to_s)
43
+ attrs = Hash.new
44
+ attrs["app_id"] = attributes["appId"]
45
+ attrs["app_uid"] = attributes["appUid"]
46
+ attrs["endpoint_id"] = attributes["endpointId"]
47
+ attrs["last_attempt"] = HookSniff::MessageAttemptFailedData.deserialize(attributes["lastAttempt"])
48
+ attrs["msg_event_id"] = attributes["msgEventId"]
49
+ attrs["msg_id"] = attributes["msgId"]
50
+ new(attrs)
51
+ end
52
+
53
+ def serialize
54
+ out = Hash.new
55
+ out["appId"] = HookSniff::serialize_primitive(@app_id) if @app_id
56
+ out["appUid"] = HookSniff::serialize_primitive(@app_uid) if @app_uid
57
+ out["endpointId"] = HookSniff::serialize_primitive(@endpoint_id) if @endpoint_id
58
+ out["lastAttempt"] = HookSniff::serialize_schema_ref(@last_attempt) if @last_attempt
59
+ out["msgEventId"] = HookSniff::serialize_primitive(@msg_event_id) if @msg_event_id
60
+ out["msgId"] = HookSniff::serialize_primitive(@msg_id) if @msg_id
61
+ out
62
+ end
63
+
64
+ # Serializes the object to a json string
65
+ # @return String
66
+ def to_json
67
+ JSON.dump(serialize)
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+ # This file is @generated
3
+ require "json"
4
+
5
+ module HookSniff
6
+ class MessageAttemptFailedData
7
+ # The MessageAttempt's ID.
8
+ attr_accessor :id
9
+ attr_accessor :response_status_code
10
+ attr_accessor :timestamp
11
+
12
+ ALL_FIELD ||= ["id", "response_status_code", "timestamp"].freeze
13
+ private_constant :ALL_FIELD
14
+
15
+ def initialize(attributes = {})
16
+ unless attributes.is_a?(Hash)
17
+ fail(
18
+ ArgumentError,
19
+ "The input argument (attributes) must be a hash in `HookSniff::MessageAttemptFailedData` new method"
20
+ )
21
+ end
22
+
23
+ attributes.each do |k, v|
24
+ unless ALL_FIELD.include?(k.to_s)
25
+ fail(ArgumentError, "The field #{k} is not part of HookSniff::MessageAttemptFailedData")
26
+ end
27
+
28
+ instance_variable_set("@#{k}", v)
29
+ instance_variable_set("@__#{k}_is_defined", true)
30
+ end
31
+ end
32
+
33
+ def self.deserialize(attributes = {})
34
+ attributes = attributes.transform_keys(&:to_s)
35
+ attrs = Hash.new
36
+ attrs["id"] = attributes["id"]
37
+ attrs["response_status_code"] = attributes["responseStatusCode"]
38
+ attrs["timestamp"] = DateTime.rfc3339(attributes["timestamp"]).to_time
39
+ new(attrs)
40
+ end
41
+
42
+ def serialize
43
+ out = Hash.new
44
+ out["id"] = HookSniff::serialize_primitive(@id) if @id
45
+ out["responseStatusCode"] = HookSniff::serialize_primitive(@response_status_code) if @response_status_code
46
+ out["timestamp"] = HookSniff::serialize_primitive(@timestamp) if @timestamp
47
+ out
48
+ end
49
+
50
+ # Serializes the object to a json string
51
+ # @return String
52
+ def to_json
53
+ JSON.dump(serialize)
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+ # This file is @generated
3
+ require "json"
4
+
5
+ module HookSniff
6
+ # Sent after a message has been failing for a few times.
7
+ # It's sent on the fourth failure. It complements `message.attempt.exhausted` which is sent after the last failure.
8
+ class MessageAttemptFailingEvent
9
+ attr_accessor :data
10
+ attr_accessor :type
11
+
12
+ ALL_FIELD ||= ["data", "type"].freeze
13
+ private_constant :ALL_FIELD
14
+
15
+ def initialize(attributes = {})
16
+ unless attributes.is_a?(Hash)
17
+ fail(
18
+ ArgumentError,
19
+ "The input argument (attributes) must be a hash in `HookSniff::MessageAttemptFailingEvent` new method"
20
+ )
21
+ end
22
+
23
+ attributes.each do |k, v|
24
+ unless ALL_FIELD.include?(k.to_s)
25
+ fail(ArgumentError, "The field #{k} is not part of HookSniff::MessageAttemptFailingEvent")
26
+ end
27
+
28
+ instance_variable_set("@#{k}", v)
29
+ instance_variable_set("@__#{k}_is_defined", true)
30
+ end
31
+ end
32
+
33
+ def self.deserialize(attributes = {})
34
+ attributes = attributes.transform_keys(&:to_s)
35
+ attrs = Hash.new
36
+ attrs["data"] = HookSniff::MessageAttemptFailingEventData.deserialize(attributes["data"])
37
+ attrs["type"] = attributes["type"]
38
+ new(attrs)
39
+ end
40
+
41
+ def serialize
42
+ out = Hash.new
43
+ out["data"] = HookSniff::serialize_schema_ref(@data) if @data
44
+ out["type"] = HookSniff::serialize_primitive(@type) if @type
45
+ out
46
+ end
47
+
48
+ # Serializes the object to a json string
49
+ # @return String
50
+ def to_json
51
+ JSON.dump(serialize)
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,70 @@
1
+ # frozen_string_literal: true
2
+ # This file is @generated
3
+ require "json"
4
+
5
+ module HookSniff
6
+ # 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.
7
+ class MessageAttemptFailingEventData
8
+ # The Application's ID.
9
+ attr_accessor :app_id
10
+ # The Application's UID.
11
+ attr_accessor :app_uid
12
+ # The Endpoint's ID.
13
+ attr_accessor :endpoint_id
14
+ attr_accessor :last_attempt
15
+ # The Message's UID.
16
+ attr_accessor :msg_event_id
17
+ # The Message's ID.
18
+ attr_accessor :msg_id
19
+
20
+ ALL_FIELD ||= ["app_id", "app_uid", "endpoint_id", "last_attempt", "msg_event_id", "msg_id"].freeze
21
+ private_constant :ALL_FIELD
22
+
23
+ def initialize(attributes = {})
24
+ unless attributes.is_a?(Hash)
25
+ fail(
26
+ ArgumentError,
27
+ "The input argument (attributes) must be a hash in `HookSniff::MessageAttemptFailingEventData` new method"
28
+ )
29
+ end
30
+
31
+ attributes.each do |k, v|
32
+ unless ALL_FIELD.include?(k.to_s)
33
+ fail(ArgumentError, "The field #{k} is not part of HookSniff::MessageAttemptFailingEventData")
34
+ end
35
+
36
+ instance_variable_set("@#{k}", v)
37
+ instance_variable_set("@__#{k}_is_defined", true)
38
+ end
39
+ end
40
+
41
+ def self.deserialize(attributes = {})
42
+ attributes = attributes.transform_keys(&:to_s)
43
+ attrs = Hash.new
44
+ attrs["app_id"] = attributes["appId"]
45
+ attrs["app_uid"] = attributes["appUid"]
46
+ attrs["endpoint_id"] = attributes["endpointId"]
47
+ attrs["last_attempt"] = HookSniff::MessageAttemptFailedData.deserialize(attributes["lastAttempt"])
48
+ attrs["msg_event_id"] = attributes["msgEventId"]
49
+ attrs["msg_id"] = attributes["msgId"]
50
+ new(attrs)
51
+ end
52
+
53
+ def serialize
54
+ out = Hash.new
55
+ out["appId"] = HookSniff::serialize_primitive(@app_id) if @app_id
56
+ out["appUid"] = HookSniff::serialize_primitive(@app_uid) if @app_uid
57
+ out["endpointId"] = HookSniff::serialize_primitive(@endpoint_id) if @endpoint_id
58
+ out["lastAttempt"] = HookSniff::serialize_schema_ref(@last_attempt) if @last_attempt
59
+ out["msgEventId"] = HookSniff::serialize_primitive(@msg_event_id) if @msg_event_id
60
+ out["msgId"] = HookSniff::serialize_primitive(@msg_id) if @msg_id
61
+ out
62
+ end
63
+
64
+ # Serializes the object to a json string
65
+ # @return String
66
+ def to_json
67
+ JSON.dump(serialize)
68
+ end
69
+ end
70
+ end