hooksniff 1.0.0 → 1.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b5aaa88a65699339eb037c794a5d39c3cf2a7aecd9f51536c66f724ceb167e63
4
- data.tar.gz: 8fc8649416effe14346d24ef9d9853f84b47f172f4e8521761f5a386b1017a47
3
+ metadata.gz: d9eed443c71c5bfe95ea6f2aa6173480e01b1b2528d064e52071e07dff360144
4
+ data.tar.gz: c3c58215fdbe0d8e3110dd1359b5662963999ea887ed3aa6d2b2bfabb4bc79a5
5
5
  SHA512:
6
- metadata.gz: 28cf8842859a1b34b5fa563d8e076845d2657d956c4bcde51be444ee250aaaedae8814eb354130884a733ba6e9b9de5cfac3883d63da697f5db113973806362f
7
- data.tar.gz: f3d265478cc4bba62e1eb27631da361d3249529d45ab06111babd9adbdd57223b954c23e49b5cdea9671d3c62067ea89254c19948b3b1acf66c62333f7a907c4
6
+ metadata.gz: 2491e4a7ce09b46eedd9e40696c3f35d1a587d2be02a79c8dbfdc0879135d1ef0e5936ce58a1e64a7c5e82044358a63a61926d5dd5a6d3e91087cac9705cabdd
7
+ data.tar.gz: d6e137768bbf254de889673110bfb8826029b5b323daef6453d1b01921e2bfe81a02869b008d4c86aad63c56eae07c71a205d0a9f471e96604f8c001d6abfe21
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ module HookSniff
4
+ class IntegrationApi
5
+ def initialize(client)
6
+ @client = client
7
+ end
8
+
9
+ def list
10
+ @client.request(:get, "/api/v1/integrations")
11
+ end
12
+
13
+ def get(id)
14
+ @client.request(:get, "/api/v1/integrations/#{id}")
15
+ end
16
+
17
+ create_attrs = %i[name description connector_config_id endpoint_id event_filter transform_id retry_policy metadata enabled]
18
+ def create(attrs)
19
+ @client.request(:post, "/api/v1/integrations", attrs)
20
+ end
21
+
22
+ def update(id, attrs)
23
+ @client.request(:put, "/api/v1/integrations/#{id}", attrs)
24
+ end
25
+
26
+ def delete(id)
27
+ @client.request(:delete, "/api/v1/integrations/#{id}")
28
+ end
29
+
30
+ def test(id)
31
+ @client.request(:post, "/api/v1/integrations/#{id}/test")
32
+ end
33
+
34
+ def list_events(id, params = {})
35
+ @client.request(:get, "/api/v1/integrations/#{id}/events", params)
36
+ end
37
+
38
+ def get_stats(id)
39
+ @client.request(:get, "/api/v1/integrations/#{id}/stats")
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ module HookSniff
4
+ class StreamApi
5
+ def initialize(client)
6
+ @client = client
7
+ end
8
+
9
+ def list_channels
10
+ @client.request(:get, "/api/v1/stream/channels")
11
+ end
12
+
13
+ def get_channel(id)
14
+ @client.request(:get, "/api/v1/stream/channels/#{id}")
15
+ end
16
+
17
+ def create_channel(attrs)
18
+ @client.request(:post, "/api/v1/stream/channels", attrs)
19
+ end
20
+
21
+ def update_channel(id, attrs)
22
+ @client.request(:put, "/api/v1/stream/channels/#{id}", attrs)
23
+ end
24
+
25
+ def delete_channel(id)
26
+ @client.request(:delete, "/api/v1/stream/channels/#{id}")
27
+ end
28
+
29
+ def list_messages(id, params = {})
30
+ @client.request(:get, "/api/v1/stream/channels/#{id}/messages", params)
31
+ end
32
+
33
+ def list_subscriptions
34
+ @client.request(:get, "/api/v1/stream/subscriptions")
35
+ end
36
+
37
+ def disconnect_subscription(id)
38
+ @client.request(:delete, "/api/v1/stream/subscriptions/#{id}")
39
+ end
40
+
41
+ def publish(body)
42
+ @client.request(:post, "/api/v1/stream/publish", body)
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module HookSniff
4
+ class BackgroundTask
5
+ def initialize(api_client)
6
+ @api_client = api_client
7
+ end
8
+
9
+ def list
10
+ @api_client.execute(method: :get, path: "/api/v1/background-tasks")
11
+ end
12
+
13
+ def get(task_id)
14
+ @api_client.execute(method: :get, path: "/api/v1/background-tasks/#{task_id}")
15
+ end
16
+
17
+ def cancel(task_id)
18
+ @api_client.execute(method: :put, path: "/api/v1/background-tasks/#{task_id}")
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ module HookSniff
4
+ class Connector
5
+ def initialize(client)
6
+ @client = client
7
+ end
8
+
9
+ def list
10
+ @client.request(:get, "/api/v1/connectors")
11
+ end
12
+
13
+ def get(id)
14
+ @client.request(:get, "/api/v1/connectors/#{id}")
15
+ end
16
+
17
+ def list_configs
18
+ @client.request(:get, "/api/v1/connectors/configs")
19
+ end
20
+
21
+ def create_config(body)
22
+ @client.request(:post, "/api/v1/connectors/configs", body: body)
23
+ end
24
+
25
+ def update_config(id, body)
26
+ @client.request(:put, "/api/v1/connectors/configs/#{id}", body: body)
27
+ end
28
+
29
+ def delete_config(id)
30
+ @client.request(:delete, "/api/v1/connectors/configs/#{id}")
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ module HookSniff
4
+ class Environment
5
+ def initialize(api_client)
6
+ @api_client = api_client
7
+ end
8
+
9
+ def list
10
+ @api_client.execute(method: :get, path: "/api/v1/environments")
11
+ end
12
+
13
+ def create(environment_in)
14
+ @api_client.execute(method: :post, path: "/api/v1/environments", body: environment_in)
15
+ end
16
+
17
+ def get(environment_id)
18
+ @api_client.execute(method: :get, path: "/api/v1/environments/#{environment_id}")
19
+ end
20
+
21
+ def update(environment_id, environment_patch)
22
+ @api_client.execute(method: :put, path: "/api/v1/environments/#{environment_id}", body: environment_patch)
23
+ end
24
+
25
+ def delete(environment_id)
26
+ @api_client.execute(method: :delete, path: "/api/v1/environments/#{environment_id}")
27
+ end
28
+
29
+ def list_variables(environment_id)
30
+ @api_client.execute(method: :get, path: "/api/v1/environments/#{environment_id}/variables")
31
+ end
32
+
33
+ def get_variable(environment_id, variable_id)
34
+ @api_client.execute(method: :get, path: "/api/v1/environments/#{environment_id}/variables/#{variable_id}")
35
+ end
36
+
37
+ def create_variable(environment_id, variable_in)
38
+ @api_client.execute(method: :post, path: "/api/v1/environments/#{environment_id}/variables", body: variable_in)
39
+ end
40
+
41
+ def update_variable(environment_id, variable_id, variable_in)
42
+ @api_client.execute(method: :put, path: "/api/v1/environments/#{environment_id}/variables/#{variable_id}", body: variable_in)
43
+ end
44
+
45
+ def delete_variable(environment_id, variable_id)
46
+ @api_client.execute(method: :delete, path: "/api/v1/environments/#{environment_id}/variables/#{variable_id}")
47
+ end
48
+
49
+ def bulk_upsert_variables(environment_id, bulk_in)
50
+ @api_client.execute(method: :post, path: "/api/v1/environments/#{environment_id}/variables/bulk", body: bulk_in)
51
+ end
52
+ end
53
+ end
@@ -19,6 +19,14 @@ module HookSniff
19
19
  attr_accessor :message
