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.
- checksums.yaml +4 -4
- data/Gemfile +7 -0
- data/Gemfile.lock +56 -0
- data/README.md +24 -197
- data/Rakefile +2 -0
- data/hooksniff.gemspec +48 -0
- data/lib/hooksniff/api/authentication.rb +36 -0
- data/lib/hooksniff/api/endpoint.rb +102 -0
- data/lib/hooksniff/api/event_type.rb +66 -0
- data/lib/hooksniff/api/health.rb +16 -0
- data/lib/hooksniff/api/message.rb +48 -0
- data/lib/hooksniff/api/message_attempt.rb +38 -0
- data/lib/hooksniff/api/statistics.rb +37 -0
- data/lib/hooksniff/api_error.rb +48 -0
- data/lib/hooksniff/errors.rb +107 -21
- data/lib/hooksniff/hooksniff.rb +36 -0
- data/lib/hooksniff/hooksniff_http_client.rb +128 -0
- data/lib/hooksniff/http_error_out.rb +18 -0
- data/lib/hooksniff/http_validation_error.rb +18 -0
- data/lib/hooksniff/internal.rb +7 -0
- data/lib/hooksniff/models/aggregate_event_types_out.rb +59 -0
- data/lib/hooksniff/models/endpoint_created_event.rb +50 -0
- data/lib/hooksniff/models/endpoint_created_event_data.rb +63 -0
- data/lib/hooksniff/models/endpoint_deleted_event.rb +50 -0
- data/lib/hooksniff/models/endpoint_deleted_event_data.rb +63 -0
- data/lib/hooksniff/models/endpoint_disabled_event.rb +53 -0
- data/lib/hooksniff/models/endpoint_disabled_event_data.rb +69 -0
- data/lib/hooksniff/models/endpoint_enabled_event.rb +50 -0
- data/lib/hooksniff/models/endpoint_enabled_event_data.rb +63 -0
- data/lib/hooksniff/models/endpoint_headers_in.rb +46 -0
- data/lib/hooksniff/models/endpoint_headers_out.rb +52 -0
- data/lib/hooksniff/models/endpoint_headers_patch_in.rb +53 -0
- data/lib/hooksniff/models/endpoint_in.rb +102 -0
- data/lib/hooksniff/models/endpoint_out.rb +104 -0
- data/lib/hooksniff/models/endpoint_patch.rb +97 -0
- data/lib/hooksniff/models/endpoint_secret_out.rb +50 -0
- data/lib/hooksniff/models/endpoint_secret_rotate_in.rb +53 -0
- data/lib/hooksniff/models/endpoint_update.rb +90 -0
- data/lib/hooksniff/models/endpoint_updated_event.rb +50 -0
- data/lib/hooksniff/models/endpoint_updated_event_data.rb +63 -0
- data/lib/hooksniff/models/event_in.rb +50 -0
- data/lib/hooksniff/models/event_out.rb +53 -0
- data/lib/hooksniff/models/event_type_in.rb +80 -0
- data/lib/hooksniff/models/event_type_out.rb +87 -0
- data/lib/hooksniff/models/event_type_patch.rb +66 -0
- data/lib/hooksniff/models/event_type_update.rb +67 -0
- data/lib/hooksniff/models/list_response_endpoint_out.rb +58 -0
- data/lib/hooksniff/models/list_response_event_type_out.rb +58 -0
- data/lib/hooksniff/models/list_response_message_attempt_out.rb +58 -0
- data/lib/hooksniff/models/list_response_message_out.rb +58 -0
- data/lib/hooksniff/models/message_attempt_exhausted_event.rb +53 -0
- data/lib/hooksniff/models/message_attempt_exhausted_event_data.rb +70 -0
- data/lib/hooksniff/models/message_attempt_failed_data.rb +56 -0
- data/lib/hooksniff/models/message_attempt_failing_event.rb +54 -0
- data/lib/hooksniff/models/message_attempt_failing_event_data.rb +70 -0
- data/lib/hooksniff/models/message_attempt_log.rb +112 -0
- data/lib/hooksniff/models/message_attempt_log_event.rb +53 -0
- data/lib/hooksniff/models/message_attempt_out.rb +96 -0
- data/lib/hooksniff/models/message_attempt_recovered_event.rb +53 -0
- data/lib/hooksniff/models/message_attempt_recovered_event_data.rb +70 -0
- data/lib/hooksniff/models/message_attempt_trigger_type.rb +33 -0
- data/lib/hooksniff/models/message_endpoint_out.rb +112 -0
- data/lib/hooksniff/models/message_in.rb +100 -0
- data/lib/hooksniff/models/message_out.rb +71 -0
- data/lib/hooksniff/models/message_status.rb +39 -0
- data/lib/hooksniff/models/message_status_text.rb +32 -0
- data/lib/hooksniff/models/ordering.rb +30 -0
- data/lib/hooksniff/models/status_code_class.rb +41 -0
- data/lib/hooksniff/util.rb +69 -0
- data/lib/hooksniff/validation_error.rb +28 -0
- data/lib/hooksniff/version.rb +1 -1
- data/lib/hooksniff/webhook.rb +84 -0
- data/lib/hooksniff.rb +71 -12
- data/test/test_hooksniff.rb +86 -0
- metadata +124 -31
- data/lib/hooksniff/client.rb +0 -213
- data/lib/hooksniff/models.rb +0 -136
- data/lib/hooksniff/verification.rb +0 -134
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# This file is @generated
|
|
3
|
+
require "json"
|
|
4
|
+
|
|
5
|
+
module HookSniff
|
|
6
|
+
class MessageAttemptLog
|
|
7
|
+
# The Application's ID.
|
|
8
|
+
attr_accessor :app_id
|
|
9
|
+
# The Application's UID.
|
|
10
|
+
attr_accessor :app_uid
|
|
11
|
+
attr_accessor :attempt_count
|
|
12
|
+
attr_accessor :attempt_end
|
|
13
|
+
# The MessageAttempt's ID.
|
|
14
|
+
attr_accessor :attempt_id
|
|
15
|
+
attr_accessor :attempt_start
|
|
16
|
+
# The Endpoint's ID.
|
|
17
|
+
attr_accessor :endpoint_id
|
|
18
|
+
# The event type's name
|
|
19
|
+
attr_accessor :event_type
|
|
20
|
+
attr_accessor :http_times
|
|
21
|
+
attr_accessor :msg_created
|
|
22
|
+
# The Message's UID.
|
|
23
|
+
attr_accessor :msg_event_id
|
|
24
|
+
# The Message's ID.
|
|
25
|
+
attr_accessor :msg_id
|
|
26
|
+
# The Environment's ID.
|
|
27
|
+
attr_accessor :org_id
|
|
28
|
+
attr_accessor :response_status_code
|
|
29
|
+
attr_accessor :status
|
|
30
|
+
|
|
31
|
+
ALL_FIELD ||= [
|
|
32
|
+
"app_id",
|
|
33
|
+
"app_uid",
|
|
34
|
+
"attempt_count",
|
|
35
|
+
"attempt_end",
|
|
36
|
+
"attempt_id",
|
|
37
|
+
"attempt_start",
|
|
38
|
+
"endpoint_id",
|
|
39
|
+
"event_type",
|
|
40
|
+
"http_times",
|
|
41
|
+
"msg_created",
|
|
42
|
+
"msg_event_id",
|
|
43
|
+
"msg_id",
|
|
44
|
+
"org_id",
|
|
45
|
+
"response_status_code",
|
|
46
|
+
"status"
|
|
47
|
+
].freeze
|
|
48
|
+
private_constant :ALL_FIELD
|
|
49
|
+
|
|
50
|
+
def initialize(attributes = {})
|
|
51
|
+
unless attributes.is_a?(Hash)
|
|
52
|
+
fail(ArgumentError, "The input argument (attributes) must be a hash in `HookSniff::MessageAttemptLog` new method")
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
attributes.each do |k, v|
|
|
56
|
+
unless ALL_FIELD.include?(k.to_s)
|
|
57
|
+
fail(ArgumentError, "The field #{k} is not part of HookSniff::MessageAttemptLog")
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
instance_variable_set("@#{k}", v)
|
|
61
|
+
instance_variable_set("@__#{k}_is_defined", true)
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def self.deserialize(attributes = {})
|
|
66
|
+
attributes = attributes.transform_keys(&:to_s)
|
|
67
|
+
attrs = Hash.new
|
|
68
|
+
attrs["app_id"] = attributes["appId"]
|
|
69
|
+
attrs["app_uid"] = attributes["appUid"]
|
|
70
|
+
attrs["attempt_count"] = attributes["attemptCount"]
|
|
71
|
+
attrs["attempt_end"] = DateTime.rfc3339(attributes["attemptEnd"]).to_time
|
|
72
|
+
attrs["attempt_id"] = attributes["attemptId"]
|
|
73
|
+
attrs["attempt_start"] = DateTime.rfc3339(attributes["attemptStart"]).to_time
|
|
74
|
+
attrs["endpoint_id"] = attributes["endpointId"]
|
|
75
|
+
attrs["event_type"] = attributes["eventType"]
|
|
76
|
+
attrs["http_times"] = HookSniff::HttpAttemptTimes.deserialize(attributes["httpTimes"]) if attributes["httpTimes"]
|
|
77
|
+
attrs["msg_created"] = DateTime.rfc3339(attributes["msgCreated"]).to_time
|
|
78
|
+
attrs["msg_event_id"] = attributes["msgEventId"]
|
|
79
|
+
attrs["msg_id"] = attributes["msgId"]
|
|
80
|
+
attrs["org_id"] = attributes["orgId"]
|
|
81
|
+
attrs["response_status_code"] = attributes["responseStatusCode"]
|
|
82
|
+
attrs["status"] = HookSniff::MessageStatus.deserialize(attributes["status"])
|
|
83
|
+
new(attrs)
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def serialize
|
|
87
|
+
out = Hash.new
|
|
88
|
+
out["appId"] = HookSniff::serialize_primitive(@app_id) if @app_id
|
|
89
|
+
out["appUid"] = HookSniff::serialize_primitive(@app_uid) if @app_uid
|
|
90
|
+
out["attemptCount"] = HookSniff::serialize_primitive(@attempt_count) if @attempt_count
|
|
91
|
+
out["attemptEnd"] = HookSniff::serialize_primitive(@attempt_end) if @attempt_end
|
|
92
|
+
out["attemptId"] = HookSniff::serialize_primitive(@attempt_id) if @attempt_id
|
|
93
|
+
out["attemptStart"] = HookSniff::serialize_primitive(@attempt_start) if @attempt_start
|
|
94
|
+
out["endpointId"] = HookSniff::serialize_primitive(@endpoint_id) if @endpoint_id
|
|
95
|
+
out["eventType"] = HookSniff::serialize_primitive(@event_type) if @event_type
|
|
96
|
+
out["httpTimes"] = HookSniff::serialize_schema_ref(@http_times) if @http_times
|
|
97
|
+
out["msgCreated"] = HookSniff::serialize_primitive(@msg_created) if @msg_created
|
|
98
|
+
out["msgEventId"] = HookSniff::serialize_primitive(@msg_event_id) if @msg_event_id
|
|
99
|
+
out["msgId"] = HookSniff::serialize_primitive(@msg_id) if @msg_id
|
|
100
|
+
out["orgId"] = HookSniff::serialize_primitive(@org_id) if @org_id
|
|
101
|
+
out["responseStatusCode"] = HookSniff::serialize_primitive(@response_status_code) if @response_status_code
|
|
102
|
+
out["status"] = HookSniff::serialize_schema_ref(@status) if @status
|
|
103
|
+
out
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
# Serializes the object to a json string
|
|
107
|
+
# @return String
|
|
108
|
+
def to_json
|
|
109
|
+
JSON.dump(serialize)
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
end
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# This file is @generated
|
|
3
|
+
require "json"
|
|
4
|
+
|
|
5
|
+
module HookSniff
|
|
6
|
+
# Sent after message attempts are made. Contains metadata about message attempts and their results. In order to reduce the frequency of webhooks, these are sent in batches periodically.
|
|
7
|
+
class MessageAttemptLogEvent
|
|
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::MessageAttemptLogEvent` 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::MessageAttemptLogEvent")
|
|
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"] = attributes["data"].map { |v| HookSniff::MessageAttemptLog.deserialize(v) }
|
|
36
|
+
attrs["type"] = attributes["type"]
|
|
37
|
+
new(attrs)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def serialize
|
|
41
|
+
out = Hash.new
|
|
42
|
+
out["data"] = @data.map { |v| v.serialize } 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,96 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# This file is @generated
|
|
3
|
+
require "json"
|
|
4
|
+
|
|
5
|
+
module HookSniff
|
|
6
|
+
class MessageAttemptOut
|
|
7
|
+
# The Endpoint's ID.
|
|
8
|
+
attr_accessor :endpoint_id
|
|
9
|
+
# The MessageAttempt's ID.
|
|
10
|
+
attr_accessor :id
|
|
11
|
+
attr_accessor :msg
|
|
12
|
+
# The Message's ID.
|
|
13
|
+
attr_accessor :msg_id
|
|
14
|
+
attr_accessor :response
|
|
15
|
+
# Response duration in milliseconds.
|
|
16
|
+
attr_accessor :response_duration_ms
|
|
17
|
+
attr_accessor :response_status_code
|
|
18
|
+
attr_accessor :status
|
|
19
|
+
attr_accessor :status_text
|
|
20
|
+
attr_accessor :timestamp
|
|
21
|
+
attr_accessor :trigger_type
|
|
22
|
+
attr_accessor :url
|
|
23
|
+
|
|
24
|
+
ALL_FIELD ||= [
|
|
25
|
+
"endpoint_id",
|
|
26
|
+
"id",
|
|
27
|
+
"msg",
|
|
28
|
+
"msg_id",
|
|
29
|
+
"response",
|
|
30
|
+
"response_duration_ms",
|
|
31
|
+
"response_status_code",
|
|
32
|
+
"status",
|
|
33
|
+
"status_text",
|
|
34
|
+
"timestamp",
|
|
35
|
+
"trigger_type",
|
|
36
|
+
"url"
|
|
37
|
+
].freeze
|
|
38
|
+
private_constant :ALL_FIELD
|
|
39
|
+
|
|
40
|
+
def initialize(attributes = {})
|
|
41
|
+
unless attributes.is_a?(Hash)
|
|
42
|
+
fail(ArgumentError, "The input argument (attributes) must be a hash in `HookSniff::MessageAttemptOut` new method")
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
attributes.each do |k, v|
|
|
46
|
+
unless ALL_FIELD.include?(k.to_s)
|
|
47
|
+
fail(ArgumentError, "The field #{k} is not part of HookSniff::MessageAttemptOut")
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
instance_variable_set("@#{k}", v)
|
|
51
|
+
instance_variable_set("@__#{k}_is_defined", true)
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def self.deserialize(attributes = {})
|
|
56
|
+
attributes = attributes.transform_keys(&:to_s)
|
|
57
|
+
attrs = Hash.new
|
|
58
|
+
attrs["endpoint_id"] = attributes["endpointId"]
|
|
59
|
+
attrs["id"] = attributes["id"]
|
|
60
|
+
attrs["msg"] = HookSniff::MessageOut.deserialize(attributes["msg"]) if attributes["msg"]
|
|
61
|
+
attrs["msg_id"] = attributes["msgId"]
|
|
62
|
+
attrs["response"] = attributes["response"]
|
|
63
|
+
attrs["response_duration_ms"] = attributes["responseDurationMs"]
|
|
64
|
+
attrs["response_status_code"] = attributes["responseStatusCode"]
|
|
65
|
+
attrs["status"] = HookSniff::MessageStatus.deserialize(attributes["status"])
|
|
66
|
+
attrs["status_text"] = HookSniff::MessageStatusText.deserialize(attributes["statusText"])
|
|
67
|
+
attrs["timestamp"] = DateTime.rfc3339(attributes["timestamp"]).to_time
|
|
68
|
+
attrs["trigger_type"] = HookSniff::MessageAttemptTriggerType.deserialize(attributes["triggerType"])
|
|
69
|
+
attrs["url"] = attributes["url"]
|
|
70
|
+
new(attrs)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def serialize
|
|
74
|
+
out = Hash.new
|
|
75
|
+
out["endpointId"] = HookSniff::serialize_primitive(@endpoint_id) if @endpoint_id
|
|
76
|
+
out["id"] = HookSniff::serialize_primitive(@id) if @id
|
|
77
|
+
out["msg"] = HookSniff::serialize_schema_ref(@msg) if @msg
|
|
78
|
+
out["msgId"] = HookSniff::serialize_primitive(@msg_id) if @msg_id
|
|
79
|
+
out["response"] = HookSniff::serialize_primitive(@response) if @response
|
|
80
|
+
out["responseDurationMs"] = HookSniff::serialize_primitive(@response_duration_ms) if @response_duration_ms
|
|
81
|
+
out["responseStatusCode"] = HookSniff::serialize_primitive(@response_status_code) if @response_status_code
|
|
82
|
+
out["status"] = HookSniff::serialize_schema_ref(@status) if @status
|
|
83
|
+
out["statusText"] = HookSniff::serialize_schema_ref(@status_text) if @status_text
|
|
84
|
+
out["timestamp"] = HookSniff::serialize_primitive(@timestamp) if @timestamp
|
|
85
|
+
out["triggerType"] = HookSniff::serialize_schema_ref(@trigger_type) if @trigger_type
|
|
86
|
+
out["url"] = HookSniff::serialize_primitive(@url) if @url
|
|
87
|
+
out
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# Serializes the object to a json string
|
|
91
|
+
# @return String
|
|
92
|
+
def to_json
|
|
93
|
+
JSON.dump(serialize)
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
end
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# This file is @generated
|
|
3
|
+
require "json"
|
|
4
|
+
|
|
5
|
+
module HookSniff
|
|
6
|
+
# Sent on a successful dispatch after an earlier failure op webhook has already been sent.
|
|
7
|
+
class MessageAttemptRecoveredEvent
|
|
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::MessageAttemptRecoveredEvent` 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::MessageAttemptRecoveredEvent")
|
|
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::MessageAttemptRecoveredEventData.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 MessageAttemptRecoveredEventData
|
|
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::MessageAttemptRecoveredEventData` 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::MessageAttemptRecoveredEventData")
|
|
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,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# This file is @generated
|
|
3
|
+
module HookSniff
|
|
4
|
+
# The reason an attempt was made:
|
|
5
|
+
#
|
|
6
|
+
# - Scheduled = 0
|
|
7
|
+
# - Manual = 1
|
|
8
|
+
class MessageAttemptTriggerType
|
|
9
|
+
SCHEDULED = 0.freeze
|
|
10
|
+
MANUAL = 1.freeze
|
|
11
|
+
|
|
12
|
+
def self.all_vars
|
|
13
|
+
@all_vars ||= [SCHEDULED, MANUAL].freeze
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def initialize(value)
|
|
17
|
+
unless MessageAttemptTriggerType.all_vars.include?(value)
|
|
18
|
+
raise "Invalid ENUM value '#{value}' for class #MessageAttemptTriggerType"
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
@value = value
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def self.deserialize(value)
|
|
25
|
+
return value if MessageAttemptTriggerType.all_vars.include?(value)
|
|
26
|
+
raise "Invalid ENUM value '#{value}' for class #MessageAttemptTriggerType"
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def serialize
|
|
30
|
+
@value
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# This file is @generated
|
|
3
|
+
require "json"
|
|
4
|
+
|
|
5
|
+
module HookSniff
|
|
6
|
+
class MessageEndpointOut
|
|
7
|
+
# List of message channels this endpoint listens to (omit for all).
|
|
8
|
+
attr_accessor :channels
|
|
9
|
+
attr_accessor :created_at
|
|
10
|
+
# An example endpoint name.
|
|
11
|
+
attr_accessor :description
|
|
12
|
+
attr_accessor :disabled
|
|
13
|
+
attr_accessor :filter_types
|
|
14
|
+
# The Endpoint's ID.
|
|
15
|
+
attr_accessor :id
|
|
16
|
+
attr_accessor :next_attempt
|
|
17
|
+
# Deprecated, use `throttleRate` instead.
|
|
18
|
+
attr_accessor :rate_limit
|
|
19
|
+
attr_accessor :status
|
|
20
|
+
attr_accessor :status_text
|
|
21
|
+
# Maximum messages per second to send to this endpoint.
|
|
22
|
+
#
|
|
23
|
+
# Outgoing messages will be throttled to this rate.
|
|
24
|
+
attr_accessor :throttle_rate
|
|
25
|
+
# Optional unique identifier for the endpoint.
|
|
26
|
+
attr_accessor :uid
|
|
27
|
+
attr_accessor :updated_at
|
|
28
|
+
attr_accessor :url
|
|
29
|
+
attr_accessor :version
|
|
30
|
+
|
|
31
|
+
ALL_FIELD ||= [
|
|
32
|
+
"channels",
|
|
33
|
+
"created_at",
|
|
34
|
+
"description",
|
|
35
|
+
"disabled",
|
|
36
|
+
"filter_types",
|
|
37
|
+
"id",
|
|
38
|
+
"next_attempt",
|
|
39
|
+
"rate_limit",
|
|
40
|
+
"status",
|
|
41
|
+
"status_text",
|
|
42
|
+
"throttle_rate",
|
|
43
|
+
"uid",
|
|
44
|
+
"updated_at",
|
|
45
|
+
"url",
|
|
46
|
+
"version"
|
|
47
|
+
].freeze
|
|
48
|
+
private_constant :ALL_FIELD
|
|
49
|
+
|
|
50
|
+
def initialize(attributes = {})
|
|
51
|
+
unless attributes.is_a?(Hash)
|
|
52
|
+
fail(ArgumentError, "The input argument (attributes) must be a hash in `HookSniff::MessageEndpointOut` new method")
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
attributes.each do |k, v|
|
|
56
|
+
unless ALL_FIELD.include?(k.to_s)
|
|
57
|
+
fail(ArgumentError, "The field #{k} is not part of HookSniff::MessageEndpointOut")
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
instance_variable_set("@#{k}", v)
|
|
61
|
+
instance_variable_set("@__#{k}_is_defined", true)
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def self.deserialize(attributes = {})
|
|
66
|
+
attributes = attributes.transform_keys(&:to_s)
|
|
67
|
+
attrs = Hash.new
|
|
68
|
+
attrs["channels"] = attributes["channels"]
|
|
69
|
+
attrs["created_at"] = DateTime.rfc3339(attributes["createdAt"]).to_time
|
|
70
|
+
attrs["description"] = attributes["description"]
|
|
71
|
+
attrs["disabled"] = attributes["disabled"]
|
|
72
|
+
attrs["filter_types"] = attributes["filterTypes"]
|
|
73
|
+
attrs["id"] = attributes["id"]
|
|
74
|
+
attrs["next_attempt"] = DateTime.rfc3339(attributes["nextAttempt"]).to_time if attributes["nextAttempt"]
|
|
75
|
+
attrs["rate_limit"] = attributes["rateLimit"]
|
|
76
|
+
attrs["status"] = HookSniff::MessageStatus.deserialize(attributes["status"])
|
|
77
|
+
attrs["status_text"] = HookSniff::MessageStatusText.deserialize(attributes["statusText"])
|
|
78
|
+
attrs["throttle_rate"] = attributes["throttleRate"]
|
|
79
|
+
attrs["uid"] = attributes["uid"]
|
|
80
|
+
attrs["updated_at"] = DateTime.rfc3339(attributes["updatedAt"]).to_time
|
|
81
|
+
attrs["url"] = attributes["url"]
|
|
82
|
+
attrs["version"] = attributes["version"]
|
|
83
|
+
new(attrs)
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def serialize
|
|
87
|
+
out = Hash.new
|
|
88
|
+
out["channels"] = HookSniff::serialize_primitive(@channels) if @channels
|
|
89
|
+
out["createdAt"] = HookSniff::serialize_primitive(@created_at) if @created_at
|
|
90
|
+
out["description"] = HookSniff::serialize_primitive(@description) if @description
|
|
91
|
+
out["disabled"] = HookSniff::serialize_primitive(@disabled) if @disabled
|
|
92
|
+
out["filterTypes"] = HookSniff::serialize_primitive(@filter_types) if @filter_types
|
|
93
|
+
out["id"] = HookSniff::serialize_primitive(@id) if @id
|
|
94
|
+
out["nextAttempt"] = HookSniff::serialize_primitive(@next_attempt) if @next_attempt
|
|
95
|
+
out["rateLimit"] = HookSniff::serialize_primitive(@rate_limit) if @rate_limit
|
|
96
|
+
out["status"] = HookSniff::serialize_schema_ref(@status) if @status
|
|
97
|
+
out["statusText"] = HookSniff::serialize_schema_ref(@status_text) if @status_text
|
|
98
|
+
out["throttleRate"] = HookSniff::serialize_primitive(@throttle_rate) if @throttle_rate
|
|
99
|
+
out["uid"] = HookSniff::serialize_primitive(@uid) if @uid
|
|
100
|
+
out["updatedAt"] = HookSniff::serialize_primitive(@updated_at) if @updated_at
|
|
101
|
+
out["url"] = HookSniff::serialize_primitive(@url) if @url
|
|
102
|
+
out["version"] = HookSniff::serialize_primitive(@version) if @version
|
|
103
|
+
out
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
# Serializes the object to a json string
|
|
107
|
+
# @return String
|
|
108
|
+
def to_json
|
|
109
|
+
JSON.dump(serialize)
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
end
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# This file is @generated
|
|
3
|
+
require "json"
|
|
4
|
+
|
|
5
|
+
module HookSniff
|
|
6
|
+
class MessageIn
|
|
7
|
+
# Optionally creates a new application alongside the message.
|
|
8
|
+
#
|
|
9
|
+
# If the application id or uid that is used in the path already exists, this argument is ignored.
|
|
10
|
+
attr_accessor :application
|
|
11
|
+
# List of free-form identifiers that endpoints can filter by
|
|
12
|
+
attr_accessor :channels
|
|
13
|
+
# The date and time at which the message will be delivered.
|
|
14
|
+
#
|
|
15
|
+
# Note that this time is best-effort-only. Must be at least one minute and no more than 24 hours in the future.
|
|
16
|
+
attr_accessor :deliver_at
|
|
17
|
+
# Optional unique identifier for the message
|
|
18
|
+
attr_accessor :event_id
|
|
19
|
+
# The event type's name
|
|
20
|
+
attr_accessor :event_type
|
|
21
|
+
# JSON payload to send as the request body of the webhook.
|
|
22
|
+
#
|
|
23
|
+
# We also support sending non-JSON payloads. Please contact us for more information.
|
|
24
|
+
attr_accessor :payload
|
|
25
|
+
# Optional number of hours to retain the message payload. Note that this is mutually exclusive with `payloadRetentionPeriod`.
|
|
26
|
+
attr_accessor :payload_retention_hours
|
|
27
|
+
# Optional number of days to retain the message payload. Defaults to 90. Note that this is mutually exclusive with `payloadRetentionHours`.
|
|
28
|
+
attr_accessor :payload_retention_period
|
|
29
|
+
# List of free-form tags that can be filtered by when listing messages
|
|
30
|
+
attr_accessor :tags
|
|
31
|
+
# Extra parameters to pass to Transformations (for future use)
|
|
32
|
+
attr_accessor :transformations_params
|
|
33
|
+
|
|
34
|
+
ALL_FIELD ||= [
|
|
35
|
+
"application",
|
|
36
|
+
"channels",
|
|
37
|
+
"deliver_at",
|
|
38
|
+
"event_id",
|
|
39
|
+
"event_type",
|
|
40
|
+
"payload",
|
|
41
|
+
"payload_retention_hours",
|
|
42
|
+
"payload_retention_period",
|
|
43
|
+
"tags",
|
|
44
|
+
"transformations_params"
|
|
45
|
+
].freeze
|
|
46
|
+
private_constant :ALL_FIELD
|
|
47
|
+
|
|
48
|
+
def initialize(attributes = {})
|
|
49
|
+
unless attributes.is_a?(Hash)
|
|
50
|
+
fail(ArgumentError, "The input argument (attributes) must be a hash in `HookSniff::MessageIn` new method")
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
attributes.each do |k, v|
|
|
54
|
+
unless ALL_FIELD.include?(k.to_s)
|
|
55
|
+
fail(ArgumentError, "The field #{k} is not part of HookSniff::MessageIn")
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
instance_variable_set("@#{k}", v)
|
|
59
|
+
instance_variable_set("@__#{k}_is_defined", true)
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def self.deserialize(attributes = {})
|
|
64
|
+
attributes = attributes.transform_keys(&:to_s)
|
|
65
|
+
attrs = Hash.new
|
|
66
|
+
attrs["application"] = HookSniff::ApplicationIn.deserialize(attributes["application"]) if attributes["application"]
|
|
67
|
+
attrs["channels"] = attributes["channels"]
|
|
68
|
+
attrs["deliver_at"] = DateTime.rfc3339(attributes["deliverAt"]).to_time if attributes["deliverAt"]
|
|
69
|
+
attrs["event_id"] = attributes["eventId"]
|
|
70
|
+
attrs["event_type"] = attributes["eventType"]
|
|
71
|
+
attrs["payload"] = attributes["payload"]
|
|
72
|
+
attrs["payload_retention_hours"] = attributes["payloadRetentionHours"]
|
|
73
|
+
attrs["payload_retention_period"] = attributes["payloadRetentionPeriod"]
|
|
74
|
+
attrs["tags"] = attributes["tags"]
|
|
75
|
+
attrs["transformations_params"] = attributes["transformationsParams"]
|
|
76
|
+
new(attrs)
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def serialize
|
|
80
|
+
out = Hash.new
|
|
81
|
+
out["application"] = HookSniff::serialize_schema_ref(@application) if @application
|
|
82
|
+
out["channels"] = HookSniff::serialize_primitive(@channels) if @channels
|
|
83
|
+
out["deliverAt"] = HookSniff::serialize_primitive(@deliver_at) if @deliver_at
|
|
84
|
+
out["eventId"] = HookSniff::serialize_primitive(@event_id) if @event_id
|
|
85
|
+
out["eventType"] = HookSniff::serialize_primitive(@event_type) if @event_type
|
|
86
|
+
out["payload"] = HookSniff::serialize_primitive(@payload) if @payload
|
|
87
|
+
out["payloadRetentionHours"] = HookSniff::serialize_primitive(@payload_retention_hours) if @payload_retention_hours
|
|
88
|
+
out["payloadRetentionPeriod"] = HookSniff::serialize_primitive(@payload_retention_period) if @payload_retention_period
|
|
89
|
+
out["tags"] = HookSniff::serialize_primitive(@tags) if @tags
|
|
90
|
+
out["transformationsParams"] = HookSniff::serialize_primitive(@transformations_params) if @transformations_params
|
|
91
|
+
out
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
# Serializes the object to a json string
|
|
95
|
+
# @return String
|
|
96
|
+
def to_json
|
|
97
|
+
JSON.dump(serialize)
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
end
|