uc3-dmp-id 0.0.75 → 0.0.76

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 445c7ef4554d72339624600ee7e43a0237564e4d45cb9393bd151719bfa5899d
4
- data.tar.gz: 6f2c315e67f2cd63b570d7815f3bb7d04b9d134b523d17a4a05e293f1c46e7f6
3
+ metadata.gz: 2f769de6ae77fa371a710f13351629a90092a596131b31f82d7ad5161e792f12
4
+ data.tar.gz: a3da20ecdce90334053349c726f4d4ed78abe00d5b915366957963be82ccbd40
5
5
  SHA512:
6
- metadata.gz: 5a3f4ef40605def448cc5128a595b6b2dbfc7a814a652744a63fc8ab386bc57effb4178fddcd78ae380119ed25607e9e2dd7066e89d95e4f5469a001e0e83f6b
7
- data.tar.gz: '0917410c7c29936e689d192de8c8dff454fa7c15cf891370fa78446c2fb6effdbeb70465f626fb7c3835e2ee34a8a9b9bbdeda2c544ba83701f79eaa4e9cec2a'
6
+ metadata.gz: f4a350af34ae4eff82a0c24c2de1e309b62ece8b268d53b23014ed05505dbe646c0a40f126a5a346c88047a30e790e52375cfed3956b879ee2ba5f2b94cf5ccc
7
+ data.tar.gz: 9cda04030ef741a7f1f66eb62a7124755b572ae9791f8485a5081ac72c0efcd181b36e88f409b472078655bf7c2226f28b2956f16fb31e781ed362165ca4729d
@@ -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: 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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Uc3DmpId
4
- VERSION = '0.0.75'
4
+ VERSION = '0.0.76'
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.0.75
4
+ version: 0.0.76
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Riley