20
20
  attr_accessor :message_attempt
21
21
  attr_accessor :statistics
22
+ attr_accessor :environment
23
+ attr_accessor :background_task
24
+ attr_accessor :operational_webhook
25
+ attr_accessor :message_poller
26
+ attr_accessor :inbound
27
+ attr_accessor :connector
28
+ attr_accessor :integration
29
+ attr_accessor :stream
22
30
 
23
31
  def initialize(auth_token, options = HookSniffOptions.new)
24
32
  uri = URI(options.server_url || "https://hooksniff-api-1046140057667.europe-west1.run.app")
@@ -31,6 +39,14 @@ module HookSniff
31
39
  @message = Message.new(api_client)
32
40
  @message_attempt = MessageAttempt.new(api_client)
33
41
  @statistics = Statistics.new(api_client)
42
+ @environment = Environment.new(api_client)
43
+ @background_task = BackgroundTask.new(api_client)
44
+ @operational_webhook = OperationalWebhook.new(api_client)
45
+ @message_poller = MessagePoller.new(api_client)
46
+ @inbound = Inbound.new(api_client)
47
+ @connector = Connector.new(api_client)
48
+ @integration = IntegrationApi.new(api_client)
49
+ @stream = StreamApi.new(api_client)
34
50
  end
35
51
  end
