hookbridge 1.3.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: a1dc6643f413a5c72e6e1724c177ec0ccc0e225b60fa12bfc00b7b46f03247ed
4
- data.tar.gz: b1f589abc92ca3269f0c1e09653818197d92721f27eff9db58f575466f971036
3
+ metadata.gz: 74b1d68ce381280f967e1edc25c6d65e5433c6e3c9219794fb5d7b64e3798a7d
4
+ data.tar.gz: db8a5118e46ce3c13df476d1246d68abaf25db57f9a17eb00a9f2ca6aed2b51c
5
5
  SHA512:
6
- metadata.gz: 1b543530b49bb72477a2868ca01c43844bb251ac93963763ffa9debe9345d8602a348b978406fccff3e3f83acc175f808d6c8b9f800a987430f160a5725c8d3f
7
- data.tar.gz: 2c0f64f72b76dc63bb959789ebc93f3450b6532dfbf672c23adefd0152469e253553a22b6e0ba093a0a9b7aafebe03fcdf42572e0e56e981329d00a74a37c068
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
@@ -192,6 +197,14 @@ module HookBridge
192
197
  true
193
198
  end
194
199
 
200
+ def pause_endpoint(endpoint_id)
201
+ PauseState.new(extract_data(request(:post, "/v1/endpoints/#{endpoint_id}/pause")))
202
+ end
203
+
204
+ def resume_endpoint(endpoint_id)
205
+ PauseState.new(extract_data(request(:post, "/v1/endpoints/#{endpoint_id}/resume")))
206
+ end
207
+
195
208
  def create_endpoint_signing_key(endpoint_id)
196
209
  RotateSecretResponse.new(extract_data(request(:post, "/v1/endpoints/#{endpoint_id}/signing-keys")))
197
210
  end
@@ -290,6 +303,15 @@ module HookBridge
290
303
  PauseState.new(extract_data(request(:post, "/v1/inbound-endpoints/#{endpoint_id}/resume")))
291
304
  end
292
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
+
293
315
  def replay_inbound_message(message_id)
294
316
  ReplayResponse.new(extract_data(request(:post, "/v1/inbound-messages/#{message_id}/replay")))
295
317
  end
@@ -369,6 +391,11 @@ module HookBridge
369
391
  request(:get, "/v1/exports/#{export_id}/download", nil, nil, allow_redirect: true)
370
392
  end
371
393
 
394
+ def delete_export(export_id)
395
+ request(:delete, "/v1/exports/#{export_id}")
396
+ true
397
+ end
398
+
372
399
  private
373
400
 
374
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.3.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.3.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - HookBridge