uc3-dmp-id 0.0.35 → 0.0.37

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: b6deb6c2410fcd18ed4bb3cd248012a3c76cc5a7bf7eefb85c42e35de9d85469
4
- data.tar.gz: b8bef46b7faf3a75d7f064cc7b9137e185fd786c0922ab94bbea05518d95bade
3
+ metadata.gz: 628b2fb84344d551dd9757e91881ff1f1520f2f1c07516d746de801373558346
4
+ data.tar.gz: 7bc1288dcd9b5094a7f76d17c2d0f522083932f738ab1761890e7039cf57513d
5
5
  SHA512:
6
- metadata.gz: e6e2c933a4ebcaa35b5cbef3b2265d20f8e7dd9398fc313632a826fe7f1280ad9f6753d9780d6ee2b321d6be0459ceb4765cf5e551c2a0cc93b4b687d7c038b4
7
- data.tar.gz: 55f633c30625d5d8285f8d0e4ab8c7f03d33a632c61995c0df0c79ea416069118ef32da27986ec92845c9f9a34bff666cb480984cb122fdc801c1818f6fe8358
6
+ metadata.gz: 610e5de928292f96d236b28191bc57a13f6b4b744e08004c70ca4e5938130b79b041802e85f96e6f4484cb67e926632557651a5f46e1e7060c5bc462546480f5
7
+ data.tar.gz: '063822342f7c074e63b4e9919821b3500154fb60df9305427c79a6422acb3202afc404880242e5ca704fc662b869c31f8d5b506fe88119e6551b193fcdadc69f'
@@ -43,7 +43,7 @@ module Uc3DmpId
43
43
  resp = client.put_item(json: annotated, debug: debug)
44
44
  raise CreatorError, Uc3DmpId::MSG_DMP_NO_DMP_ID if resp.nil?
45
45
 
46
- # _post_process(json: annotated)
46
+ _post_process(json: annotated, debug: debug)
47
47
  annotated
48
48
  end
49
49
 
@@ -75,13 +75,14 @@ module Uc3DmpId
75
75
  # Once the DMP has been created, we need to register it's DMP ID and download any
76
76
  # PDF if applicable
77
77
  # -------------------------------------------------------------------------
78
- def _post_process(json:)
78
+ def _post_process(json:, debug: false)
79
79
  return false unless json.is_a?(Hash)
80
80
 
81
81
  # We are creating, so this is always true
82
82
  json['dmphub_updater_is_provenance'] = true
83
83
  # Publish the change to the EventBridge
84
- # EventPublisher.publish(source: 'DmpCreator', dmp: json, debug: @debug)
84
+ publisher = Uc3DmpEventBridge::Publisher.new
85
+ publisher.publish(source: 'DmpCreator', dmp: json, debug: debug)
85
86
  true
86
87
  end
87
88
  end
@@ -42,7 +42,7 @@ module Uc3DmpId
42
42
  puts resp.inspect
43
43
 
44
44
  # Notify EZID about the removal
45
- _post_process(json: dmp)
45
+ _post_process(json: dmp, debug: debug)
46
46
  dmp
47
47
  rescue Aws::Errors::ServiceError => e
48
48
  Responder.log_error(source: source, message: e.message,
@@ -55,13 +55,14 @@ puts resp.inspect
55
55
 
56
56
  # Once the DMP has been tombstoned, we need to notify EZID
57
57
  # -------------------------------------------------------------------------
58
- def _post_process(json:)
58
+ def _post_process(json:, debug: false)
59
59
  return false unless json.is_a?(Hash)
60
60
 
61
61
  # Indicate whether or not the updater is the provenance system
62
62
  json['dmphub_updater_is_provenance'] = true
63
63
  # Publish the change to the EventBridge
64
- # EventPublisher.publish(source: 'DmpDeleter', dmp: json, debug: @debug)
64
+ publisher = Uc3DmpEventBridge::Publisher.new
65
+ publisher.publish(source: 'DmpDeleter', dmp: json, debug: debug)
65
66
  true
66
67
  end
67
68
  end
@@ -15,7 +15,7 @@ module Uc3DmpId
15
15
 
16
16
  class << self
17
17
  # TODO: Replace this with ElasticSearch
18
- def search_dmps(**_args)
18
+ def search_dmps(args:)
19
19
 
20
20
  # TODO: Need to move this to ElasticSearch!!!
21
21
  end
@@ -93,7 +93,7 @@ module Uc3DmpId
93
93
  expression_attribute_values: { ':version': Helper::DMP_LATEST_VERSION }
94
94
  }
95
95
  client = client.nil? ? Uc3DmpDynamo::Client.new(debug: debug) : client
96
- resp = client.query(**args)
96
+ resp = client.query(args: args)
97
97
  return resp unless resp.is_a?(Hash)
98
98
 
99
99
  dmp = resp['dmp'].nil? ? JSON.parse({ dmp: resp }.to_json) : resp
@@ -34,8 +34,7 @@ module Uc3DmpId
34
34
  raise DeleterError, MSG_DMP_UNABLE_TO_VERSION if resp.nil?
35
35
 
36
36
  # Send the updates to EZID, notify the provenance and download the PDF if applicable
37
- _post_process(json: dmp)
38
-
37
+ _post_process(json: dmp, debug: debug)
39
38
  resp
40
39
  end
41
40
  # rubocop:enable Metrics/AbcSize, Metrics/MethodLength
@@ -61,13 +60,14 @@ module Uc3DmpId
61
60
 
62
61
  # Once the DMP has been updated, we need to register it's DMP ID and download any PDF if applicable
63
62
  # -------------------------------------------------------------------------
64
- def _post_process(json:)
63
+ def _post_process(json:, debug: debug)
65
64
  return false unless json.is_a?(Hash)
66
65
 
67
66
  # Indicate whether or not the updater is the provenance system
68
67
  json['dmphub_updater_is_provenance'] = @provenance['PK'] == json['dmphub_provenance_id']
69
68
  # Publish the change to the EventBridge
70
- # EventPublisher.publish(source: 'DmpUpdater', dmp: json, debug: @debug)
69
+ publisher = Uc3DmpEventBridge::Publisher.new
70
+ publisher.publish(source: 'DmpUpdater', dmp: json, debug: debug)
71
71
  true
72
72
  end
73
73
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Uc3DmpId
4
- VERSION = '0.0.35'
4
+ VERSION = '0.0.37'
5
5
  end
data/lib/uc3-dmp-id.rb CHANGED
@@ -4,6 +4,8 @@
4
4
  require 'json'
5
5
  require 'json-schema'
6
6
 
7
+ require 'uc3-dmp-event-bridge'
8
+
7
9
  require 'uc3-dmp-id/creator'
8
10
  require 'uc3-dmp-id/deleter'
9
11
  require 'uc3-dmp-id/finder'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uc3-dmp-id
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.35
4
+ version: 0.0.37
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Riley
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: uc3-dmp-event-bridge
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: byebug
57
71
  requirement: !ruby/object:Gem::Requirement