purl_fetcher-client 0.2.0 → 0.3.0
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0fbb1d4ee923c8a04d013b372637f82b18c9a2fa433cf40792aec85152062f1
|
4
|
+
data.tar.gz: 01dad44de5ded0fd3206d7adb7be24d89103ce8cbafb3cf1aaa9abee51f8add8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c7daf20c0d96b891998a9a622d5ca05b319b2a1ff60da84a6200f536fd778ca91ed41b396aa688a7b5d4b4c40d62a56e5bf49366596539968fa4cf1dcb40e13
|
7
|
+
data.tar.gz: 5352c32604756a40e6d807e3c93b05321aeb4c67d1222fb6fe8b03b60e20ba15dffb16e40631b05ba15c1c1824749be9f0ec10d3f757623ff575e1da214a0417
|
@@ -4,15 +4,18 @@ class PurlFetcher::Client::DeletesReader < PurlFetcher::Client::Reader
|
|
4
4
|
return to_enum(:each) unless block_given?
|
5
5
|
|
6
6
|
deletes(first_modified: first_modified).each do |change|
|
7
|
-
|
7
|
+
|
8
|
+
public_xml = PurlFetcher::Client::PublicXmlRecord.new(change['druid'].sub('druid:', ''), settings)
|
9
|
+
|
10
|
+
yield public_xml, change, self
|
8
11
|
end
|
9
12
|
|
10
13
|
changes(first_modified: first_modified, target: target).each do |change|
|
11
|
-
|
14
|
+
public_xml = PurlFetcher::Client::PublicXmlRecord.new(change['druid'].sub('druid:', ''), settings)
|
12
15
|
|
13
16
|
next unless target.nil? || (change['false_targets'] && change['false_targets'].include?(target)) || (settings['skip_if_catkey'] && record.catkey)
|
14
17
|
|
15
|
-
yield
|
18
|
+
yield public_xml, change, self
|
16
19
|
end
|
17
20
|
end
|
18
21
|
end
|
@@ -1,10 +1,11 @@
|
|
1
1
|
class PurlFetcher::Client::Reader
|
2
2
|
include Enumerable
|
3
|
-
attr_reader :input_stream, :settings
|
3
|
+
attr_reader :input_stream, :settings, :range
|
4
4
|
|
5
5
|
def initialize(input_stream, settings = {})
|
6
6
|
@settings = settings
|
7
7
|
@input_stream = input_stream
|
8
|
+
@range = {}
|
8
9
|
end
|
9
10
|
|
10
11
|
def each
|
@@ -15,7 +16,7 @@ class PurlFetcher::Client::Reader
|
|
15
16
|
|
16
17
|
public_xml = PurlFetcher::Client::PublicXmlRecord.new(change['druid'].sub('druid:', ''), settings)
|
17
18
|
|
18
|
-
yield public_xml, change,
|
19
|
+
yield public_xml, change, self
|
19
20
|
end
|
20
21
|
end
|
21
22
|
|
@@ -68,18 +69,19 @@ class PurlFetcher::Client::Reader
|
|
68
69
|
def paginated_get(path, accessor, options = {})
|
69
70
|
Enumerator.new do |yielder|
|
70
71
|
params = options.dup
|
71
|
-
per_page = params.delete(:per_page) {
|
72
|
+
per_page = params.delete(:per_page) { 1000 }
|
72
73
|
page = params.delete(:page) { 1 }
|
73
74
|
max = params.delete(:max) { 1_000_000 }
|
74
75
|
total = 0
|
75
76
|
|
76
77
|
loop do
|
77
78
|
data = get(path, { per_page: per_page, page: page }.merge(params))
|
79
|
+
@range = data['range']
|
78
80
|
|
79
81
|
total += data[accessor].length
|
80
82
|
|
81
83
|
data[accessor].each do |element|
|
82
|
-
yielder.yield element,
|
84
|
+
yielder.yield element, self
|
83
85
|
end
|
84
86
|
|
85
87
|
page = data['pages']['next_page']
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: purl_fetcher-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Beer
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-05-
|
11
|
+
date: 2019-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|