openaccess-apc 0.2.1 → 0.2.2
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/openaccess/apc.rb +10 -11
- data/lib/openaccess/apc/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a698e7c44a9866af8f475583905dbb70337678ad
|
4
|
+
data.tar.gz: 02ce906ba42fa03dea06ec3b9f171d6070d5bf68
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c21a83d25ad8d8548142c1a6314216170f14e74dec2e26ce4b02beb8103f29303fa5081375a146ebd1118a5cf94c5473c87e2f8bbf4c4d3c014cf295dd528f6
|
7
|
+
data.tar.gz: c225213087854008087fba073508955f313083950d436594bbb63dd3bd141728b5ba70f5c99b7c4518adede734621affe95bf083e8c5ad271eac724cddfcfb97
|
data/lib/openaccess/apc.rb
CHANGED
@@ -86,7 +86,7 @@ module Puree
|
|
86
86
|
params = {
|
87
87
|
'associatedPersonUuids.uuid' => uuid,
|
88
88
|
'rendering' => :system,
|
89
|
-
'window.size' => limit.to_s,
|
89
|
+
'window.size' => (limit || 5).to_s,
|
90
90
|
'window.offset' => (opts[:offset] || 0).to_s
|
91
91
|
}
|
92
92
|
self.class.query_params(params, **opts)
|
@@ -190,13 +190,12 @@ module OpenAccess
|
|
190
190
|
# @option opts [Date, DateTime, String, Time] :created_start include
|
191
191
|
# publications deposited on or after this date
|
192
192
|
# @option opts [Integer, String] the Pure employee ID
|
193
|
-
# @
|
194
|
-
# required
|
193
|
+
# @return [Array<Hash>] the publications
|
195
194
|
def self.publications_for_person(username = nil, **opts)
|
196
195
|
person_uuid = person(username, employee_id: opts[:employee_id])
|
197
196
|
publications_criteria(opts)
|
198
197
|
pubs = @person_query.publications_extended(uuid: person_uuid, **opts)
|
199
|
-
publications_summary(pubs
|
198
|
+
publications_summary(pubs)
|
200
199
|
end
|
201
200
|
|
202
201
|
# Private helpers
|
@@ -243,20 +242,19 @@ module OpenAccess
|
|
243
242
|
workflow_state: pub.workflow_state
|
244
243
|
}
|
245
244
|
end
|
245
|
+
# rubocop:enable Metrics/MethodLength
|
246
246
|
private_class_method :publication_summary
|
247
247
|
|
248
248
|
# Sets the Puree person query criteria in an options hash
|
249
249
|
# @param opts [Hash] the options hash
|
250
250
|
# @return [Hash] the options hash
|
251
251
|
def self.publications_criteria(opts)
|
252
|
-
opts[:
|
253
|
-
opts[:limit] ||= opts[:results] * 10
|
252
|
+
opts[:limit] ||= 5
|
254
253
|
opts[:order_by] = ['-created']
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
opts[:
|
259
|
-
opts[:created_start] = start_date.to_s
|
254
|
+
end_date = to_date(opts[:created_date_end])
|
255
|
+
start_date = to_date(opts[:created_date_start])
|
256
|
+
opts[:created_end] = end_date.to_s if end_date # YYYY-MM-DD
|
257
|
+
opts[:created_start] = start_date.to_s if start_date
|
260
258
|
opts
|
261
259
|
end
|
262
260
|
private_class_method :publications_criteria
|
@@ -276,6 +274,7 @@ module OpenAccess
|
|
276
274
|
# @param date [Object] the date representation
|
277
275
|
# @param default [Date, nil] the default value if no date is supplied or
|
278
276
|
# string parsing fails
|
277
|
+
# @return [Date] the date instance
|
279
278
|
def self.to_date(date = nil, default = nil)
|
280
279
|
return default if date.nil? || date.empty?
|
281
280
|
return date if date.is_a?(Date)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openaccess-apc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Digital Innovation, Lancaster University Library
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-11-
|
11
|
+
date: 2017-11-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-ldap
|