hooksniff 1.1.1 → 1.3.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.lock +2 -2
- data/README.md +45 -20
- data/hooksniff.gemspec +1 -1
- data/lib/hooksniff/api/alert.rb +34 -0
- data/lib/hooksniff/api/analytics.rb +21 -0
- data/lib/hooksniff/api/api_key.rb +26 -0
- data/lib/hooksniff/api/application.rb +30 -0
- data/lib/hooksniff/api/audit_log.rb +17 -0
- data/lib/hooksniff/api/authentication.rb +0 -13
- data/lib/hooksniff/api/background_task.rb +21 -0
- data/lib/hooksniff/api/billing.rb +34 -0
- data/lib/hooksniff/api/connector.rb +33 -0
- data/lib/hooksniff/api/custom_domain.rb +26 -0
- data/lib/hooksniff/api/environment.rb +47 -0
- data/lib/hooksniff/api/inbound.rb +30 -0
- data/lib/hooksniff/api/integration.rb +8 -8
- data/lib/hooksniff/api/message_poller.rb +21 -0
- data/lib/hooksniff/api/notification.rb +30 -0
- data/lib/hooksniff/api/operational_webhook.rb +34 -0
- data/lib/hooksniff/api/playground.rb +17 -0
- data/lib/hooksniff/api/portal.rb +33 -0
- data/lib/hooksniff/api/rate_limit.rb +26 -0
- data/lib/hooksniff/api/routing.rb +21 -0
- data/lib/hooksniff/api/schema.rb +25 -0
- data/lib/hooksniff/api/search.rb +13 -0
- data/lib/hooksniff/api/service_token.rb +22 -0
- data/lib/hooksniff/api/sso.rb +26 -0
- data/lib/hooksniff/api/statistics.rb +0 -13
- data/lib/hooksniff/api/stream.rb +28 -9
- data/lib/hooksniff/api/team.rb +42 -0
- data/lib/hooksniff/api/template.rb +21 -0
- data/lib/hooksniff/errors.rb +79 -0
- data/lib/hooksniff/hooksniff_http_client.rb +48 -9
- data/lib/hooksniff/models/aggregate_event_types_out.rb +59 -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_in.rb +1 -0
- data/lib/hooksniff/options.rb +31 -0
- data/lib/hooksniff/paginator.rb +45 -0
- data/lib/hooksniff/response_metadata.rb +48 -0
- data/lib/hooksniff/version.rb +1 -1
- data/lib/hooksniff/webhook.rb +62 -0
- data/lib/hooksniff/webhook_event.rb +295 -0
- data/lib/hooksniff.rb +135 -66
- data/test/test_hooksniff.rb +0 -11
- data/test/test_typed_events.rb +260 -0
- metadata +36 -13
- data/lib/hooksniff/background_task.rb +0 -21
- data/lib/hooksniff/connector.rb +0 -33
- data/lib/hooksniff/environment.rb +0 -53
- data/lib/hooksniff/inbound.rb +0 -25
- data/lib/hooksniff/message_poller.rb +0 -32
- data/lib/hooksniff/operational_webhook.rb +0 -12
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a947ca7c8c9c75d2aac6b59f30cd1e0c7f6096aee40816fb16bba954ff60570b
|
|
4
|
+
data.tar.gz: da3d3b65337ff775633efc6ce7797cdd23033a3f2b1b9cfb5bdc3096b485f4e1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f609bcef3b51f1fee6540b705bb9191f54b7cc3c681346a08b1482d1aeef0a52e661f0b26f6e432f30995bbff1b54ae043c775b42938c25975da4fcfe36ac3f8
|
|
7
|
+
data.tar.gz: a3c6d7bf7516cf4e41fdb531af663d8036056210e853a54c46674e2a56f60a41523b7f53ac06bd4c1e226711c0143281d8f276a89e39820447757b1b2275998a
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
|
|
4
|
+
hooksniff (1.2.0)
|
|
5
5
|
base64 (~> 0.3.0)
|
|
6
6
|
logger (~> 1.0)
|
|
7
7
|
|
|
@@ -45,11 +45,11 @@ PLATFORMS
|
|
|
45
45
|
|
|
46
46
|
DEPENDENCIES
|
|
47
47
|
base64
|
|
48
|
+
hooksniff!
|
|
48
49
|
logger
|
|
49
50
|
ostruct
|
|
50
51
|
rake (~> 13.0)
|
|
51
52
|
rspec (~> 3.2)
|
|
52
|
-
svix!
|
|
53
53
|
webmock (~> 3.25)
|
|
54
54
|
|
|
55
55
|
BUNDLED WITH
|
data/README.md
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
# HookSniff Ruby SDK
|
|
2
2
|
|
|
3
3
|
<p align="center">
|
|
4
|
-
<a href="https://
|
|
4
|
+
<a href="https://rubygems.org/gems/hooksniff"><img src="https://img.shields.io/gem/v/hooksniff.svg" alt="Gem"></a>
|
|
5
|
+
<a href="https://github.com/servetarslan02/hooksniff-ruby"><img src="https://img.shields.io/github/license/servetarslan02/hooksniff-ruby" alt="License"></a>
|
|
5
6
|
</p>
|
|
6
7
|
|
|
7
|
-
Ruby SDK for the [HookSniff](https://hooksniff.
|
|
8
|
+
Ruby SDK for the [HookSniff](https://hooksniff.vercel.app) webhook delivery platform.
|
|
8
9
|
|
|
9
10
|
## Installation
|
|
10
11
|
|
|
12
|
+
```ruby
|
|
13
|
+
gem 'hooksniff'
|
|
14
|
+
```
|
|
15
|
+
|
|
11
16
|
```bash
|
|
12
17
|
gem install hooksniff
|
|
13
18
|
```
|
|
@@ -15,33 +20,53 @@ gem install hooksniff
|
|
|
15
20
|
## Quick Start
|
|
16
21
|
|
|
17
22
|
```ruby
|
|
18
|
-
require
|
|
23
|
+
require 'hooksniff'
|
|
24
|
+
|
|
25
|
+
hs = HookSniff::Client.new('hooksniff_xxx')
|
|
26
|
+
|
|
27
|
+
# List endpoints
|
|
28
|
+
endpoints = hs.endpoints.list
|
|
19
29
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
30
|
+
# Send a webhook
|
|
31
|
+
delivery = hs.messages.create(
|
|
32
|
+
endpoint_id: 'ep_xxx',
|
|
33
|
+
event: 'order.created',
|
|
34
|
+
data: { order_id: '123', amount: 99.99 }
|
|
35
|
+
)
|
|
23
36
|
```
|
|
24
37
|
|
|
25
38
|
## Webhook Verification
|
|
26
39
|
|
|
27
40
|
```ruby
|
|
28
|
-
wh = HookSniff::Webhook.new(
|
|
41
|
+
wh = HookSniff::Webhook.new('whsec_xxx')
|
|
29
42
|
payload = wh.verify(body, headers)
|
|
30
43
|
```
|
|
31
44
|
|
|
32
|
-
## Resources
|
|
45
|
+
## API Resources
|
|
33
46
|
|
|
34
47
|
| Resource | Methods |
|
|
35
48
|
|----------|---------|
|
|
36
|
-
|
|
|
37
|
-
|
|
|
38
|
-
|
|
|
39
|
-
|
|
|
40
|
-
|
|
|
41
|
-
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
49
|
+
| Endpoints | list, create, get, update, delete, rotate_secret |
|
|
50
|
+
| Messages | create, list, get |
|
|
51
|
+
| MessageAttempts | list, get, resend, list_by_msg |
|
|
52
|
+
| EventTypes | list, create, get, update, delete |
|
|
53
|
+
| Stream | list_channels, get_channel, create_channel, subscribe, publish |
|
|
54
|
+
| Authentication | login, register, logout |
|
|
55
|
+
| BackgroundTasks | list, get |
|
|
56
|
+
| Connectors | list, get |
|
|
57
|
+
| Integrations | list, get, create, update, delete |
|
|
58
|
+
| Inbound | list, create, get, delete |
|
|
59
|
+
|
|
60
|
+
## Features
|
|
61
|
+
|
|
62
|
+
- ✅ HMAC-SHA256 webhook verification
|
|
63
|
+
- ✅ Typed webhook events
|
|
64
|
+
- ✅ Automatic retry with exponential backoff
|
|
65
|
+
- ✅ Pagination helpers
|
|
66
|
+
- ✅ Rate limit header parsing
|
|
67
|
+
- ✅ SSE streaming
|
|
68
|
+
- ✅ Idempotency keys
|
|
69
|
+
|
|
70
|
+
## License
|
|
71
|
+
|
|
72
|
+
MIT
|
data/hooksniff.gemspec
CHANGED
|
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
|
|
|
8
8
|
spec.name = "hooksniff"
|
|
9
9
|
spec.version = HookSniff::VERSION
|
|
10
10
|
spec.authors = ["HookSniff"]
|
|
11
|
-
spec.email = ["
|
|
11
|
+
spec.email = ["servetarslan02@gmail.com"]
|
|
12
12
|
spec.license = "MIT"
|
|
13
13
|
|
|
14
14
|
spec.summary = "HookSniff webhooks API client and webhook verification library"
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module HookSniff
|
|
4
|
+
class Alert
|
|
5
|
+
def initialize(client)
|
|
6
|
+
@client = client
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def list
|
|
10
|
+
@client.execute_request("GET", "/v1/alerts")
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def get(id)
|
|
14
|
+
@client.execute_request("GET", "/v1/alerts/#{id}")
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def create(attrs)
|
|
18
|
+
@client.execute_request("POST", "/v1/alerts", body: attrs)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def update(id, attrs)
|
|
22
|
+
@client.execute_request("PUT", "/v1/alerts/#{id}", body: attrs)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def delete(id)
|
|
26
|
+
@client.execute_request("DELETE", "/v1/alerts/#{id}")
|
|
27
|
+
nil
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def test(id)
|
|
31
|
+
@client.execute_request("POST", "/v1/alerts/#{id}/test")
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module HookSniff
|
|
4
|
+
class Analytics
|
|
5
|
+
def initialize(client)
|
|
6
|
+
@client = client
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def delivery_trend(params = {})
|
|
10
|
+
@client.execute_request("GET", "/v1/analytics/deliveries", query_params: params)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def success_rate(params = {})
|
|
14
|
+
@client.execute_request("GET", "/v1/analytics/success-rate", query_params: params)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def latency(params = {})
|
|
18
|
+
@client.execute_request("GET", "/v1/analytics/latency", query_params: params)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module HookSniff
|
|
4
|
+
class ApiKey
|
|
5
|
+
def initialize(client)
|
|
6
|
+
@client = client
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def list
|
|
10
|
+
@client.execute_request("GET", "/v1/api-keys")
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def create(attrs)
|
|
14
|
+
@client.execute_request("POST", "/v1/api-keys", body: attrs)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def delete(id)
|
|
18
|
+
@client.execute_request("DELETE", "/v1/api-keys/#{id}")
|
|
19
|
+
nil
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def rotate(id)
|
|
23
|
+
@client.execute_request("POST", "/v1/api-keys/#{id}/rotate")
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module HookSniff
|
|
4
|
+
class Application
|
|
5
|
+
def initialize(client)
|
|
6
|
+
@client = client
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def list(params = {})
|
|
10
|
+
@client.execute_request("GET", "/v1/applications", query_params: params)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def get(id)
|
|
14
|
+
@client.execute_request("GET", "/v1/applications/#{id}")
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def create(attrs)
|
|
18
|
+
@client.execute_request("POST", "/v1/applications", body: attrs)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def update(id, attrs)
|
|
22
|
+
@client.execute_request("PUT", "/v1/applications/#{id}", body: attrs)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def delete(id)
|
|
26
|
+
@client.execute_request("DELETE", "/v1/applications/#{id}")
|
|
27
|
+
nil
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module HookSniff
|
|
4
|
+
class AuditLog
|
|
5
|
+
def initialize(client)
|
|
6
|
+
@client = client
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def list(params = {})
|
|
10
|
+
@client.execute_request("GET", "/v1/audit-log", query_params: params)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def get(id)
|
|
14
|
+
@client.execute_request("GET", "/v1/audit-log/#{id}")
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -8,19 +8,6 @@ module HookSniff
|
|
|
8
8
|
@client = client
|
|
9
9
|
end
|
|
10
10
|
|
|
11
|
-
def app_portal_access(app_id, app_portal_access_in, options = {})
|
|
12
|
-
options = options.transform_keys(&:to_s)
|
|
13
|
-
res = @client.execute_request(
|
|
14
|
-
"POST",
|
|
15
|
-
"/v1/auth/portal-access/#{app_id}",
|
|
16
|
-
headers: {
|
|
17
|
-
"idempotency-key" => options["idempotency-key"]
|
|
18
|
-
},
|
|
19
|
-
body: app_portal_access_in
|
|
20
|
-
)
|
|
21
|
-
DashboardAccessOut.deserialize(res)
|
|
22
|
-
end
|
|
23
|
-
|
|
24
11
|
def logout(options = {})
|
|
25
12
|
options = options.transform_keys(&:to_s)
|
|
26
13
|
@client.execute_request(
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module HookSniff
|
|
4
|
+
class BackgroundTask
|
|
5
|
+
def initialize(client)
|
|
6
|
+
@client = client
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def list(params = {})
|
|
10
|
+
@client.execute_request("GET", "/v1/background-tasks", query_params: params)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def get(id)
|
|
14
|
+
@client.execute_request("GET", "/v1/background-tasks/#{id}")
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def cancel(id)
|
|
18
|
+
@client.execute_request("PUT", "/v1/background-tasks/#{id}")
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module HookSniff
|
|
4
|
+
class Billing
|
|
5
|
+
def initialize(client)
|
|
6
|
+
@client = client
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def get_subscription
|
|
10
|
+
@client.execute_request("GET", "/v1/billing/subscription")
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def cancel_subscription
|
|
14
|
+
@client.execute_request("DELETE", "/v1/billing/subscription")
|
|
15
|
+
nil
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def upgrade(attrs)
|
|
19
|
+
@client.execute_request("POST", "/v1/billing/upgrade", body: attrs)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def open_portal
|
|
23
|
+
@client.execute_request("POST", "/v1/billing/portal")
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def get_usage
|
|
27
|
+
@client.execute_request("GET", "/v1/billing/usage")
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def get_invoices
|
|
31
|
+
@client.execute_request("GET", "/v1/billing/invoices")
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
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(params = {})
|
|
10
|
+
@client.execute_request("GET", "/v1/connectors", query_params: params)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def get(id)
|
|
14
|
+
@client.execute_request("GET", "/v1/connectors/#{id}")
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def list_configs
|
|
18
|
+
@client.execute_request("GET", "/v1/connectors/configs")
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def get_config(id)
|
|
22
|
+
@client.execute_request("GET", "/v1/connectors/configs/#{id}")
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def create_config(attrs)
|
|
26
|
+
@client.execute_request("POST", "/v1/connectors/configs", body: attrs)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def update_config(id, attrs)
|
|
30
|
+
@client.execute_request("PUT", "/v1/connectors/configs/#{id}", body: attrs)
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module HookSniff
|
|
4
|
+
class CustomDomain
|
|
5
|
+
def initialize(client)
|
|
6
|
+
@client = client
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def list
|
|
10
|
+
@client.execute_request("GET", "/v1/custom-domains")
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def add(attrs)
|
|
14
|
+
@client.execute_request("POST", "/v1/custom-domains", body: attrs)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def delete(id)
|
|
18
|
+
@client.execute_request("DELETE", "/v1/custom-domains/#{id}")
|
|
19
|
+
nil
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def verify(id)
|
|
23
|
+
@client.execute_request("POST", "/v1/custom-domains/#{id}/verify")
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module HookSniff
|
|
4
|
+
class Environment
|
|
5
|
+
def initialize(client)
|
|
6
|
+
@client = client
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def list(params = {})
|
|
10
|
+
@client.execute_request("GET", "/v1/environments", query_params: params)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def get(id)
|
|
14
|
+
@client.execute_request("GET", "/v1/environments/#{id}")
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def create(attrs)
|
|
18
|
+
@client.execute_request("POST", "/v1/environments", body: attrs)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def update(id, attrs)
|
|
22
|
+
@client.execute_request("PUT", "/v1/environments/#{id}", body: attrs)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def delete(id)
|
|
26
|
+
@client.execute_request("DELETE", "/v1/environments/#{id}")
|
|
27
|
+
nil
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def list_variables(env_id)
|
|
31
|
+
@client.execute_request("GET", "/v1/environments/#{env_id}/variables")
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def create_variable(env_id, attrs)
|
|
35
|
+
@client.execute_request("POST", "/v1/environments/#{env_id}/variables", body: attrs)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def update_variable(env_id, var_id, attrs)
|
|
39
|
+
@client.execute_request("PUT", "/v1/environments/#{env_id}/variables/#{var_id}", body: attrs)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def delete_variable(env_id, var_id)
|
|
43
|
+
@client.execute_request("DELETE", "/v1/environments/#{env_id}/variables/#{var_id}")
|
|
44
|
+
nil
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
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.execute_request("GET", "/v1/inbound/configs")
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def get_config(id)
|
|
14
|
+
@client.execute_request("GET", "/v1/inbound/configs/#{id}")
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def create_config(attrs)
|
|
18
|
+
@client.execute_request("POST", "/v1/inbound/configs", body: attrs)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def update_config(id, attrs)
|
|
22
|
+
@client.execute_request("PUT", "/v1/inbound/configs/#{id}", body: attrs)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def delete_config(id)
|
|
26
|
+
@client.execute_request("DELETE", "/v1/inbound/configs/#{id}")
|
|
27
|
+
nil
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -7,36 +7,36 @@ module HookSniff
|
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
def list
|
|
10
|
-
@client.request(:get, "/
|
|
10
|
+
@client.request(:get, "/v1/integrations")
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
def get(id)
|
|
14
|
-
@client.request(:get, "/
|
|
14
|
+
@client.request(:get, "/v1/integrations/#{id}")
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
create_attrs = %i[name description connector_config_id endpoint_id event_filter transform_id retry_policy metadata enabled]
|
|
18
18
|
def create(attrs)
|
|
19
|
-
@client.request(:post, "/
|
|
19
|
+
@client.request(:post, "/v1/integrations", attrs)
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
def update(id, attrs)
|
|
23
|
-
@client.request(:put, "/
|
|
23
|
+
@client.request(:put, "/v1/integrations/#{id}", attrs)
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
def delete(id)
|
|
27
|
-
@client.request(:delete, "/
|
|
27
|
+
@client.request(:delete, "/v1/integrations/#{id}")
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
def test(id)
|
|
31
|
-
@client.request(:post, "/
|
|
31
|
+
@client.request(:post, "/v1/integrations/#{id}/test")
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
def list_events(id, params = {})
|
|
35
|
-
@client.request(:get, "/
|
|
35
|
+
@client.request(:get, "/v1/integrations/#{id}/events", params)
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
def get_stats(id)
|
|
39
|
-
@client.request(:get, "/
|
|
39
|
+
@client.request(:get, "/v1/integrations/#{id}/stats")
|
|
40
40
|
end
|
|
41
41
|
end
|
|
42
42
|
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module HookSniff
|
|
4
|
+
class MessagePoller
|
|
5
|
+
def initialize(client)
|
|
6
|
+
@client = client
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def poll(params = {})
|
|
10
|
+
@client.execute_request("GET", "/v1/message-poller/poll", query_params: params)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def seek(attrs)
|
|
14
|
+
@client.execute_request("POST", "/v1/message-poller/seek", body: attrs)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def commit(attrs)
|
|
18
|
+
@client.execute_request("POST", "/v1/message-poller/commit", body: attrs)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module HookSniff
|
|
4
|
+
class Notification
|
|
5
|
+
def initialize(client)
|
|
6
|
+
@client = client
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def list
|
|
10
|
+
@client.execute_request("GET", "/v1/notifications")
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def unread_count
|
|
14
|
+
@client.execute_request("GET", "/v1/notifications/unread-count")
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def mark_all_read
|
|
18
|
+
@client.execute_request("PUT", "/v1/notifications/read-all")
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def mark_read(id)
|
|
22
|
+
@client.execute_request("PUT", "/v1/notifications/#{id}/read")
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def delete(id)
|
|
26
|
+
@client.execute_request("DELETE", "/v1/notifications/#{id}")
|
|
27
|
+
nil
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module HookSniff
|
|
4
|
+
class OperationalWebhook
|
|
5
|
+
def initialize(client)
|
|
6
|
+
@client = client
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def list_endpoints(params = {})
|
|
10
|
+
@client.execute_request("GET", "/v1/operational-webhooks", query_params: params)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def get_endpoint(id)
|
|
14
|
+
@client.execute_request("GET", "/v1/operational-webhooks/#{id}")
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def create_endpoint(attrs)
|
|
18
|
+
@client.execute_request("POST", "/v1/operational-webhooks", body: attrs)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def update_endpoint(id, attrs)
|
|
22
|
+
@client.execute_request("PUT", "/v1/operational-webhooks/#{id}", body: attrs)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def delete_endpoint(id)
|
|
26
|
+
@client.execute_request("DELETE", "/v1/operational-webhooks/#{id}")
|
|
27
|
+
nil
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def list_deliveries(endpoint_id)
|
|
31
|
+
@client.execute_request("GET", "/v1/operational-webhooks/#{endpoint_id}/deliveries")
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module HookSniff
|
|
4
|
+
class Playground
|
|
5
|
+
def initialize(client)
|
|
6
|
+
@client = client
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def get
|
|
10
|
+
@client.execute_request("GET", "/v1/playground")
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def test(attrs)
|
|
14
|
+
@client.execute_request("POST", "/v1/playground/test", body: attrs)
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module HookSniff
|
|
4
|
+
class Portal
|
|
5
|
+
def initialize(client)
|
|
6
|
+
@client = client
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def get_profile
|
|
10
|
+
@client.execute_request("GET", "/v1/portal/me")
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def update_profile(attrs)
|
|
14
|
+
@client.execute_request("PUT", "/v1/portal/me", body: attrs)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def get_usage
|
|
18
|
+
@client.execute_request("GET", "/v1/portal/usage")
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def get_plan
|
|
22
|
+
@client.execute_request("GET", "/v1/portal/plan")
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def get_notifications
|
|
26
|
+
@client.execute_request("GET", "/v1/portal/notifications")
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def update_notifications(attrs)
|
|
30
|
+
@client.execute_request("PUT", "/v1/portal/notifications", body: attrs)
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|