hookbridge 1.8.0 → 2.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 +4 -4
- data/lib/hookbridge/client.rb +19 -43
- data/lib/hookbridge/types.rb +8 -20
- data/lib/hookbridge/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3faed23c2d36e3294b89adf7dd7843f9f6cc7f8697a3ffe9ceeb8541818fc257
|
|
4
|
+
data.tar.gz: a23ce4da13495686b9ad4322f6a02e5bd55a305f0a77405e43c23e1404e5d9c1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 514e54ba5311f92a5a34d6a5a7fead2a2197467ad4ff5d79395d8af6d5218042ac82324d9858017f0eaf13cd256fa38ffff4f42aec1b63a7850a5ce35eac3a8b
|
|
7
|
+
data.tar.gz: a9d084fd4c19ea785642539de316b20aa5fdde48614da099a6da8a271b026b9b6123af1354a2f7dae25f941e4c83e96f379050905f7b2175a0fc3f08dc4c78c6
|
data/lib/hookbridge/client.rb
CHANGED
|
@@ -25,10 +25,11 @@ module HookBridge
|
|
|
25
25
|
@send_connection = build_connection(@send_url)
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
-
def send(endpoint_id:, payload:, headers: nil, idempotency_key: nil)
|
|
28
|
+
def send(endpoint_id:, payload:, headers: nil, idempotency_key: nil, retention_hours: nil)
|
|
29
29
|
body = { endpoint_id: endpoint_id, payload: payload }
|
|
30
30
|
body[:headers] = headers if headers
|
|
31
31
|
body[:idempotency_key] = idempotency_key if idempotency_key
|
|
32
|
+
body[:retention_hours] = retention_hours unless retention_hours.nil?
|
|
32
33
|
SendResponse.new(extract_data(request(:post, "/v1/webhooks/send", body, use_send_connection: true)))
|
|
33
34
|
end
|
|
34
35
|
|
|
@@ -128,39 +129,16 @@ module HookBridge
|
|
|
128
129
|
true
|
|
129
130
|
end
|
|
130
131
|
|
|
131
|
-
def
|
|
132
|
-
|
|
133
|
-
end
|
|
134
|
-
|
|
135
|
-
def create_project(name:, rate_limit_default: nil)
|
|
136
|
-
body = { name: name }
|
|
137
|
-
body[:rate_limit_default] = rate_limit_default if rate_limit_default
|
|
138
|
-
Project.new(extract_data(request(:post, "/v1/projects", body)))
|
|
139
|
-
end
|
|
140
|
-
|
|
141
|
-
def get_project(project_id)
|
|
142
|
-
Project.new(extract_data(request(:get, "/v1/projects/#{project_id}")))
|
|
143
|
-
end
|
|
144
|
-
|
|
145
|
-
def update_project(project_id, name: nil, rate_limit_default: nil)
|
|
146
|
-
body = {}
|
|
147
|
-
body[:name] = name if name
|
|
148
|
-
body[:rate_limit_default] = rate_limit_default if rate_limit_default
|
|
149
|
-
Project.new(extract_data(request(:put, "/v1/projects/#{project_id}", body)))
|
|
150
|
-
end
|
|
151
|
-
|
|
152
|
-
def delete_project(project_id)
|
|
153
|
-
request(:delete, "/v1/projects/#{project_id}")
|
|
154
|
-
true
|
|
155
|
-
end
|
|
156
|
-
|
|
157
|
-
def create_endpoint(url:, description: nil, hmac_enabled: nil, rate_limit_rps: 0, burst: 0, headers: nil)
|
|
132
|
+
def create_endpoint(url:, description: nil, hmac_enabled: nil, rate_limit_rps: 0, burst: 0, headers: nil,
|
|
133
|
+
ephemeral: nil, ttl_minutes: nil)
|
|
158
134
|
body = { url: url }
|
|
159
135
|
body[:description] = description if description
|
|
160
136
|
body[:hmac_enabled] = hmac_enabled unless hmac_enabled.nil?
|
|
161
137
|
body[:rate_limit_rps] = rate_limit_rps if rate_limit_rps.positive?
|
|
162
138
|
body[:burst] = burst if burst.positive?
|
|
163
139
|
body[:headers] = headers if headers
|
|
140
|
+
body[:ephemeral] = ephemeral unless ephemeral.nil?
|
|
141
|
+
body[:ttl_minutes] = ttl_minutes unless ttl_minutes.nil?
|
|
164
142
|
CreateEndpointResponse.new(extract_data(request(:post, "/v1/endpoints", body)))
|
|
165
143
|
end
|
|
166
144
|
|
|
@@ -224,11 +202,13 @@ module HookBridge
|
|
|
224
202
|
create_endpoint_signing_key(endpoint_id)
|
|
225
203
|
end
|
|
226
204
|
|
|
227
|
-
def create_pull_endpoint(name: nil, description: nil, retention_days: nil, event_type_source: nil,
|
|
205
|
+
def create_pull_endpoint(name: nil, description: nil, retention_days: nil, event_type_source: nil,
|
|
206
|
+
event_type_path: nil,
|
|
228
207
|
verify_static_token: nil, token_header_name: nil, token_query_param: nil, token_value: nil,
|
|
229
208
|
verify_hmac: nil, hmac_header_name: nil, hmac_secret: nil, timestamp_header_name: nil,
|
|
230
209
|
timestamp_ttl_seconds: nil, verify_ip_allowlist: nil, allowed_cidrs: nil,
|
|
231
|
-
idempotency_header_names: nil, ingest_response_code: nil
|
|
210
|
+
idempotency_header_names: nil, ingest_response_code: nil,
|
|
211
|
+
hmac_signature_encoding: nil)
|
|
232
212
|
body = compact_hash(
|
|
233
213
|
name: name,
|
|
234
214
|
description: description,
|
|
@@ -241,6 +221,7 @@ module HookBridge
|
|
|
241
221
|
token_value: token_value,
|
|
242
222
|
verify_hmac: verify_hmac,
|
|
243
223
|
hmac_header_name: hmac_header_name,
|
|
224
|
+
hmac_signature_encoding: hmac_signature_encoding,
|
|
244
225
|
hmac_secret: hmac_secret,
|
|
245
226
|
timestamp_header_name: timestamp_header_name,
|
|
246
227
|
timestamp_ttl_seconds: timestamp_ttl_seconds,
|
|
@@ -340,16 +321,6 @@ module HookBridge
|
|
|
340
321
|
PullTimeSeriesMetrics.new(extract_data(request(:get, "/v1/pull-metrics/timeseries", nil, params)))
|
|
341
322
|
end
|
|
342
323
|
|
|
343
|
-
def create_checkout(plan:, interval:)
|
|
344
|
-
CheckoutSession.new(extract_data(request(:post, "/v1/billing/checkout", { plan: plan, interval: interval })))
|
|
345
|
-
end
|
|
346
|
-
|
|
347
|
-
def create_portal(return_url: nil)
|
|
348
|
-
body = {}
|
|
349
|
-
body[:return_url] = return_url if return_url
|
|
350
|
-
PortalSession.new(extract_data(request(:post, "/v1/billing/portal", body)))
|
|
351
|
-
end
|
|
352
|
-
|
|
353
324
|
def get_usage_history(limit: 12, offset: 0)
|
|
354
325
|
response = request(:get, "/v1/billing/usage-history", nil, { limit: limit, offset: offset })
|
|
355
326
|
UsageHistoryResponse.new(extract_data(response), extract_meta(response))
|
|
@@ -362,7 +333,7 @@ module HookBridge
|
|
|
362
333
|
InvoicesResponse.new(extract_data(response), extract_meta(response))
|
|
363
334
|
end
|
|
364
335
|
|
|
365
|
-
def create_inbound_endpoint(url: nil, name: nil, description: nil, mode: nil, verify_static_token: nil, token_header_name: nil, token_query_param: nil, token_value: nil, verify_hmac: nil, hmac_header_name: nil, hmac_secret: nil, timestamp_header_name: nil, timestamp_ttl_seconds: nil, verify_ip_allowlist: nil, allowed_cidrs: nil, idempotency_header_names: nil, ingest_response_code: nil, signing_enabled: nil)
|
|
336
|
+
def create_inbound_endpoint(url: nil, name: nil, description: nil, mode: nil, verify_static_token: nil, token_header_name: nil, token_query_param: nil, token_value: nil, verify_hmac: nil, hmac_header_name: nil, hmac_secret: nil, timestamp_header_name: nil, timestamp_ttl_seconds: nil, verify_ip_allowlist: nil, allowed_cidrs: nil, idempotency_header_names: nil, ingest_response_code: nil, signing_enabled: nil, ephemeral: nil, ttl_minutes: nil, hmac_signature_encoding: nil)
|
|
366
337
|
body = {}
|
|
367
338
|
body[:url] = url unless url.nil?
|
|
368
339
|
{
|
|
@@ -375,6 +346,7 @@ module HookBridge
|
|
|
375
346
|
token_value: token_value,
|
|
376
347
|
verify_hmac: verify_hmac,
|
|
377
348
|
hmac_header_name: hmac_header_name,
|
|
349
|
+
hmac_signature_encoding: hmac_signature_encoding,
|
|
378
350
|
hmac_secret: hmac_secret,
|
|
379
351
|
timestamp_header_name: timestamp_header_name,
|
|
380
352
|
timestamp_ttl_seconds: timestamp_ttl_seconds,
|
|
@@ -382,7 +354,9 @@ module HookBridge
|
|
|
382
354
|
allowed_cidrs: allowed_cidrs,
|
|
383
355
|
idempotency_header_names: idempotency_header_names,
|
|
384
356
|
ingest_response_code: ingest_response_code,
|
|
385
|
-
signing_enabled: signing_enabled
|
|
357
|
+
signing_enabled: signing_enabled,
|
|
358
|
+
ephemeral: ephemeral,
|
|
359
|
+
ttl_minutes: ttl_minutes
|
|
386
360
|
}.each do |key, value|
|
|
387
361
|
body[key] = value unless value.nil?
|
|
388
362
|
end
|
|
@@ -512,10 +486,12 @@ module HookBridge
|
|
|
512
486
|
)
|
|
513
487
|
end
|
|
514
488
|
|
|
515
|
-
def create_export(start_time:, end_time:, status: nil, endpoint_id: nil)
|
|
489
|
+
def create_export(start_time:, end_time:, status: nil, endpoint_id: nil, direction: nil, inbound_endpoint_id: nil)
|
|
516
490
|
body = { start_time: format_time(start_time), end_time: format_time(end_time) }
|
|
517
491
|
body[:status] = status if status
|
|
518
492
|
body[:endpoint_id] = endpoint_id if endpoint_id
|
|
493
|
+
body[:direction] = direction if direction
|
|
494
|
+
body[:inbound_endpoint_id] = inbound_endpoint_id if inbound_endpoint_id
|
|
519
495
|
ExportRecord.new(extract_data(request(:post, "/v1/exports", body)))
|
|
520
496
|
end
|
|
521
497
|
|
data/lib/hookbridge/types.rb
CHANGED
|
@@ -75,13 +75,13 @@ module HookBridge
|
|
|
75
75
|
|
|
76
76
|
class Message < BaseModel
|
|
77
77
|
def initialize(data)
|
|
78
|
-
super(data, time_fields: %w[next_attempt_at created_at updated_at deleted_at])
|
|
78
|
+
super(data, time_fields: %w[next_attempt_at first_attempt_at created_at updated_at deleted_at])
|
|
79
79
|
end
|
|
80
80
|
end
|
|
81
81
|
|
|
82
82
|
class MessageSummary < BaseModel
|
|
83
83
|
def initialize(data)
|
|
84
|
-
super(data, time_fields: %w[created_at delivered_at next_attempt_at deleted_at])
|
|
84
|
+
super(data, time_fields: %w[created_at delivered_at next_attempt_at first_attempt_at deleted_at])
|
|
85
85
|
end
|
|
86
86
|
end
|
|
87
87
|
|
|
@@ -162,19 +162,19 @@ module HookBridge
|
|
|
162
162
|
|
|
163
163
|
class CreateEndpointResponse < BaseModel
|
|
164
164
|
def initialize(data)
|
|
165
|
-
super(data, time_fields: %w[created_at])
|
|
165
|
+
super(data, time_fields: %w[created_at expires_at])
|
|
166
166
|
end
|
|
167
167
|
end
|
|
168
168
|
|
|
169
169
|
class Endpoint < BaseModel
|
|
170
170
|
def initialize(data)
|
|
171
|
-
super(data, time_fields: %w[created_at updated_at])
|
|
171
|
+
super(data, time_fields: %w[created_at updated_at expires_at])
|
|
172
172
|
end
|
|
173
173
|
end
|
|
174
174
|
|
|
175
175
|
class EndpointSummary < BaseModel
|
|
176
176
|
def initialize(data)
|
|
177
|
-
super(data, time_fields: %w[created_at])
|
|
177
|
+
super(data, time_fields: %w[created_at expires_at])
|
|
178
178
|
end
|
|
179
179
|
end
|
|
180
180
|
|
|
@@ -217,18 +217,6 @@ module HookBridge
|
|
|
217
217
|
end
|
|
218
218
|
end
|
|
219
219
|
|
|
220
|
-
class Project < BaseModel
|
|
221
|
-
def initialize(data)
|
|
222
|
-
super(data, time_fields: %w[created_at])
|
|
223
|
-
end
|
|
224
|
-
end
|
|
225
|
-
|
|
226
|
-
class CheckoutSession < BaseModel
|
|
227
|
-
end
|
|
228
|
-
|
|
229
|
-
class PortalSession < BaseModel
|
|
230
|
-
end
|
|
231
|
-
|
|
232
220
|
class UsageHistoryRow < BaseModel
|
|
233
221
|
def initialize(data)
|
|
234
222
|
super(data, date_fields: %w[period_start period_end])
|
|
@@ -322,19 +310,19 @@ module HookBridge
|
|
|
322
310
|
|
|
323
311
|
class CreateInboundEndpointResponse < BaseModel
|
|
324
312
|
def initialize(data)
|
|
325
|
-
super(data, time_fields: %w[created_at])
|
|
313
|
+
super(data, time_fields: %w[created_at expires_at])
|
|
326
314
|
end
|
|
327
315
|
end
|
|
328
316
|
|
|
329
317
|
class InboundEndpoint < BaseModel
|
|
330
318
|
def initialize(data)
|
|
331
|
-
super(data, time_fields: %w[created_at updated_at])
|
|
319
|
+
super(data, time_fields: %w[created_at updated_at expires_at])
|
|
332
320
|
end
|
|
333
321
|
end
|
|
334
322
|
|
|
335
323
|
class InboundEndpointSummary < BaseModel
|
|
336
324
|
def initialize(data)
|
|
337
|
-
super(data, time_fields: %w[created_at])
|
|
325
|
+
super(data, time_fields: %w[created_at expires_at])
|
|
338
326
|
end
|
|
339
327
|
end
|
|
340
328
|
|
data/lib/hookbridge/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: hookbridge
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 2.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- HookBridge
|
|
@@ -180,7 +180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
180
180
|
- !ruby/object:Gem::Version
|
|
181
181
|
version: '0'
|
|
182
182
|
requirements: []
|
|
183
|
-
rubygems_version: 4.0.
|
|
183
|
+
rubygems_version: 4.0.23
|
|
184
184
|
specification_version: 4
|
|
185
185
|
summary: Ruby SDK for HookBridge - Guaranteed webhook delivery
|
|
186
186
|
test_files: []
|