uc3-dmp-id 0.0.75 → 0.0.76
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/uc3-dmp-id/finder.rb +10 -7
- data/lib/uc3-dmp-id/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f769de6ae77fa371a710f13351629a90092a596131b31f82d7ad5161e792f12
|
4
|
+
data.tar.gz: a3da20ecdce90334053349c726f4d4ed78abe00d5b915366957963be82ccbd40
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4a350af34ae4eff82a0c24c2de1e309b62ece8b268d53b23014ed05505dbe646c0a40f126a5a346c88047a30e790e52375cfed3956b879ee2ba5f2b94cf5ccc
|
7
|
+
data.tar.gz: 9cda04030ef741a7f1f66eb62a7124755b572ae9791f8485a5081ac72c0efcd181b36e88f409b472078655bf7c2226f28b2956f16fb31e781ed362165ca4729d
|
data/lib/uc3-dmp-id/finder.rb
CHANGED
@@ -19,10 +19,10 @@ module Uc3DmpId
|
|
19
19
|
|
20
20
|
class << self
|
21
21
|
# TODO: Replace this with ElasticSearch
|
22
|
-
def search_dmps(args:, debug:
|
23
|
-
return _by_owner(owner_org: args['owner_orcid']) unless args['owner_orcid'].nil?
|
24
|
-
return _by_owner_org(owner_org: args['owner_org_ror']) unless args['owner_org_ror'].nil?
|
25
|
-
return _by_mod_day(day: args['modification_day']) unless args['modification_day'].nil?
|
22
|
+
def search_dmps(args:, debug: false)
|
23
|
+
return _by_owner(owner_org: args['owner_orcid'], debug: debug) unless args['owner_orcid'].nil?
|
24
|
+
return _by_owner_org(owner_org: args['owner_org_ror'], debug: debug) unless args['owner_org_ror'].nil?
|
25
|
+
return _by_mod_day(day: args['modification_day'], debug: debug) unless args['modification_day'].nil?
|
26
26
|
|
27
27
|
[]
|
28
28
|
end
|
@@ -115,7 +115,7 @@ module Uc3DmpId
|
|
115
115
|
private
|
116
116
|
|
117
117
|
# Fetch the DMP IDs for the specified owner's ORCID (the owner is the :dmphub_owner_id on the DMP ID record)
|
118
|
-
def _by_owner(owner_id:)
|
118
|
+
def _by_owner(owner_id:, debug: false)
|
119
119
|
regex = %r{^([0-9A-Z]{4}-){3}[0-9A-Z]{4}$}
|
120
120
|
raise FinderError, MSG_INVALID_OWNER_ID if owner_id.nil? || (owner_id.to_s.downcase =~ regex).nil?
|
121
121
|
|
@@ -133,12 +133,13 @@ module Uc3DmpId
|
|
133
133
|
filter_expression: 'SK = :version',
|
134
134
|
expression_attribute_values: { ':version': Helper::DMP_LATEST_VERSION }
|
135
135
|
}
|
136
|
+
puts "Querying _by_owner with #{args}" if debug
|
136
137
|
client = client.nil? ? Uc3DmpDynamo::Client.new(debug: debug) : client
|
137
138
|
_process_search_response(response: client.query(args: args))
|
138
139
|
end
|
139
140
|
|
140
141
|
# Fetch the DMP IDs for the specified organization/institution (the org is the :dmphub_owner_org on the DMP ID record)
|
141
|
-
def _by_owner_org(owner_org:)
|
142
|
+
def _by_owner_org(owner_org:, debug: false)
|
142
143
|
regex = %r{^[a-zA-Z0-9]+$}
|
143
144
|
raise FinderError, MSG_INVALID_OWNER_ID if owner_org.nil? ||(owner_org.to_s.downcase =~ regex).nil?
|
144
145
|
|
@@ -156,12 +157,13 @@ module Uc3DmpId
|
|
156
157
|
filter_expression: 'SK = :version',
|
157
158
|
expression_attribute_values: { ':version': Helper::DMP_LATEST_VERSION }
|
158
159
|
}
|
160
|
+
puts "Querying _by_owner_org with #{args}" if debug
|
159
161
|
client = client.nil? ? Uc3DmpDynamo::Client.new(debug: debug) : client
|
160
162
|
_process_search_response(response: client.query(args: args))
|
161
163
|
end
|
162
164
|
|
163
165
|
# Fetch the DMP IDs modified on the specified date (the date is the :dmphub_modification_day on the DMP ID record)
|
164
|
-
def _by_mod_day(day:)
|
166
|
+
def _by_mod_day(day:, debug: false)
|
165
167
|
regex = %r{^[0-9]{4}(-[0-9]{2}){2}}
|
166
168
|
raise FinderError, MSG_INVALID_OWNER_ID if day.nil? || (day.to_s =~ regex).nil?
|
167
169
|
|
@@ -176,6 +178,7 @@ module Uc3DmpId
|
|
176
178
|
filter_expression: 'SK = :version',
|
177
179
|
expression_attribute_values: { ':version': Helper::DMP_LATEST_VERSION }
|
178
180
|
}
|
181
|
+
puts "Querying _by_mod_day with #{args}" if debug
|
179
182
|
client = client.nil? ? Uc3DmpDynamo::Client.new(debug: debug) : client
|
180
183
|
_process_search_response(response: client.query(args: args))
|
181
184
|
end
|
data/lib/uc3-dmp-id/version.rb
CHANGED