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,63 @@
1
+ # frozen_string_literal: true
2
+ # This file is @generated
3
+ require "json"
4
+
5
+ module HookSniff
6
+ # Sent when an endpoint is created, updated, or deleted
7
+ class EndpointDeletedEventData
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
+ # The Endpoint's UID.
15
+ attr_accessor :endpoint_uid
16
+
17
+ ALL_FIELD ||= ["app_id", "app_uid", "endpoint_id", "endpoint_uid"].freeze
18
+ private_constant :ALL_FIELD
19
+
20
+ def initialize(attributes = {})
21
+ unless attributes.is_a?(Hash)
22
+ fail(
23
+ ArgumentError,
24
+ "The input argument (attributes) must be a hash in `HookSniff::EndpointDeletedEventData` new method"
25
+ )
26
+ end
27
+
28
+ attributes.each do |k, v|
29
+ unless ALL_FIELD.include?(k.to_s)
30
+ fail(ArgumentError, "The field #{k} is not part of HookSniff::EndpointDeletedEventData")
31
+ end
32
+
33
+ instance_variable_set("@#{k}", v)
34
+ instance_variable_set("@__#{k}_is_defined", true)
35
+ end
36
+ end
37
+
38
+ def self.deserialize(attributes = {})
39
+ attributes = attributes.transform_keys(&:to_s)
40
+ attrs = Hash.new
41
+ attrs["app_id"] = attributes["appId"]
42
+ attrs["app_uid"] = attributes["appUid"]
43
+ attrs["endpoint_id"] = attributes["endpointId"]
44
+ attrs["endpoint_uid"] = attributes["endpointUid"]
45
+ new(attrs)
46
+ end
47
+
48
+ def serialize
49
+ out = Hash.new
50
+ out["appId"] = HookSniff::serialize_primitive(@app_id) if @app_id
51
+ out["appUid"] = HookSniff::serialize_primitive(@app_uid) if @app_uid
52
+ out["endpointId"] = HookSniff::serialize_primitive(@endpoint_id) if @endpoint_id
53
+ out["endpointUid"] = HookSniff::serialize_primitive(@endpoint_uid) if @endpoint_uid
54
+ out
55
+ end
56
+
57
+ # Serializes the object to a json string
58
+ # @return String
59
+ def to_json
60
+ JSON.dump(serialize)
61
+ end
62
+ end
63
+ 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 an endpoint has been automatically disabled after continuous failures, or manually via an API call.
7
+ class EndpointDisabledEvent
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::EndpointDisabledEvent` 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::EndpointDisabledEvent")
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::EndpointDisabledEventData.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,69 @@
1
+ # frozen_string_literal: true
2
+ # This file is @generated
3
+ require "json"
4
+
5
+ module HookSniff
6
+ # Sent when an endpoint has been automatically disabled after continuous failures, or manually via an API call.
7
+ class EndpointDisabledEventData
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
+ # The Endpoint's UID.
15
+ attr_accessor :endpoint_uid
16
+ attr_accessor :fail_since
17
+ attr_accessor :trigger
18
+
19
+ ALL_FIELD ||= ["app_id", "app_uid", "endpoint_id", "endpoint_uid", "fail_since", "trigger"].freeze
20
+ private_constant :ALL_FIELD
21
+
22
+ def initialize(attributes = {})
23
+ unless attributes.is_a?(Hash)
24
+ fail(
25
+ ArgumentError,
26
+ "The input argument (attributes) must be a hash in `HookSniff::EndpointDisabledEventData` new method"
27
+ )
28
+ end
29
+
30
+ attributes.each do |k, v|
31
+ unless ALL_FIELD.include?(k.to_s)
32
+ fail(ArgumentError, "The field #{k} is not part of HookSniff::EndpointDisabledEventData")
33
+ end
34
+
35
+ instance_variable_set("@#{k}", v)
36
+ instance_variable_set("@__#{k}_is_defined", true)
37
+ end
38
+ end
39
+
40
+ def self.deserialize(attributes = {})
41
+ attributes = attributes.transform_keys(&:to_s)
42
+ attrs = Hash.new
43
+ attrs["app_id"] = attributes["appId"]
44
+ attrs["app_uid"] = attributes["appUid"]
45
+ attrs["endpoint_id"] = attributes["endpointId"]
46
+ attrs["endpoint_uid"] = attributes["endpointUid"]
47
+ attrs["fail_since"] = DateTime.rfc3339(attributes["failSince"]).to_time if attributes["failSince"]
48
+ attrs["trigger"] = HookSniff::EndpointDisabledTrigger.deserialize(attributes["trigger"]) if attributes["trigger"]
49
+ new(attrs)
50
+ end
51
+
52
+ def serialize
53
+ out = Hash.new
54
+ out["appId"] = HookSniff::serialize_primitive(@app_id) if @app_id
55
+ out["appUid"] = HookSniff::serialize_primitive(@app_uid) if @app_uid
56
+ out["endpointId"] = HookSniff::serialize_primitive(@endpoint_id) if @endpoint_id
57
+ out["endpointUid"] = HookSniff::serialize_primitive(@endpoint_uid) if @endpoint_uid
58
+ out["failSince"] = HookSniff::serialize_primitive(@fail_since) if @fail_since
59
+ out["trigger"] = HookSniff::serialize_schema_ref(@trigger) if @trigger
60
+ out
61
+ end
62
+
63
+ # Serializes the object to a json string
64
+ # @return String
65
+ def to_json
66
+ JSON.dump(serialize)
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+ # This file is @generated
3
+ require "json"
4
+
5
+ module HookSniff
6
+ # Sent when an endpoint has been enabled.
7
+ class EndpointEnabledEvent
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(ArgumentError, "The input argument (attributes) must be a hash in `HookSniff::EndpointEnabledEvent` new method")
17
+ end
18
+
19
+ attributes.each do |k, v|
20
+ unless ALL_FIELD.include?(k.to_s)
21
+ fail(ArgumentError, "The field #{k} is not part of HookSniff::EndpointEnabledEvent")
22
+ end
23
+
24
+ instance_variable_set("@#{k}", v)
25
+ instance_variable_set("@__#{k}_is_defined", true)
26
+ end
27
+ end
28
+
29
+ def self.deserialize(attributes = {})
30
+ attributes = attributes.transform_keys(&:to_s)
31
+ attrs = Hash.new
32
+ attrs["data"] = HookSniff::EndpointEnabledEventData.deserialize(attributes["data"])
33
+ attrs["type"] = attributes["type"]
34
+ new(attrs)
35
+ end
36
+
37
+ def serialize
38
+ out = Hash.new
39
+ out["data"] = HookSniff::serialize_schema_ref(@data) if @data
40
+ out["type"] = HookSniff::serialize_primitive(@type) if @type
41
+ out
42
+ end
43
+
44
+ # Serializes the object to a json string
45
+ # @return String
46
+ def to_json
47
+ JSON.dump(serialize)
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+ # This file is @generated
3
+ require "json"
4
+
5
+ module HookSniff
6
+ # Sent when an endpoint has been enabled.
7
+ class EndpointEnabledEventData
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
+ # The Endpoint's UID.
15
+ attr_accessor :endpoint_uid
16
+
17
+ ALL_FIELD ||= ["app_id", "app_uid", "endpoint_id", "endpoint_uid"].freeze
18
+ private_constant :ALL_FIELD
19
+
20
+ def initialize(attributes = {})
21
+ unless attributes.is_a?(Hash)
22
+ fail(
23
+ ArgumentError,
24
+ "The input argument (attributes) must be a hash in `HookSniff::EndpointEnabledEventData` new method"
25
+ )
26
+ end
27
+
28
+ attributes.each do |k, v|
29
+ unless ALL_FIELD.include?(k.to_s)
30
+ fail(ArgumentError, "The field #{k} is not part of HookSniff::EndpointEnabledEventData")
31
+ end
32
+
33
+ instance_variable_set("@#{k}", v)
34
+ instance_variable_set("@__#{k}_is_defined", true)
35
+ end
36
+ end
37
+
38
+ def self.deserialize(attributes = {})
39
+ attributes = attributes.transform_keys(&:to_s)
40
+ attrs = Hash.new
41
+ attrs["app_id"] = attributes["appId"]
42
+ attrs["app_uid"] = attributes["appUid"]
43
+ attrs["endpoint_id"] = attributes["endpointId"]
44
+ attrs["endpoint_uid"] = attributes["endpointUid"]
45
+ new(attrs)
46
+ end
47
+
48
+ def serialize
49
+ out = Hash.new
50
+ out["appId"] = HookSniff::serialize_primitive(@app_id) if @app_id
51
+ out["appUid"] = HookSniff::serialize_primitive(@app_uid) if @app_uid
52
+ out["endpointId"] = HookSniff::serialize_primitive(@endpoint_id) if @endpoint_id
53
+ out["endpointUid"] = HookSniff::serialize_primitive(@endpoint_uid) if @endpoint_uid
54
+ out
55
+ end
56
+
57
+ # Serializes the object to a json string
58
+ # @return String
59
+ def to_json
60
+ JSON.dump(serialize)
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+ # This file is @generated
3
+ require "json"
4
+
5
+ module HookSniff
6
+ class EndpointHeadersIn
7
+ attr_accessor :headers
8
+
9
+ ALL_FIELD ||= ["headers"].freeze
10
+ private_constant :ALL_FIELD
11
+
12
+ def initialize(attributes = {})
13
+ unless attributes.is_a?(Hash)
14
+ fail(ArgumentError, "The input argument (attributes) must be a hash in `HookSniff::EndpointHeadersIn` new method")
15
+ end
16
+
17
+ attributes.each do |k, v|
18
+ unless ALL_FIELD.include?(k.to_s)
19
+ fail(ArgumentError, "The field #{k} is not part of HookSniff::EndpointHeadersIn")
20
+ end
21
+
22
+ instance_variable_set("@#{k}", v)
23
+ instance_variable_set("@__#{k}_is_defined", true)
24
+ end
25
+ end
26
+
27
+ def self.deserialize(attributes = {})
28
+ attributes = attributes.transform_keys(&:to_s)
29
+ attrs = Hash.new
30
+ attrs["headers"] = attributes["headers"]
31
+ new(attrs)
32
+ end
33
+
34
+ def serialize
35
+ out = Hash.new
36
+ out["headers"] = HookSniff::serialize_primitive(@headers) if @headers
37
+ out
38
+ end
39
+
40
+ # Serializes the object to a json string
41
+ # @return String
42
+ def to_json
43
+ JSON.dump(serialize)
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+ # This file is @generated
3
+ require "json"
4
+
5
+ module HookSniff
6
+ # The value of the headers is returned in the `headers` field.
7
+ #
8
+ # Sensitive headers that have been redacted are returned in the sensitive field.
9
+ class EndpointHeadersOut
10
+ attr_accessor :headers
11
+ attr_accessor :sensitive
12
+
13
+ ALL_FIELD ||= ["headers", "sensitive"].freeze
14
+ private_constant :ALL_FIELD
15
+
16
+ def initialize(attributes = {})
17
+ unless attributes.is_a?(Hash)
18
+ fail(ArgumentError, "The input argument (attributes) must be a hash in `HookSniff::EndpointHeadersOut` new method")
19
+ end
20
+
21
+ attributes.each do |k, v|
22
+ unless ALL_FIELD.include?(k.to_s)
23
+ fail(ArgumentError, "The field #{k} is not part of HookSniff::EndpointHeadersOut")
24
+ end
25
+
26
+ instance_variable_set("@#{k}", v)
27
+ instance_variable_set("@__#{k}_is_defined", true)
28
+ end
29
+ end
30
+
31
+ def self.deserialize(attributes = {})
32
+ attributes = attributes.transform_keys(&:to_s)
33
+ attrs = Hash.new
34
+ attrs["headers"] = attributes["headers"]
35
+ attrs["sensitive"] = attributes["sensitive"]
36
+ new(attrs)
37
+ end
38
+
39
+ def serialize
40
+ out = Hash.new
41
+ out["headers"] = HookSniff::serialize_primitive(@headers) if @headers
42
+ out["sensitive"] = HookSniff::serialize_primitive(@sensitive) if @sensitive
43
+ out
44
+ end
45
+
46
+ # Serializes the object to a json string
47
+ # @return String
48
+ def to_json
49
+ JSON.dump(serialize)
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+ # This file is @generated
3
+ require "json"
4
+
5
+ module HookSniff
6
+ class EndpointHeadersPatchIn
7
+ # A list of headers be be removed
8
+ attr_accessor :delete_headers
9
+ attr_accessor :headers
10
+
11
+ ALL_FIELD ||= ["delete_headers", "headers"].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::EndpointHeadersPatchIn` 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::EndpointHeadersPatchIn")
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["delete_headers"] = attributes["deleteHeaders"]
36
+ attrs["headers"] = attributes["headers"]
37
+ new(attrs)
38
+ end
39
+
40
+ def serialize
41
+ out = Hash.new
42
+ out["deleteHeaders"] = HookSniff::serialize_primitive(@delete_headers) if @delete_headers
43
+ out["headers"] = HookSniff::serialize_primitive(@headers) if @headers
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,102 @@
1
+ # frozen_string_literal: true
2
+ # This file is @generated
3
+ require "json"
4
+
5
+ module HookSniff
6
+ class EndpointIn
7
+ # List of message channels this endpoint listens to (omit for all).
8
+ attr_accessor :channels
9
+ attr_accessor :description
10
+ attr_accessor :disabled
11
+ attr_accessor :filter_types
12
+ attr_accessor :headers
13
+ attr_accessor :metadata
14
+ # Deprecated, use `throttleRate` instead.
15
+ attr_accessor :rate_limit
16
+ # The endpoint's verification secret.
17
+ #
18
+ # Format: `base64` encoded random bytes optionally prefixed with `whsec_`.
19
+ # It is recommended to not set this and let the server generate the secret.
20
+ attr_accessor :secret
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 :url
28
+ attr_accessor :version
29
+
30
+ ALL_FIELD ||= [
31
+ "channels",
32
+ "description",
33
+ "disabled",
34
+ "filter_types",
35
+ "headers",
36
+ "metadata",
37
+ "rate_limit",
38
+ "secret",
39
+ "throttle_rate",
40
+ "uid",
41
+ "url",
42
+ "version"
43
+ ].freeze
44
+ private_constant :ALL_FIELD
45
+
46
+ def initialize(attributes = {})
47
+ unless attributes.is_a?(Hash)
48
+ fail(ArgumentError, "The input argument (attributes) must be a hash in `HookSniff::EndpointIn` new method")
49
+ end
50
+
51
+ attributes.each do |k, v|
52
+ unless ALL_FIELD.include?(k.to_s)
53
+ fail(ArgumentError, "The field #{k} is not part of HookSniff::EndpointIn")
54
+ end
55
+
56
+ instance_variable_set("@#{k}", v)
57
+ instance_variable_set("@__#{k}_is_defined", true)
58
+ end
59
+ end
60
+
61
+ def self.deserialize(attributes = {})
62
+ attributes = attributes.transform_keys(&:to_s)
63
+ attrs = Hash.new
64
+ attrs["channels"] = attributes["channels"]
65
+ attrs["description"] = attributes["description"]
66
+ attrs["disabled"] = attributes["disabled"]
67
+ attrs["filter_types"] = attributes["filterTypes"]
68
+ attrs["headers"] = attributes["headers"]
69
+ attrs["metadata"] = attributes["metadata"]
70
+ attrs["rate_limit"] = attributes["rateLimit"]
71
+ attrs["secret"] = attributes["secret"]
72
+ attrs["throttle_rate"] = attributes["throttleRate"]
73
+ attrs["uid"] = attributes["uid"]
74
+ attrs["url"] = attributes["url"]
75
+ attrs["version"] = attributes["version"]
76
+ new(attrs)
77
+ end
78
+
79
+ def serialize
80
+ out = Hash.new
81
+ out["channels"] = HookSniff::serialize_primitive(@channels) if @channels
82
+ out["description"] = HookSniff::serialize_primitive(@description) if @description
83
+ out["disabled"] = HookSniff::serialize_primitive(@disabled) if @disabled
84
+ out["filterTypes"] = HookSniff::serialize_primitive(@filter_types) if @filter_types
85
+ out["headers"] = HookSniff::serialize_primitive(@headers) if @headers
86
+ out["metadata"] = HookSniff::serialize_primitive(@metadata) if @metadata
87
+ out["rateLimit"] = HookSniff::serialize_primitive(@rate_limit) if @rate_limit
88
+ out["secret"] = HookSniff::serialize_primitive(@secret) if @secret
89
+ out["throttleRate"] = HookSniff::serialize_primitive(@throttle_rate) if @throttle_rate
90
+ out["uid"] = HookSniff::serialize_primitive(@uid) if @uid
91
+ out["url"] = HookSniff::serialize_primitive(@url) if @url
92
+ out["version"] = HookSniff::serialize_primitive(@version) if @version
93
+ out
94
+ end
95
+
96
+ # Serializes the object to a json string
97
+ # @return String
98
+ def to_json
99
+ JSON.dump(serialize)
100
+ end
101
+ end
102
+ end
@@ -0,0 +1,104 @@
1
+ # frozen_string_literal: true
2
+ # This file is @generated
3
+ require "json"
4
+
5
+ module HookSniff
6
+ class EndpointOut
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 :metadata
17
+ # Deprecated, use `throttleRate` instead.
18
+ attr_accessor :rate_limit
19
+ # Maximum messages per second to send to this endpoint.
20
+ #
21
+ # Outgoing messages will be throttled to this rate.
22
+ attr_accessor :throttle_rate
23
+ # Optional unique identifier for the endpoint.
24
+ attr_accessor :uid
25
+ attr_accessor :updated_at
26
+ attr_accessor :url
27
+ attr_accessor :version
28
+
29
+ ALL_FIELD ||= [
30
+ "channels",
31
+ "created_at",
32
+ "description",
33
+ "disabled",
34
+ "filter_types",
35
+ "id",
36
+ "metadata",
37
+ "rate_limit",
38
+ "throttle_rate",
39
+ "uid",
40
+ "updated_at",
41
+ "url",
42
+ "version"
43
+ ].freeze
44
+ private_constant :ALL_FIELD
45
+
46
+ def initialize(attributes = {})
47
+ unless attributes.is_a?(Hash)
48
+ fail(ArgumentError, "The input argument (attributes) must be a hash in `HookSniff::EndpointOut` new method")
49
+ end
50
+
51
+ attributes.each do |k, v|
52
+ unless ALL_FIELD.include?(k.to_s)
53
+ fail(ArgumentError, "The field #{k} is not part of HookSniff::EndpointOut")
54
+ end
55
+
56
+ instance_variable_set("@#{k}", v)
57
+ instance_variable_set("@__#{k}_is_defined", true)
58
+ end
59
+ end
60
+
61
+ def self.deserialize(attributes = {})
62
+ attributes = attributes.transform_keys(&:to_s)
63
+ attrs = Hash.new
64
+ attrs["channels"] = attributes["channels"]
65
+ attrs["created_at"] = DateTime.rfc3339(attributes["createdAt"]).to_time
66
+ attrs["description"] = attributes["description"]
67
+ attrs["disabled"] = attributes["disabled"]
68
+ attrs["filter_types"] = attributes["filterTypes"]
69
+ attrs["id"] = attributes["id"]
70
+ attrs["metadata"] = attributes["metadata"]
71
+ attrs["rate_limit"] = attributes["rateLimit"]
72
+ attrs["throttle_rate"] = attributes["throttleRate"]
73
+ attrs["uid"] = attributes["uid"]
74
+ attrs["updated_at"] = DateTime.rfc3339(attributes["updatedAt"]).to_time
75
+ attrs["url"] = attributes["url"]
76
+ attrs["version"] = attributes["version"]
77
+ new(attrs)
78
+ end
79
+
80
+ def serialize
81
+ out = Hash.new
82
+ out["channels"] = HookSniff::serialize_primitive(@channels) if @channels
83
+ out["createdAt"] = HookSniff::serialize_primitive(@created_at) if @created_at
84
+ out["description"] = HookSniff::serialize_primitive(@description) if @description
85
+ out["disabled"] = HookSniff::serialize_primitive(@disabled) if @disabled
86
+ out["filterTypes"] = HookSniff::serialize_primitive(@filter_types) if @filter_types
87
+ out["id"] = HookSniff::serialize_primitive(@id) if @id
88
+ out["metadata"] = HookSniff::serialize_primitive(@metadata) if @metadata
89
+ out["rateLimit"] = HookSniff::serialize_primitive(@rate_limit) if @rate_limit
90
+ out["throttleRate"] = HookSniff::serialize_primitive(@throttle_rate) if @throttle_rate
91
+ out["uid"] = HookSniff::serialize_primitive(@uid) if @uid
92
+ out["updatedAt"] = HookSniff::serialize_primitive(@updated_at) if @updated_at
93
+ out["url"] = HookSniff::serialize_primitive(@url) if @url
94
+ out["version"] = HookSniff::serialize_primitive(@version) if @version
95
+ out
96
+ end
97
+
98
+ # Serializes the object to a json string
99
+ # @return String
100
+ def to_json
101
+ JSON.dump(serialize)
102
+ end
103
+ end
104
+ end