36
52
  end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module HookSniff
4
+ class Inbound
5
+ def initialize(client)
6
+ @client = client
7
+ end
8
+
9
+ def list_configs
10
+ @client.request(:get, "/api/v1/inbound/configs")
11
+ end
12
+
13
+ def create_config(body)
14
+ @client.request(:post, "/api/v1/inbound/configs", body: body)
15
+ end
16
+
17
+ def update_config(id, body)
18
+ @client.request(:put, "/api/v1/inbound/configs/#{id}", body: body)
19
+ end
20
+
21
+ def delete_config(id)
22
+ @client.request(:delete, "/api/v1/inbound/configs/#{id}")
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module HookSniff
4
+ class MessagePoller
5
+ def initialize(client)
6
+ @client = client
7
+ end
8
+
9
+ # Poll for new messages since the consumer's cursor.
10
+ def poll(consumer_id, limit: nil, endpoint_id: nil, event_type: nil, include_payload: true)
11
+ params = { consumer_id: consumer_id, include_payload: include_payload }
12
+ params[:limit] = limit if limit
13
+ params[:endpoint_id] = endpoint_id if endpoint_id
14
+ params[:event_type] = event_type if event_type
15
+ @client.request(:get, "/api/v1/message-poller/poll", params: params)
16
+ end
17
+
18
+ # Seek cursor to a specific message.
19
+ def seek(consumer_id, message_id, endpoint_id: nil)
20
+ body = { consumer_id: consumer_id, message_id: message_id }
21
+ body[:endpoint_id] = endpoint_id if endpoint_id
22
+ @client.request(:post, "/api/v1/message-poller/seek", body: body)
23
+ end
24
+
25
+ # Commit cursor — advance past a processed message.
26
+ def commit(consumer_id, message_id, endpoint_id: nil)
27
+ body = { consumer_id: consumer_id, message_id: message_id }
28
+ body[:endpoint_id] = endpoint_id if endpoint_id
29
+ @client.request(:post, "/api/v1/message-poller/commit", body: body)
30
+ end
31
+ end
32
+ end
@@ -63,7 +63,6 @@ module HookSniff
63
63
  def self.deserialize(attributes = {})
64
64
  attributes = attributes.transform_keys(&:to_s)
65
65
  attrs = Hash.new
66
- attrs["application"] = HookSniff::ApplicationIn.deserialize(attributes["application"]) if attributes["application"]
67
66
  attrs["channels"] = attributes["channels"]
68
67
  attrs["deliver_at"] = DateTime.rfc3339(attributes["deliverAt"]).to_time if attributes["deliverAt"]
69
68
  attrs["event_id"] = attributes["eventId"]
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+ module HookSniff
3
+ class OperationalWebhook
4
+ def initialize(api_client) = @api_client = api_client
5
+ def list = @api_client.execute(method: :get, path: "/api/v1/operational-webhooks")
6
+ def create(body) = @api_client.execute(method: :post, path: "/api/v1/operational-webhooks", body: body)
7
+ def get(id) = @api_client.execute(method: :get, path: "/api/v1/operational-webhooks/#{id}")
8
+ def update(id, body) = @api_client.execute(method: :put, path: "/api/v1/operational-webhooks/#{id}", body: body)
9
+ def delete(id) = @api_client.execute(method: :delete, path: "/api/v1/operational-webhooks/#{id}")
10
+ def list_deliveries(id) = @api_client.execute(method: :get, path: "/api/v1/operational-webhooks/#{id}/deliveries")
11
+ end
12
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HookSniff
4
- VERSION = "1.0.0"
4
+ VERSION = "1.1.0"
5
5
  end
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hooksniff
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - HookSniff
8
+ autorequire:
8
9
  bindir: exe
9
10
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
11
+ date: 2026-05-17 00:00:00.000000000 Z
11
12
  dependencies:
12
13
  - !ruby/object:Gem::Dependency
13
14
  name: base64
@@ -96,17 +97,23 @@ files:
96
97
  - lib/hooksniff/api/endpoint.rb
97
98
  - lib/hooksniff/api/event_type.rb
98
99
  - lib/hooksniff/api/health.rb
100
+ - lib/hooksniff/api/integration.rb
99
101
  - lib/hooksniff/api/message.rb
100
102
  - lib/hooksniff/api/message_attempt.rb
