uc3-dmp-event-bridge 0.0.6 → 0.0.8

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: a199db3840c84143f8c0eb7aac339855c28f62aafbd8da9c340d66b8efef4f69
4
- data.tar.gz: 98ae731675661ea983d19144e220eec26bcc051b5b466473d5a6e10019818fd3
3
+ metadata.gz: 7b5ede7a62dba826f3cd3972d0513cae33d377cc07213add563d9329076dd3fb
4
+ data.tar.gz: 6e4ce6defd27425cd15cb56a6e8e0eed8969f8f31993c59c6bee4e81105fc00d
5
5
  SHA512:
6
- metadata.gz: b5c906475aab8a9af69e37eebaf236df582433f70f2da91f145aac65ad587c2cd95058744338e42b061e0739919364b55c6081266ae2d443e3fa05c7bc355b79
7
- data.tar.gz: 86ddb225de17f68ee0e519734496ddef9f4470819bdeb71e3b36069f37e7a8e5838d2738bed0baf75ed47ff00517414e571a8af21a83324a39f8fa5e701a511a
6
+ metadata.gz: e489723a0c8a566196cddc760815d98435e2347e14be888b7697c1db42d86370fba35fffdb9ae54ad881ba171c9fb607508a8ebe2238d154ff733a868f3ca032
7
+ data.tar.gz: 15d45610cd6bdd0c4149c37effbe1788f4131c55bbb41a1e0052c99e8902af17e4ce748ad9e45bfbe4c6392e558989ed1f4afa2e276b5134e23cdf917b9d086f
@@ -26,17 +26,21 @@ module Uc3DmpEventBridge
26
26
  end
27
27
 
28
28
  # Publish an event to the EventBus so that other Lambdas can do their thing
29
- # rubocop:disable Metrics/AbcSize
29
+ # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
30
30
  def publish(source:, dmp:, event_type: DEFAULT_EVENT_TYPE, detail: nil, logger: nil)
31
31
  source = "#{source} -> #{SOURCE}.publish"
32
- detail = detail.nil? ? _generate_detail(dmp: dmp).to_json : (detail.is_a?(Hash) ? detail.to_json : detail.to_s)
32
+ detail = if detail.nil?
33
+ _generate_detail(dmp:).to_json
34
+ else
35
+ (detail.is_a?(Hash) ? detail.to_json : detail.to_s)
36
+ end
33
37
 
34
38
  message = {
35
39
  entries: [{
36
- time: Time.now,
40
+ time: Time.now.utc.iso8601,
37
41
  source: "#{ENV.fetch('DOMAIN', nil)}:lambda:event_publisher",
38
42
  detail_type: event_type.to_s,
39
- detail: detail,
43
+ detail:,
40
44
  event_bus_name: ENV.fetch('EVENT_BUS_NAME', nil)
41
45
  }]
42
46
  }
@@ -45,12 +49,12 @@ module Uc3DmpEventBridge
45
49
  return true unless resp.failed_entry_count.nil? || resp.failed_entry_count.positive?
46
50
 
47
51
  # The EventBridge returned errors, so log the error
48
- raise PublisherError, _generate_failure(source: source, response: resp, payload: payload)
52
+ raise PublisherError, _generate_failure(source:, response: resp, payload:)
49
53
  rescue Aws::Errors::ServiceError => e
50
54
  logger.error(message: "#{SOURCE} #{e.message}", details: e.backtrace) if logger.respond_to?(:debug)
51
- raise PublisherError, MSG_BUS_ERROR % { msg: e.message }
55
+ raise PublisherError, format(MSG_BUS_ERROR, msg: e.message)
52
56
  end
53
- # rubocop:enable Metrics/AbcSize
57
+ # rubocop:enable Metrics/AbcSize, Metrics/MethodLength
54
58
 
55
59
  private
56
60
 
@@ -60,15 +64,14 @@ module Uc3DmpEventBridge
60
64
  PK: dmp['PK'],
61
65
  SK: dmp['SK'],
62
66
  dmphub_provenance_id: dmp.fetch('dmphub_provenance_id', nil),
63
- dmproadmap_links: dmp.fetch('dmproadmap_links', {}),
64
- dmphub_updater_is_provenance: dmp.fetch('dmphub_updater_is_provenance', false)
67
+ dmproadmap_links: dmp.fetch('dmproadmap_links', {})
65
68
  }
66
69
  end
67
70
 
68
71
  # If the EventBus returns an error log everything
69
72
  def _generate_failure(source:, response:, payload:)
70
73
  {
71
- source: source,
74
+ source:,
72
75
  message: 'Failed to post message to EventBridge!',
73
76
  details: {
74
77
  event_bus_name: ENV.fetch('EVENT_BUS_NAME', nil),
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Uc3DmpEventBridge
4
- VERSION = '0.0.6'
4
+ VERSION = '0.0.8'
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.6
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Riley
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-11 00:00:00.000000000 Z
11
+ date: 2023-10-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -124,7 +124,7 @@ licenses:
124
124
  - MIT
125
125
  metadata:
126
126
  rubygems_mfa_required: 'false'
127
- post_install_message:
127
+ post_install_message:
128
128
  rdoc_options: []
129
129
  require_paths:
130
130
  - lib
@@ -132,15 +132,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
132
132
  requirements:
133
133
  - - ">="
134
134
  - !ruby/object:Gem::Version
135
- version: '2.7'
135
+ version: '3.2'
136
136
  required_rubygems_version: !ruby/object:Gem::Requirement
137
137
  requirements:
138
138
  - - ">="
139
139
  - !ruby/object:Gem::Version
140
140
  version: '0'
141
141
  requirements: []
142
- rubygems_version: 3.1.6
143
- signing_key:
142
+ rubygems_version: 3.4.10
143
+ signing_key:
144
144
  specification_version: 4
145
145
  summary: DMPTool gem that provides support for Event Bridge
146
146
  test_files: []