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,97 @@
1
+ # frozen_string_literal: true
2
+ # This file is @generated
3
+ require "json"
4
+
5
+ module HookSniff
6
+ class EndpointPatch
7
+ attr_accessor :channels
8
+ attr_accessor :description
9
+ attr_accessor :disabled
10
+ attr_accessor :filter_types
11
+ attr_accessor :metadata
12
+ # Deprecated, use `throttleRate` instead.
13
+ attr_accessor :rate_limit
14
+ # The endpoint's verification secret.
15
+ #
16
+ # Format: `base64` encoded random bytes optionally prefixed with `whsec_`.
17
+ # It is recommended to not set this and let the server generate the secret.
18
+ attr_accessor :secret
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
+ # The Endpoint's UID.
24
+ attr_accessor :uid
25
+ attr_accessor :url
26
+ attr_accessor :version
27
+
28
+ ALL_FIELD ||= [
29
+ "channels",
30
+ "description",
31
+ "disabled",
32
+ "filter_types",
33
+ "metadata",
34
+ "rate_limit",
35
+ "secret",
36
+ "throttle_rate",
37
+ "uid",
38
+ "url",
39
+ "version"
40
+ ].freeze
41
+ private_constant :ALL_FIELD
42
+
43
+ def initialize(attributes = {})
44
+ unless attributes.is_a?(Hash)
45
+ fail(ArgumentError, "The input argument (attributes) must be a hash in `HookSniff::EndpointPatch` new method")
46
+ end
47
+
48
+ attributes.each do |k, v|
49
+ unless ALL_FIELD.include?(k.to_s)
50
+ fail(ArgumentError, "The field #{k} is not part of HookSniff::EndpointPatch")
51
+ end
52
+
53
+ instance_variable_set("@#{k}", v)
54
+ instance_variable_set("@__#{k}_is_defined", true)
55
+ end
56
+ end
57
+
58
+ def self.deserialize(attributes = {})
59
+ attributes = attributes.transform_keys(&:to_s)
60
+ attrs = Hash.new
61
+ attrs["channels"] = attributes["channels"]
62
+ attrs["description"] = attributes["description"]
63
+ attrs["disabled"] = attributes["disabled"]
64
+ attrs["filter_types"] = attributes["filterTypes"]
65
+ attrs["metadata"] = attributes["metadata"]
66
+ attrs["rate_limit"] = attributes["rateLimit"]
67
+ attrs["secret"] = attributes["secret"]
68
+ attrs["throttle_rate"] = attributes["throttleRate"]
69
+ attrs["uid"] = attributes["uid"]
70
+ attrs["url"] = attributes["url"]
71
+ attrs["version"] = attributes["version"]
72
+ new(attrs)
73
+ end
74
+
75
+ def serialize
76
+ out = Hash.new
77
+ out["channels"] = HookSniff::serialize_primitive(@channels) if @__channels_is_defined
78
+ out["description"] = HookSniff::serialize_primitive(@description) if @description
79
+ out["disabled"] = HookSniff::serialize_primitive(@disabled) if @disabled
80
+ out["filterTypes"] = HookSniff::serialize_primitive(@filter_types) if @__filter_types_is_defined
81
+ out["metadata"] = HookSniff::serialize_primitive(@metadata) if @metadata
82
+ out["rateLimit"] = HookSniff::serialize_primitive(@rate_limit) if @__rate_limit_is_defined
83
+ out["secret"] = HookSniff::serialize_primitive(@secret) if @__secret_is_defined
84
+ out["throttleRate"] = HookSniff::serialize_primitive(@throttle_rate) if @__throttle_rate_is_defined
85
+ out["uid"] = HookSniff::serialize_primitive(@uid) if @__uid_is_defined
86
+ out["url"] = HookSniff::serialize_primitive(@url) if @url
87
+ out["version"] = HookSniff::serialize_primitive(@version) if @version
88
+ out
89
+ end
90
+
91
+ # Serializes the object to a json string
92
+ # @return String
93
+ def to_json
94
+ JSON.dump(serialize)
95
+ end
96
+ end
97
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+ # This file is @generated
3
+ require "json"
4
+
5
+ module HookSniff
6
+ class EndpointSecretOut
7
+ # The endpoint's verification secret.
8
+ #
9
+ # Format: `base64` encoded random bytes optionally prefixed with `whsec_`.
10
+ # It is recommended to not set this and let the server generate the secret.
11
+ attr_accessor :key
12
+
13
+ ALL_FIELD ||= ["key"].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::EndpointSecretOut` 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::EndpointSecretOut")
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["key"] = attributes["key"]
35
+ new(attrs)
36
+ end
37
+
38
+ def serialize
39
+ out = Hash.new
40
+ out["key"] = HookSniff::serialize_primitive(@key) if @key
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,53 @@
1
+ # frozen_string_literal: true
2
+ # This file is @generated
3
+ require "json"
4
+
5
+ module HookSniff
6
+ class EndpointSecretRotateIn
7
+ # The endpoint's verification secret.
8
+ #
9
+ # Format: `base64` encoded random bytes optionally prefixed with `whsec_`.
10
+ # It is recommended to not set this and let the server generate the secret.
11
+ attr_accessor :key
12
+
13
+ ALL_FIELD ||= ["key"].freeze
14
+ private_constant :ALL_FIELD
15
+
16
+ def initialize(attributes = {})
17
+ unless attributes.is_a?(Hash)
18
+ fail(
19
+ ArgumentError,
20
+ "The input argument (attributes) must be a hash in `HookSniff::EndpointSecretRotateIn` new method"
21
+ )
22
+ end
23
+
24
+ attributes.each do |k, v|
25
+ unless ALL_FIELD.include?(k.to_s)
26
+ fail(ArgumentError, "The field #{k} is not part of HookSniff::EndpointSecretRotateIn")
27
+ end
28
+
29
+ instance_variable_set("@#{k}", v)
30
+ instance_variable_set("@__#{k}_is_defined", true)
31
+ end
32
+ end
33
+
34
+ def self.deserialize(attributes = {})
35
+ attributes = attributes.transform_keys(&:to_s)
36
+ attrs = Hash.new
37
+ attrs["key"] = attributes["key"]
38
+ new(attrs)
39
+ end
40
+
41
+ def serialize
42
+ out = Hash.new
43
+ out["key"] = HookSniff::serialize_primitive(@key) if @key
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,90 @@
1
+ # frozen_string_literal: true
2
+ # This file is @generated
3
+ require "json"
4
+
5
+ module HookSniff
6
+ class EndpointUpdate
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 :metadata
13
+ # Deprecated, use `throttleRate` instead.
14
+ attr_accessor :rate_limit
15
+ # Maximum messages per second to send to this endpoint.
16
+ #
17
+ # Outgoing messages will be throttled to this rate.
18
+ attr_accessor :throttle_rate
19
+ # Optional unique identifier for the endpoint.
20
+ attr_accessor :uid
21
+ attr_accessor :url
22
+ attr_accessor :version
23
+
24
+ ALL_FIELD ||= [
25
+ "channels",
26
+ "description",
27
+ "disabled",
28
+ "filter_types",
29
+ "metadata",
30
+ "rate_limit",
31
+ "throttle_rate",
32
+ "uid",
33
+ "url",
34
+ "version"
35
+ ].freeze
36
+ private_constant :ALL_FIELD
37
+
38
+ def initialize(attributes = {})
39
+ unless attributes.is_a?(Hash)
40
+ fail(ArgumentError, "The input argument (attributes) must be a hash in `HookSniff::EndpointUpdate` new method")
41
+ end
42
+
43
+ attributes.each do |k, v|
44
+ unless ALL_FIELD.include?(k.to_s)
45
+ fail(ArgumentError, "The field #{k} is not part of HookSniff::EndpointUpdate")
46
+ end
47
+
48
+ instance_variable_set("@#{k}", v)
49
+ instance_variable_set("@__#{k}_is_defined", true)
50
+ end
51
+ end
52
+
53
+ def self.deserialize(attributes = {})
54
+ attributes = attributes.transform_keys(&:to_s)
55
+ attrs = Hash.new
56
+ attrs["channels"] = attributes["channels"]
57
+ attrs["description"] = attributes["description"]
58
+ attrs["disabled"] = attributes["disabled"]
59
+ attrs["filter_types"] = attributes["filterTypes"]
60
+ attrs["metadata"] = attributes["metadata"]
61
+ attrs["rate_limit"] = attributes["rateLimit"]
62
+ attrs["throttle_rate"] = attributes["throttleRate"]
63
+ attrs["uid"] = attributes["uid"]
64
+ attrs["url"] = attributes["url"]
65
+ attrs["version"] = attributes["version"]
66
+ new(attrs)
67
+ end
68
+
69
+ def serialize
70
+ out = Hash.new
71
+ out["channels"] = HookSniff::serialize_primitive(@channels) if @channels
72
+ out["description"] = HookSniff::serialize_primitive(@description) if @description
73
+ out["disabled"] = HookSniff::serialize_primitive(@disabled) if @disabled
74
+ out["filterTypes"] = HookSniff::serialize_primitive(@filter_types) if @filter_types
75
+ out["metadata"] = HookSniff::serialize_primitive(@metadata) if @metadata
76
+ out["rateLimit"] = HookSniff::serialize_primitive(@rate_limit) if @rate_limit
77
+ out["throttleRate"] = HookSniff::serialize_primitive(@throttle_rate) if @throttle_rate
78
+ out["uid"] = HookSniff::serialize_primitive(@uid) if @uid
79
+ out["url"] = HookSniff::serialize_primitive(@url) if @url
80
+ out["version"] = HookSniff::serialize_primitive(@version) if @version
81
+ out
82
+ end
83
+
84
+ # Serializes the object to a json string
85
+ # @return String
86
+ def to_json
87
+ JSON.dump(serialize)
88
+ end
89
+ end
90
+ 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 is updated.
7
+ class EndpointUpdatedEvent
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::EndpointUpdatedEvent` 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::EndpointUpdatedEvent")
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::EndpointUpdatedEventData.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 is created, updated, or deleted
7
+ class EndpointUpdatedEventData
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::EndpointUpdatedEventData` 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::EndpointUpdatedEventData")
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,50 @@
1
+ # frozen_string_literal: true
2
+ # This file is @generated
3
+ require "json"
4
+
5
+ module HookSniff
6
+ class EventIn
7
+ # The event type's name
8
+ attr_accessor :event_type
9
+ attr_accessor :payload
10
+
11
+ ALL_FIELD ||= ["event_type", "payload"].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::EventIn` 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::EventIn")
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["event_type"] = attributes["eventType"]
33
+ attrs["payload"] = attributes["payload"]
34
+ new(attrs)
35
+ end
36
+
37
+ def serialize
38
+ out = Hash.new
39
+ out["eventType"] = HookSniff::serialize_primitive(@event_type) if @event_type
40
+ out["payload"] = HookSniff::serialize_primitive(@payload) if @payload
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,53 @@
1
+ # frozen_string_literal: true
2
+ # This file is @generated
3
+ require "json"
4
+
5
+ module HookSniff
6
+ class EventOut
7
+ # The event type's name
8
+ attr_accessor :event_type
9
+ attr_accessor :payload
10
+ attr_accessor :timestamp
11
+
12
+ ALL_FIELD ||= ["event_type", "payload", "timestamp"].freeze
13
+ private_constant :ALL_FIELD
14
+
15
+ def initialize(attributes = {})
16
+ unless attributes.is_a?(Hash)
17
+ fail(ArgumentError, "The input argument (attributes) must be a hash in `HookSniff::EventOut` new method")
18
+ end
19
+
20
+ attributes.each do |k, v|
21
+ unless ALL_FIELD.include?(k.to_s)
22
+ fail(ArgumentError, "The field #{k} is not part of HookSniff::EventOut")
23
+ end
24
+
25
+ instance_variable_set("@#{k}", v)
26
+ instance_variable_set("@__#{k}_is_defined", true)
27
+ end
28
+ end
29
+
30
+ def self.deserialize(attributes = {})
31
+ attributes = attributes.transform_keys(&:to_s)
32
+ attrs = Hash.new
33
+ attrs["event_type"] = attributes["eventType"]
34
+ attrs["payload"] = attributes["payload"]
35
+ attrs["timestamp"] = DateTime.rfc3339(attributes["timestamp"]).to_time
36
+ new(attrs)
37
+ end
38
+
39
+ def serialize
40
+ out = Hash.new
41
+ out["eventType"] = HookSniff::serialize_primitive(@event_type) if @event_type
42
+ out["payload"] = HookSniff::serialize_primitive(@payload) if @payload
43
+ out["timestamp"] = HookSniff::serialize_primitive(@timestamp) if @timestamp
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,80 @@
1
+ # frozen_string_literal: true
2
+ # This file is @generated
3
+ require "json"
4
+
5
+ module HookSniff
6
+ class EventTypeIn
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 event type's name
16
+ attr_accessor :name
17
+ # The schema for the event type for a specific version as a JSON schema.
18
+ attr_accessor :schemas
19
+
20
+ ALL_FIELD ||= [
21
+ "archived",
22
+ "deprecated",
23
+ "description",
24
+ "feature_flag",
25
+ "feature_flags",
26
+ "group_name",
27
+ "name",
28
+ "schemas"
29
+ ].freeze
30
+ private_constant :ALL_FIELD
31
+
32
+ def initialize(attributes = {})
33
+ unless attributes.is_a?(Hash)
34
+ fail(ArgumentError, "The input argument (attributes) must be a hash in `HookSniff::EventTypeIn` new method")
35
+ end
36
+
37
+ attributes.each do |k, v|
38
+ unless ALL_FIELD.include?(k.to_s)
39
+ fail(ArgumentError, "The field #{k} is not part of HookSniff::EventTypeIn")
40
+ end
41
+
42
+ instance_variable_set("@#{k}", v)
43
+ instance_variable_set("@__#{k}_is_defined", true)
44
+ end
45
+ end
46
+
47
+ def self.deserialize(attributes = {})
48
+ attributes = attributes.transform_keys(&:to_s)
49
+ attrs = Hash.new
50
+ attrs["archived"] = attributes["archived"]
51
+ attrs["deprecated"] = attributes["deprecated"]
52
+ attrs["description"] = attributes["description"]
53
+ attrs["feature_flag"] = attributes["featureFlag"]
54
+ attrs["feature_flags"] = attributes["featureFlags"]
55
+ attrs["group_name"] = attributes["groupName"]
56
+ attrs["name"] = attributes["name"]
57
+ attrs["schemas"] = attributes["schemas"]
58
+ new(attrs)
59
+ end
60
+
61
+ def serialize
62
+ out = Hash.new
63
+ out["archived"] = HookSniff::serialize_primitive(@archived) if @archived
64
+ out["deprecated"] = HookSniff::serialize_primitive(@deprecated) if @deprecated
65
+ out["description"] = HookSniff::serialize_primitive(@description) if @description
66
+ out["featureFlag"] = HookSniff::serialize_primitive(@feature_flag) if @feature_flag
67
+ out["featureFlags"] = HookSniff::serialize_primitive(@feature_flags) if @feature_flags
68
+ out["groupName"] = HookSniff::serialize_primitive(@group_name) if @group_name
69
+ out["name"] = HookSniff::serialize_primitive(@name) if @name
70
+ out["schemas"] = HookSniff::serialize_primitive(@schemas) if @schemas
71
+ out
72
+ end
73
+
74
+ # Serializes the object to a json string
75
+ # @return String
76
+ def to_json
77
+ JSON.dump(serialize)
78
+ end
79
+ end
80
+ end
@@ -0,0 +1,87 @@
1
+ # frozen_string_literal: true
2
+ # This file is @generated
3
+ require "json"
4
+
5
+ module HookSniff
6
+ class EventTypeOut
7
+ attr_accessor :archived
8
+ attr_accessor :created_at
9
+ attr_accessor :deprecated
10
+ attr_accessor :description
11
+ attr_accessor :feature_flag
12
+ attr_accessor :feature_flags
13
+ # The event type group's name
14
+ attr_accessor :group_name
15
+ # The event type's name
16
+ attr_accessor :name
17
+ # The schema for the event type for a specific version as a JSON schema.
18
+ attr_accessor :schemas
19
+ attr_accessor :updated_at
20
+
21
+ ALL_FIELD ||= [
22
+ "archived",
23
+ "created_at",
24
+ "deprecated",
25
+ "description",
26
+ "feature_flag",
27
+ "feature_flags",
28
+ "group_name",
29
+ "name",
30
+ "schemas",
31
+ "updated_at"
32
+ ].freeze
33
+ private_constant :ALL_FIELD
34
+
35
+ def initialize(attributes = {})
36
+ unless attributes.is_a?(Hash)
37
+ fail(ArgumentError, "The input argument (attributes) must be a hash in `HookSniff::EventTypeOut` new method")
38
+ end
39
+
40
+ attributes.each do |k, v|
41
+ unless ALL_FIELD.include?(k.to_s)
42
+ fail(ArgumentError, "The field #{k} is not part of HookSniff::EventTypeOut")
43
+ end
44
+
45
+ instance_variable_set("@#{k}", v)
46
+ instance_variable_set("@__#{k}_is_defined", true)
47
+ end
48
+ end
49
+
50
+ def self.deserialize(attributes = {})
51
+ attributes = attributes.transform_keys(&:to_s)
52
+ attrs = Hash.new
53
+ attrs["archived"] = attributes["archived"]
54
+ attrs["created_at"] = DateTime.rfc3339(attributes["createdAt"]).to_time
55
+ attrs["deprecated"] = attributes["deprecated"]
56
+ attrs["description"] = attributes["description"]
57
+ attrs["feature_flag"] = attributes["featureFlag"]
58
+ attrs["feature_flags"] = attributes["featureFlags"]
59
+ attrs["group_name"] = attributes["groupName"]
60
+ attrs["name"] = attributes["name"]
61
+ attrs["schemas"] = attributes["schemas"]
62
+ attrs["updated_at"] = DateTime.rfc3339(attributes["updatedAt"]).to_time
63
+ new(attrs)
64
+ end
65
+
66
+ def serialize
67
+ out = Hash.new
68
+ out["archived"] = HookSniff::serialize_primitive(@archived) if @archived
69
+ out["createdAt"] = HookSniff::serialize_primitive(@created_at) if @created_at
70
+ out["deprecated"] = HookSniff::serialize_primitive(@deprecated) if @deprecated
71
+ out["description"] = HookSniff::serialize_primitive(@description) if @description
72
+ out["featureFlag"] = HookSniff::serialize_primitive(@feature_flag) if @feature_flag
73
+ out["featureFlags"] = HookSniff::serialize_primitive(@feature_flags) if @feature_flags
74
+ out["groupName"] = HookSniff::serialize_primitive(@group_name) if @group_name
75
+ out["name"] = HookSniff::serialize_primitive(@name) if @name
76
+ out["schemas"] = HookSniff::serialize_primitive(@schemas) if @schemas
77
+ out["updatedAt"] = HookSniff::serialize_primitive(@updated_at) if @updated_at
78
+ out
79
+ end
80
+
81
+ # Serializes the object to a json string
82
+ # @return String
83
+ def to_json
84
+ JSON.dump(serialize)
85
+ end
86
+ end
87
+ end