uc3-dmp-id 0.0.35 → 0.0.37
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 +4 -4
- data/lib/uc3-dmp-id/creator.rb +4 -3
- data/lib/uc3-dmp-id/deleter.rb +4 -3
- data/lib/uc3-dmp-id/finder.rb +2 -2
- data/lib/uc3-dmp-id/updater.rb +4 -4
- data/lib/uc3-dmp-id/version.rb +1 -1
- data/lib/uc3-dmp-id.rb +2 -0
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 628b2fb84344d551dd9757e91881ff1f1520f2f1c07516d746de801373558346
|
4
|
+
data.tar.gz: 7bc1288dcd9b5094a7f76d17c2d0f522083932f738ab1761890e7039cf57513d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 610e5de928292f96d236b28191bc57a13f6b4b744e08004c70ca4e5938130b79b041802e85f96e6f4484cb67e926632557651a5f46e1e7060c5bc462546480f5
|
7
|
+
data.tar.gz: '063822342f7c074e63b4e9919821b3500154fb60df9305427c79a6422acb3202afc404880242e5ca704fc662b869c31f8d5b506fe88119e6551b193fcdadc69f'
|
data/lib/uc3-dmp-id/creator.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
84
|
+
publisher = Uc3DmpEventBridge::Publisher.new
|
85
|
+
publisher.publish(source: 'DmpCreator', dmp: json, debug: debug)
|
85
86
|
true
|
86
87
|
end
|
87
88
|
end
|
data/lib/uc3-dmp-id/deleter.rb
CHANGED
@@ -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
|
-
|
64
|
+
publisher = Uc3DmpEventBridge::Publisher.new
|
65
|
+
publisher.publish(source: 'DmpDeleter', dmp: json, debug: debug)
|
65
66
|
true
|
66
67
|
end
|
67
68
|
end
|
data/lib/uc3-dmp-id/finder.rb
CHANGED
@@ -15,7 +15,7 @@ module Uc3DmpId
|
|
15
15
|
|
16
16
|
class << self
|
17
17
|
# TODO: Replace this with ElasticSearch
|
18
|
-
def search_dmps(
|
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(
|
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
|
data/lib/uc3-dmp-id/updater.rb
CHANGED
@@ -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
|
-
|
69
|
+
publisher = Uc3DmpEventBridge::Publisher.new
|
70
|
+
publisher.publish(source: 'DmpUpdater', dmp: json, debug: debug)
|
71
71
|
true
|
72
72
|
end
|
73
73
|
end
|
data/lib/uc3-dmp-id/version.rb
CHANGED
data/lib/uc3-dmp-id.rb
CHANGED
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.
|
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
|