uc3-dmp-id 0.1.55 → 0.1.57

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: 303302842851603259f0981187aa9e2df87db1214541f8716686ee0f68c3d565
4
- data.tar.gz: de9174608180b81de434d1f5d87abfa1f339c14495d49f93f0c7446cdaaea608
3
+ metadata.gz: 141e0ecd0482b349f2b98f2d41029623f42c755324bb6ab0347c1703d224393f
4
+ data.tar.gz: 8872a059855cb558f884a2b8542c8dece13aaad36c7b73679d90f7e129e6667b
5
5
  SHA512:
6
- metadata.gz: 654b37d44b2b871a385dd72f3104ba857e01b2fff58690708aea9beb3f2e2480eb6550bb18dc3b21cd67ea1362c805dd456bbea4da89598a50493499d934719a
7
- data.tar.gz: bff8736d8b88b890497c13f4604dd67749bf6409045de1532debd4875f7edb7baedb4ca427d5d9a02c2baea452a603ebcc6c98652e9a33f7a9d8217a8190cb4d
6
+ metadata.gz: 26f0b387fcc3417459c6a0b2363f6a6aa1ab8bade5690679ce60e2ecb8a010ec5e2bcf34d442f4fe93f5e0206cacef679842feea67b76bb9d0cbd54a14a57bf1
7
+ data.tar.gz: 143a749ad8e6f425360b5b8f8aa55c58be4a046a1b858360bdb9f6154bf75b891956436a33ecc045324f1a4abd64ac9d450c7e7b1616f9a3dc7f32e314bbddf9
@@ -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.strip unless (owner.to_s.strip.gsub('%40', '@') =~ email_regex).nil?
139
139
 
140
- if email.nil?
140
+ if !(owner.to_s.strip =~ orcid_regex).nil?
141
141
  args = {
142
142
  filter_expression: 'contains(:people_ids, people) AND :sk = sk',
143
143
  expression_attribute_values: {
@@ -148,11 +148,14 @@ 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
161
  client = Uc3DmpDynamo::Client.new if client.nil?
@@ -162,7 +165,7 @@ module Uc3DmpId
162
165
  # Fetch the DMP IDs for the specified organization/institution
163
166
  def _by_org(org:, client: nil, logger: nil)
164
167
  regex = /^[a-zA-Z0-9]+$/
165
- ror = org.trim() unless (org.to_s =~ regex).nil?
168
+ ror = org.strip unless (org.to_s =~ regex).nil?
166
169
 
167
170
  args = {
168
171
  filter_expression: 'contains(:affiliation_ids, affiliation_ids) AND :sk = sk',
@@ -182,7 +185,7 @@ module Uc3DmpId
182
185
  # Fetch the DMP IDs for the specified funder
183
186
  def _by_funder(funder:, client: nil, logger: nil)
184
187
  regex = /^[a-zA-Z0-9]+$/
185
- ror = funder.trim() unless (funder.to_s =~ regex).nil?
188
+ ror = funder.strip unless (funder.to_s =~ regex).nil?
186
189
 
187
190
  args = {
188
191
  filter_expression: 'contains(:funder_ids, funder_ids) AND :sk = sk',
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Uc3DmpId
4
- VERSION = '0.1.55'
4
+ VERSION = '0.1.57'
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.55
4
+ version: 0.1.57
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Riley