uc3-dmp-event-bridge 0.0.1 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 05e37209c45c2d372a5ef9259d16ec0c4e20f9c2a968d0311e34433b260952dc
4
- data.tar.gz: c1499396710532b8a70ae7ad45bf64a5e63c50106c30637a6d69c373196b0e5e
3
+ metadata.gz: 0061f407f79ded7c0b7ec87632dfa65bdcdf3373b4e4d5e4534d4a891cdd5bff
4
+ data.tar.gz: c768dc010958bcfa9a26537c37045924e0785e23df25cebf756e354ae18ce436
5
5
  SHA512:
6
- metadata.gz: 5da1a4dfe6f43853d028f71111332eca6887bb43d0d7051deca8398cfc3e407648b4cc7c06bd2b1922380def8d78ef0a040f5bf2e1a1e8ee8b81414b1b133545
7
- data.tar.gz: d675d6c4881c2188dd38b810af50e36c400362a585f6fdab4de2709cb9446527b8876e80815e3fac0094960df578174faf4a053cc9cf029f2dce4fd089afb46c
6
+ metadata.gz: 78466312b02998b365f6aba7811698c1cef619c94d8297d9041697a4591c1f29880424fe74672652eda158a07162ade6a22eb718093f42993c089ada0836cefd
7
+ data.tar.gz: ad71a46c136e4520e47d2e5cf8fe3a899cc48ce5329ec11b516b33262a25758855f031c7e34902fd3795c9aa83b8cd3ae200c42392d995e61d5e536b39cee133
data/README.md CHANGED
@@ -0,0 +1,3 @@
1
+ # Uc3DmpEventBridge
2
+
3
+ Helper functions for interacting with an AWS EventBridge
@@ -27,7 +27,7 @@ module Uc3DmpEventBridge
27
27
 
28
28
  # Publish an event to the EventBus so that other Lambdas can do their thing
29
29
  # rubocop:disable Metrics/AbcSize
30
- def publish(source:, dmp:, event_type: DEFAULT_EVENT_TYPE, debug: false)
30
+ def publish(source:, dmp:, event_type: DEFAULT_EVENT_TYPE, logger: nil)
31
31
  source = "#{source} -> #{SOURCE}.publish"
32
32
 
33
33
  message = {
@@ -39,14 +39,14 @@ module Uc3DmpEventBridge
39
39
  event_bus_name: ENV.fetch('EVENT_BUS_NAME', nil)
40
40
  }]
41
41
  }
42
- puts "#{SOURCE}.publish - Publishing event -> details: #{message}") if debug
42
+ logger.debug(message: "#{SOURCE} published event", details: message) if logger.respond_to?(:debug)
43
43
  resp = client.put_events(message)
44
44
  return true unless resp.failed_entry_count.nil? || resp.failed_entry_count.positive?
45
45
 
46
46
  # The EventBridge returned errors, so log the error
47
47
  raise PublisherError, _generate_failure(source: source, response: resp, payload: payload)
48
48
  rescue Aws::Errors::ServiceError => e
49
- puts "#{SOURCE} - #{MSG_BUS_ERROR % { msg: e.message, trace: e.backtrace }}"
49
+ logger.error(message: "#{SOURCE} #{e.message}", details: e.backtrace) if logger.respond_to?(:debug)
50
50
  raise PublisherError, MSG_BUS_ERROR % { msg: e.message }
51
51
  end
52
52
  # rubocop:enable Metrics/AbcSize
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Uc3DmpEventBridge
4
- VERSION = '0.0.1'
4
+ VERSION = '0.0.3'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uc3-dmp-event-bridge
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Riley
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-08 00:00:00.000000000 Z
11
+ date: 2023-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json