hookbridge 1.4.0 → 1.5.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: 74b1d68ce381280f967e1edc25c6d65e5433c6e3c9219794fb5d7b64e3798a7d
4
+ data.tar.gz: db8a5118e46ce3c13df476d1246d68abaf25db57f9a17eb00a9f2ca6aed2b51c
5
5
  SHA512:
6
- metadata.gz: bb9042d203744bdc6714a8385aa22eb4bc4df4633f5394c56b9cf11165c7abe4c8da7d49a89e24f32a30238575eb06e1afed085ea388128ffde9a00f0e15b72e
7
- data.tar.gz: 7a0e7be1de066280224cc326218ee8fe5a88d141f2d500e78b24eabe413e961a2272cfdd3c47ffea9cd51815a9310096b0b263c2b5c66bde4ddbee713b34b38c
6
+ metadata.gz: 8de017a1de9cb2e99de9b465a8ab242070c53c4db8cc3609986f25242990863d85a016dd7a35dbbdb6936530767af949687df220749eff2ea2332278eff03953
7
+ data.tar.gz: 9c41f65f3d822ca8dd1ba24ff1ac03d29a9b912809ebe4c03d50099dd78686113870f6d80f62441413b9b73d1abf457db689b6935c5ee1058e067659e2a5c10c
@@ -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
@@ -298,6 +303,15 @@ module HookBridge
298
303
  PauseState.new(extract_data(request(:post, "/v1/inbound-endpoints/#{endpoint_id}/resume")))
299
304
  end
300
305
 
306
+ def get_inbound_message(message_id)
307
+ InboundMessage.new(extract_data(request(:get, "/v1/inbound-messages/#{message_id}")))
308
+ end
309
+
310
+ def get_inbound_message_attempts(message_id)
311
+ response = request(:get, "/v1/inbound-messages/#{message_id}/attempts")
312
+ AttemptsResponse.new(extract_data(response), extract_meta(response))
313
+ end
314
+
301
315
  def replay_inbound_message(message_id)
302
316
  ReplayResponse.new(extract_data(request(:post, "/v1/inbound-messages/#{message_id}/replay")))
303
317
  end
@@ -377,6 +391,11 @@ module HookBridge
377
391
  request(:get, "/v1/exports/#{export_id}/download", nil, nil, allow_redirect: true)
378
392
  end
379
393
 
394
+ def delete_export(export_id)
395
+ request(:delete, "/v1/exports/#{export_id}")
396
+ true
397
+ end
398
+
380
399
  private
381
400
 
382
401
  def build_connection(url)
@@ -374,6 +374,27 @@ module HookBridge
374
374
  end
375
375
  end
376
376
 
377
+ class AttemptRecord < BaseModel
378
+ def initialize(data)
379
+ super(data, time_fields: %w[created_at])
380
+ end
381
+ end
382
+
383
+ class AttemptsResponse
384
+ attr_reader :attempts, :has_more
385
+
386
+ def initialize(data, meta = {})
387
+ @attempts = (data || []).map { |entry| AttemptRecord.new(entry) }
388
+ @has_more = meta["has_more"] || false
389
+ end
390
+ end
391
+
392
+ class InboundMessage < BaseModel
393
+ def initialize(data)
394
+ super(data, time_fields: %w[received_at updated_at next_attempt_at delivered_at failed_at])
395
+ end
396
+ end
397
+
377
398
  class ExportRecord < BaseModel
378
399
  def initialize(data)
379
400
  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.5.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.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - HookBridge