uc3-dmp-id 0.1.54 → 0.1.56

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: a25055e5e62c689e02f190fe828bbe553ef380bcf6bcd2b2e2bb6299f80ea439
4
- data.tar.gz: c51528de686f3786175ef6bfe2dcde9f1c86897d0fc6d5748667167021d55b54
3
+ metadata.gz: 1081d13ad36b5435984d6fbb610511f4e99a7f6fb677d4c7aa4bd502776f1166
4
+ data.tar.gz: 86e564c45241e14a6bcf23e7fb5015b4adf2e2c4ae8a939a0d9c38f22ae58a51
5
5
  SHA512:
6
- metadata.gz: c3a6afb5c512125d29ff1fc6a2da94de5aa98277f08e9fb46d7e120cd64d24238f8eb915f141a4df115feb89951f7e5753daf7c49358241fc7d718277e4d3aed
7
- data.tar.gz: 7421c51628509d0e0c904625916fd56b43c6fecca16a131169568371f6b39acc274f730ca7d8942d4634daf30b89a7ddfa9f6acb63b634b3ad3fe2a3b8e1472b
6
+ metadata.gz: f8ae4658ca506e73ae049c901ad1bbdb23817369be5571514bc8cc3bc75c7947d9a62863e565b9bc2085e36f016ba93469d2c5c502bfa65ee70c38625aca159a
7
+ data.tar.gz: 25e3cfff2baea5a4f20ddf23a6dcd075f959300fa4b973887f6a99c60b77aefd798b522766b99a13d598ac19a1b626d377ee463906a82752a7f2a2cfd8d9330d
@@ -135,9 +135,9 @@ module Uc3DmpId
135
135
  def _by_owner(owner:, client: nil, logger: nil)
136
136
  orcid_regex = /^([0-9A-Z]{4}-){3}[0-9A-Z]{4}$/
137
137
  email_regex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/
138
- email = owner.trim() unless (owner.to_s =~ email_regex).nil?
138
+ email = owner.trim unless (owner.to_s.trim.gsub('%40', '@') =~ email_regex).nil?
139
139
 
140
- if email.nil?
140
+ if !(owner.to_s.trim =~ orcid_regex).nil?
141
141
  args = {
142
142
  filter_expression: 'contains(:people_ids, people) AND :sk = sk',
143
143
  expression_attribute_values: {
@@ -148,17 +148,18 @@ module Uc3DmpId
148
148
  ]
149
149
  }
150
150
  }
151
- else
151
+ elsif !email.nil?
152
152
  args = {
153
153
  filter_expression: 'contains(:people, people) AND :sk = sk',
154
154
  expression_attribute_values: { ':sk': 'METADATA', ':people': [email] }
155
155
  }
156
+ else
157
+ # It wasn't an email or ORCID, so return an empty array
158
+ return []
156
159
  end
157
160
  logger&.debug(message: 'Fetch relevant DMPs _by_owner - scan args', details: args)
158
- resp = client.scan(args:)
159
-
160
161
  client = Uc3DmpDynamo::Client.new if client.nil?
161
- _process_search_response(response: client.query(args:, logger:))
162
+ _process_search_response(response: client.scan(args:))
162
163
  end
163
164
 
164
165
  # Fetch the DMP IDs for the specified organization/institution
@@ -177,10 +178,8 @@ module Uc3DmpId
177
178
  }
178
179
  }
179
180
  logger&.debug(message: 'Fetch relevant DMPs _by_org - scan args', details: args)
180
- resp = client.scan(args:)
181
-
182
181
  client = Uc3DmpDynamo::Client.new if client.nil?
183
- _process_search_response(response: client.query(args:, logger:))
182
+ _process_search_response(response: client.scan(args:))
184
183
  end
185
184
 
186
185
  # Fetch the DMP IDs for the specified funder
@@ -199,10 +198,8 @@ module Uc3DmpId
199
198
  }
200
199
  }
201
200
  logger&.debug(message: 'Fetch relevant DMPs _by_funder - scan args', details: args)
202
- resp = client.scan(args:)
203
-
204
201
  client = Uc3DmpDynamo::Client.new if client.nil?
205
- _process_search_response(response: client.query(args:, logger:))
202
+ _process_search_response(response: client.scan(args:))
206
203
  end
207
204
 
208
205
  # Fetch the DMP IDs that are marked as featured
@@ -212,10 +209,8 @@ module Uc3DmpId
212
209
  expression_attribute_values: { ':sk': 'METADATA', ':featured': 1 }
213
210
  }
214
211
  logger&.debug(message: 'Fetch relevant DMPs _by_featured - scan args', details: args)
215
- resp = client.scan(args:)
216
-
217
212
  client = Uc3DmpDynamo::Client.new if client.nil?
218
- _process_search_response(response: client.query(args:, logger:))
213
+ _process_search_response(response: client.scan(args:))
219
214
  end
220
215
 
221
216
  # Return all of the publicly visible DMPs
@@ -225,10 +220,8 @@ module Uc3DmpId
225
220
  expression_attribute_values: { ':sk': 'METADATA', ':visibility': 'public' }
226
221
  }
227
222
  logger&.debug(message: 'Fetch relevant DMPs _publicly_visible - scan args', details: args)
228
- resp = client.scan(args:)
229
-
230
223
  client = Uc3DmpDynamo::Client.new if client.nil?
231
- _process_search_response(response: client.query(args:, logger:))
224
+ _process_search_response(response: client.scan(args:))
232
225
  end
233
226
 
234
227
  # Transform the search results so that we do not include any of the DMPHub specific metadata
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Uc3DmpId
4
- VERSION = '0.1.54'
4
+ VERSION = '0.1.56'
5
5
  end
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.1.54
4
+ version: 0.1.56
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Riley