hookbridge 1.4.0 → 1.6.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: 21217d26b8b60f7f11e90921ec65c85886cb9db5083201c54271ab3b73af67c3
4
- data.tar.gz: 5c35bcaced137cce82f7763a4c9d338155a4b3324f9ce12ba56455a6586ada29
3
+ metadata.gz: 4b5c43ea6d4f602bbe765fda06433a5dba02afd8907b36bd3911934315ed75a7
4
+ data.tar.gz: d83dfdab5ae8ccc6e17a7743ad4c653787c27889eeea6d4f4856de1300fbd838
5
5
  SHA512:
6
- metadata.gz: bb9042d203744bdc6714a8385aa22eb4bc4df4633f5394c56b9cf11165c7abe4c8da7d49a89e24f32a30238575eb06e1afed085ea388128ffde9a00f0e15b72e
7
- data.tar.gz: 7a0e7be1de066280224cc326218ee8fe5a88d141f2d500e78b24eabe413e961a2272cfdd3c47ffea9cd51815a9310096b0b263c2b5c66bde4ddbee713b34b38c
6
+ metadata.gz: ce5a62d25e7ed153478d173afa953fcc38f639f3be61ed1d09229d1601a30361173bf80532bf8a5eeb4357faba22f07cc890412f7d9eb7280beef9ab60a52a27
7
+ data.tar.gz: 53c666698c37c8500059f98e6dde44bb72e90caffcadaa5211cd6eeb011bdedc8d3a72103bd9c6999ec501215bf827f00438172ca50de958e7b90c732889751b
@@ -36,6 +36,11 @@ module HookBridge
36
36
  Message.new(extract_data(request(:get, "/v1/messages/#{message_id}")))
37
37
  end
38
38
 
39
+ def get_message_attempts(message_id)
40
+ response = request(:get, "/v1/messages/#{message_id}/attempts")
41
+ AttemptsResponse.new(extract_data(response), extract_meta(response))
42
+ end
43
+
39
44
  def replay(message_id)
40
45
  ReplayResponse.new(extract_data(request(:post, "/v1/messages/#{message_id}/replay")))
41
46
  end
@@ -241,11 +246,13 @@ module HookBridge
241
246
  InvoicesResponse.new(extract_data(response), extract_meta(response))
242
247
  end
243
248
 
244
- def create_inbound_endpoint(url:, name: nil, description: 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)
245
- body = { url: url }
249
+ 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)
250
+ body = {}
251
+ body[:url] = url unless url.nil?
246
252
  {
247
253
  name: name,
248
254
  description: description,
255
+ mode: mode,
249
256
  verify_static_token: verify_static_token,
250
257
  token_header_name: token_header_name,
251
258
  token_query_param: token_query_param,
@@ -298,6 +305,22 @@ module HookBridge
298
305
  PauseState.new(extract_data(request(:post, "/v1/inbound-endpoints/#{endpoint_id}/resume")))
299
306
  end
300
307
 
308
+ def listen_inbound_endpoint(endpoint_id, after: nil)
309
+ params = {}
310
+ params[:after] = after if after
311
+ response = request(:get, "/v1/inbound-endpoints/#{endpoint_id}/listen", nil, params)
312
+ ListenInboundEndpointResponse.new(response)
313
+ end
314
+
315
+ def get_inbound_message(message_id)
316
+ InboundMessage.new(extract_data(request(:get, "/v1/inbound-messages/#{message_id}")))
317
+ end
318
+
319
+ def get_inbound_message_attempts(message_id)
320
+ response = request(:get, "/v1/inbound-messages/#{message_id}/attempts")
321
+ AttemptsResponse.new(extract_data(response), extract_meta(response))
322
+ end
323
+
301
324
  def replay_inbound_message(message_id)
302
325
  ReplayResponse.new(extract_data(request(:post, "/v1/inbound-messages/#{message_id}/replay")))
303
326
  end
@@ -377,6 +400,11 @@ module HookBridge
377
400
  request(:get, "/v1/exports/#{export_id}/download", nil, nil, allow_redirect: true)
378
401
  end
379
402
 
403
+ def delete_export(export_id)
404
+ request(:delete, "/v1/exports/#{export_id}")
405
+ true
406
+ end
407
+
380
408
  private
381
409
 
382
410
  def build_connection(url)
@@ -333,6 +333,21 @@ module HookBridge
333
333
  end
334
334
  end
335
335
 
336
+ class ListenMessage < BaseModel
337
+ def initialize(data)
338
+ super(data, time_fields: %w[received_at])
339
+ end
340
+ end
341
+
342
+ class ListenInboundEndpointResponse
343
+ attr_reader :messages, :next_cursor
344
+
345
+ def initialize(data)
346
+ @messages = (data["data"] || []).map { |entry| ListenMessage.new(entry) }
347
+ @next_cursor = data.dig("meta", "next_cursor")
348
+ end
349
+ end
350
+
336
351
  class UpdateResult < BaseModel
337
352
  end
338
353
 
@@ -374,6 +389,27 @@ module HookBridge
374
389
  end
375
390
  end
376
391
 
392
+ class AttemptRecord < BaseModel
393
+ def initialize(data)
394
+ super(data, time_fields: %w[created_at])
395
+ end
396
+ end
397
+
398
+ class AttemptsResponse
399
+ attr_reader :attempts, :has_more
400
+
401
+ def initialize(data, meta = {})
402
+ @attempts = (data || []).map { |entry| AttemptRecord.new(entry) }
403
+ @has_more = meta["has_more"] || false
404
+ end
405
+ end
406
+
407
+ class InboundMessage < BaseModel
408
+ def initialize(data)
409
+ super(data, time_fields: %w[received_at updated_at next_attempt_at delivered_at failed_at])
410
+ end
411
+ end
412
+
377
413
  class ExportRecord < BaseModel
378
414
  def initialize(data)
379
415
  super(data, time_fields: %w[
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HookBridge
4
- VERSION = "1.4.0"
4
+ VERSION = "1.6.0"
5
5
  end
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.0
4
+ version: 1.6.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.3
183
+ rubygems_version: 4.0.9
184
184
  specification_version: 4
185
185
  summary: Ruby SDK for HookBridge - Guaranteed webhook delivery
186
186
  test_files: []