101
103
  - lib/hooksniff/api/statistics.rb
104
+ - lib/hooksniff/api/stream.rb
102
105
  - lib/hooksniff/api_error.rb
106
+ - lib/hooksniff/background_task.rb
107
+ - lib/hooksniff/connector.rb
108
+ - lib/hooksniff/environment.rb
103
109
  - lib/hooksniff/errors.rb
104
110
  - lib/hooksniff/hooksniff.rb
105
111
  - lib/hooksniff/hooksniff_http_client.rb
106
112
  - lib/hooksniff/http_error_out.rb
107
113
  - lib/hooksniff/http_validation_error.rb
114
+ - lib/hooksniff/inbound.rb
108
115
  - lib/hooksniff/internal.rb
109
- - lib/hooksniff/models/aggregate_event_types_out.rb
116
+ - lib/hooksniff/message_poller.rb
110
117
  - lib/hooksniff/models/endpoint_created_event.rb
111
118
  - lib/hooksniff/models/endpoint_created_event_data.rb
112
119
  - lib/hooksniff/models/endpoint_deleted_event.rb
@@ -144,8 +151,6 @@ files:
144
151
  - lib/hooksniff/models/message_attempt_log.rb
145
152
  - lib/hooksniff/models/message_attempt_log_event.rb
146
153
  - lib/hooksniff/models/message_attempt_out.rb
147
- - lib/hooksniff/models/message_attempt_recovered_event.rb
148
- - lib/hooksniff/models/message_attempt_recovered_event_data.rb
149
154
  - lib/hooksniff/models/message_attempt_trigger_type.rb
150
155
  - lib/hooksniff/models/message_endpoint_out.rb
151
156
  - lib/hooksniff/models/message_in.rb
@@ -154,6 +159,7 @@ files:
154
159
  - lib/hooksniff/models/message_status_text.rb
155
160
  - lib/hooksniff/models/ordering.rb
156
161
  - lib/hooksniff/models/status_code_class.rb
162
+ - lib/hooksniff/operational_webhook.rb
157
163
  - lib/hooksniff/util.rb
158
164
  - lib/hooksniff/validation_error.rb
159
165
  - lib/hooksniff/version.rb
@@ -166,6 +172,7 @@ metadata:
166
172
  allowed_push_host: https://rubygems.org
167
173
  homepage_uri: https://hooksniff.vercel.app
168
174
  source_code_uri: https://github.com/servetarslan02/HookSniff
175
+ post_install_message:
169
176
  rdoc_options: []
170
177
  require_paths:
171
178
  - lib
@@ -180,7 +187,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
180
187
  - !ruby/object:Gem::Version
181
188
  version: '0'
182
189
  requirements: []
183
- rubygems_version: 4.0.6
190
+ rubygems_version: 3.4.20
191
+ signing_key:
184
192
  specification_version: 4
185
193
  summary: HookSniff webhooks API client and webhook verification library
186
194
  test_files: []
@@ -1,59 +0,0 @@
1
- # frozen_string_literal: true
2
- # This file is @generated
3
- require "json"
4
-
5
- module HookSniff
6
- class AggregateEventTypesOut
7
- # The QueueBackgroundTask's ID.
8
- attr_accessor :id
9
- attr_accessor :status
10
- attr_accessor :task
11
- attr_accessor :updated_at
12
-
13
- ALL_FIELD ||= ["id", "status", "task", "updated_at"].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::AggregateEventTypesOut` 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::AggregateEventTypesOut")
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["id"] = attributes["id"]
38
- attrs["status"] = HookSniff::BackgroundTaskStatus.deserialize(attributes["status"])
39
- attrs["task"] = HookSniff::BackgroundTaskType.deserialize(attributes["task"])
40
- attrs["updated_at"] = DateTime.rfc3339(attributes["updatedAt"]).to_time
41
- new(attrs)
42
- end
43
-
44
- def serialize
45
- out = Hash.new
46
- out["id"] = HookSniff::serialize_primitive(@id) if @id
47
- out["status"] = HookSniff::serialize_schema_ref(@status) if @status
48
- out["task"] = HookSniff::serialize_schema_ref(@task) if @task
49
- out["updatedAt"] = HookSniff::serialize_primitive(@updated_at) if @updated_at
50
- out
51
- end
52
-
53
- # Serializes the object to a json string
54
- # @return String
55
- def to_json
56
- JSON.dump(serialize)
57
- end
58
- end
59
- end
@@ -1,53 +0,0 @@
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
@@ -1,70 +0,0 @@
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