serrano 0.3.6 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/ruby.yml +28 -0
- data/.gitignore +2 -0
- data/.rubocop.yml +50 -0
- data/.rubocop_todo.yml +105 -0
- data/CHANGELOG.md +33 -0
- data/{CONDUCT.md → CODE_OF_CONDUCT.md} +2 -2
- data/Gemfile +2 -0
- data/Gemfile.lock +56 -38
- data/LICENSE +1 -1
- data/README.md +35 -7
- data/Rakefile +26 -18
- data/bin/serrano +96 -98
- data/lib/serrano.rb +194 -77
- data/lib/serrano/cn.rb +7 -9
- data/lib/serrano/cnrequest.rb +42 -28
- data/lib/serrano/error.rb +2 -0
- data/lib/serrano/faraday.rb +15 -14
- data/lib/serrano/filterhandler.rb +13 -15
- data/lib/serrano/filters.rb +91 -78
- data/lib/serrano/helpers/configuration.rb +2 -2
- data/lib/serrano/request.rb +46 -39
- data/lib/serrano/request_cursor.rb +66 -59
- data/lib/serrano/styles.rb +14 -9
- data/lib/serrano/utils.rb +21 -14
- data/lib/serrano/version.rb +3 -1
- data/serrano.gemspec +33 -20
- metadata +87 -69
- data/.travis.yml +0 -8
- data/lib/serrano/constants.rb +0 -36
- data/lib/serrano/cursor_testing.rb +0 -52
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: serrano
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Chamberlain
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-05-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,210 +16,224 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.0'
|
20
20
|
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
22
|
+
version: 2.0.2
|
23
23
|
type: :development
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - "~>"
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '
|
29
|
+
version: '2.0'
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
32
|
+
version: 2.0.2
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
|
-
name:
|
34
|
+
name: codecov
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version:
|
40
|
-
- - ">="
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
version: 12.0.0
|
39
|
+
version: 0.1.10
|
43
40
|
type: :development
|
44
41
|
prerelease: false
|
45
42
|
version_requirements: !ruby/object:Gem::Requirement
|
46
43
|
requirements:
|
47
44
|
- - "~>"
|
48
45
|
- !ruby/object:Gem::Version
|
49
|
-
version:
|
50
|
-
- - ">="
|
51
|
-
- !ruby/object:Gem::Version
|
52
|
-
version: 12.0.0
|
46
|
+
version: 0.1.10
|
53
47
|
- !ruby/object:Gem::Dependency
|
54
|
-
name:
|
48
|
+
name: json
|
55
49
|
requirement: !ruby/object:Gem::Requirement
|
56
50
|
requirements:
|
57
51
|
- - "~>"
|
58
52
|
- !ruby/object:Gem::Version
|
59
|
-
version: '
|
60
|
-
- - ">="
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version: 3.2.1
|
53
|
+
version: '2.1'
|
63
54
|
type: :development
|
64
55
|
prerelease: false
|
65
56
|
version_requirements: !ruby/object:Gem::Requirement
|
66
57
|
requirements:
|
67
58
|
- - "~>"
|
68
59
|
- !ruby/object:Gem::Version
|
69
|
-
version: '
|
60
|
+
version: '2.1'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: rake
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: 12.3.1
|
68
|
+
- - "~>"
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '13.0'
|
71
|
+
type: :development
|
72
|
+
prerelease: false
|
73
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
70
75
|
- - ">="
|
71
76
|
- !ruby/object:Gem::Version
|
72
|
-
version: 3.
|
77
|
+
version: 12.3.1
|
78
|
+
- - "~>"
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '13.0'
|
73
81
|
- !ruby/object:Gem::Dependency
|
74
|
-
name:
|
82
|
+
name: rubocop
|
75
83
|
requirement: !ruby/object:Gem::Requirement
|
76
84
|
requirements:
|
77
85
|
- - "~>"
|
78
86
|
- !ruby/object:Gem::Version
|
79
|
-
version: 0.
|
87
|
+
version: 0.84.0
|
80
88
|
type: :development
|
81
89
|
prerelease: false
|
82
90
|
version_requirements: !ruby/object:Gem::Requirement
|
83
91
|
requirements:
|
84
92
|
- - "~>"
|
85
93
|
- !ruby/object:Gem::Version
|
86
|
-
version: 0.
|
94
|
+
version: 0.84.0
|
87
95
|
- !ruby/object:Gem::Dependency
|
88
|
-
name:
|
96
|
+
name: simplecov
|
89
97
|
requirement: !ruby/object:Gem::Requirement
|
90
98
|
requirements:
|
91
99
|
- - "~>"
|
92
100
|
- !ruby/object:Gem::Version
|
93
|
-
version: 0.
|
101
|
+
version: 0.18.5
|
94
102
|
type: :development
|
95
103
|
prerelease: false
|
96
104
|
version_requirements: !ruby/object:Gem::Requirement
|
97
105
|
requirements:
|
98
106
|
- - "~>"
|
99
107
|
- !ruby/object:Gem::Version
|
100
|
-
version: 0.
|
108
|
+
version: 0.18.5
|
101
109
|
- !ruby/object:Gem::Dependency
|
102
|
-
name:
|
110
|
+
name: test-unit
|
103
111
|
requirement: !ruby/object:Gem::Requirement
|
104
112
|
requirements:
|
105
113
|
- - "~>"
|
106
114
|
- !ruby/object:Gem::Version
|
107
|
-
version: '2
|
115
|
+
version: '3.2'
|
108
116
|
- - ">="
|
109
117
|
- !ruby/object:Gem::Version
|
110
|
-
version: 2.
|
118
|
+
version: 3.2.7
|
111
119
|
type: :development
|
112
120
|
prerelease: false
|
113
121
|
version_requirements: !ruby/object:Gem::Requirement
|
114
122
|
requirements:
|
115
123
|
- - "~>"
|
116
124
|
- !ruby/object:Gem::Version
|
117
|
-
version: '2
|
125
|
+
version: '3.2'
|
118
126
|
- - ">="
|
119
127
|
- !ruby/object:Gem::Version
|
120
|
-
version: 2.
|
128
|
+
version: 3.2.7
|
121
129
|
- !ruby/object:Gem::Dependency
|
122
130
|
name: vcr
|
123
131
|
requirement: !ruby/object:Gem::Requirement
|
124
132
|
requirements:
|
125
133
|
- - "~>"
|
126
134
|
- !ruby/object:Gem::Version
|
127
|
-
version: '
|
128
|
-
- - ">="
|
129
|
-
- !ruby/object:Gem::Version
|
130
|
-
version: 3.0.3
|
135
|
+
version: '6.0'
|
131
136
|
type: :development
|
132
137
|
prerelease: false
|
133
138
|
version_requirements: !ruby/object:Gem::Requirement
|
134
139
|
requirements:
|
135
140
|
- - "~>"
|
136
141
|
- !ruby/object:Gem::Version
|
137
|
-
version: '
|
138
|
-
- - ">="
|
139
|
-
- !ruby/object:Gem::Version
|
140
|
-
version: 3.0.3
|
142
|
+
version: '6.0'
|
141
143
|
- !ruby/object:Gem::Dependency
|
142
144
|
name: webmock
|
143
145
|
requirement: !ruby/object:Gem::Requirement
|
144
146
|
requirements:
|
145
147
|
- - "~>"
|
146
148
|
- !ruby/object:Gem::Version
|
147
|
-
version: '
|
149
|
+
version: '3.4'
|
148
150
|
- - ">="
|
149
151
|
- !ruby/object:Gem::Version
|
150
|
-
version:
|
152
|
+
version: 3.4.1
|
151
153
|
type: :development
|
152
154
|
prerelease: false
|
153
155
|
version_requirements: !ruby/object:Gem::Requirement
|
154
156
|
requirements:
|
155
157
|
- - "~>"
|
156
158
|
- !ruby/object:Gem::Version
|
157
|
-
version: '
|
159
|
+
version: '3.4'
|
158
160
|
- - ">="
|
159
161
|
- !ruby/object:Gem::Version
|
160
|
-
version:
|
162
|
+
version: 3.4.1
|
161
163
|
- !ruby/object:Gem::Dependency
|
162
164
|
name: faraday
|
163
165
|
requirement: !ruby/object:Gem::Requirement
|
164
166
|
requirements:
|
165
167
|
- - "~>"
|
166
168
|
- !ruby/object:Gem::Version
|
167
|
-
version:
|
169
|
+
version: '1.0'
|
170
|
+
- - ">="
|
171
|
+
- !ruby/object:Gem::Version
|
172
|
+
version: 1.0.1
|
168
173
|
type: :runtime
|
169
174
|
prerelease: false
|
170
175
|
version_requirements: !ruby/object:Gem::Requirement
|
171
176
|
requirements:
|
172
177
|
- - "~>"
|
173
178
|
- !ruby/object:Gem::Version
|
174
|
-
version:
|
179
|
+
version: '1.0'
|
180
|
+
- - ">="
|
181
|
+
- !ruby/object:Gem::Version
|
182
|
+
version: 1.0.1
|
175
183
|
- !ruby/object:Gem::Dependency
|
176
184
|
name: faraday_middleware
|
177
185
|
requirement: !ruby/object:Gem::Requirement
|
178
186
|
requirements:
|
179
187
|
- - "~>"
|
180
188
|
- !ruby/object:Gem::Version
|
181
|
-
version:
|
189
|
+
version: '1.0'
|
182
190
|
type: :runtime
|
183
191
|
prerelease: false
|
184
192
|
version_requirements: !ruby/object:Gem::Requirement
|
185
193
|
requirements:
|
186
194
|
- - "~>"
|
187
195
|
- !ruby/object:Gem::Version
|
188
|
-
version:
|
196
|
+
version: '1.0'
|
189
197
|
- !ruby/object:Gem::Dependency
|
190
|
-
name:
|
198
|
+
name: multi_json
|
191
199
|
requirement: !ruby/object:Gem::Requirement
|
192
200
|
requirements:
|
193
201
|
- - "~>"
|
194
202
|
- !ruby/object:Gem::Version
|
195
|
-
version:
|
203
|
+
version: '1.13'
|
204
|
+
- - ">="
|
205
|
+
- !ruby/object:Gem::Version
|
206
|
+
version: 1.13.1
|
196
207
|
type: :runtime
|
197
208
|
prerelease: false
|
198
209
|
version_requirements: !ruby/object:Gem::Requirement
|
199
210
|
requirements:
|
200
211
|
- - "~>"
|
201
212
|
- !ruby/object:Gem::Version
|
202
|
-
version:
|
213
|
+
version: '1.13'
|
214
|
+
- - ">="
|
215
|
+
- !ruby/object:Gem::Version
|
216
|
+
version: 1.13.1
|
203
217
|
- !ruby/object:Gem::Dependency
|
204
|
-
name:
|
218
|
+
name: thor
|
205
219
|
requirement: !ruby/object:Gem::Requirement
|
206
220
|
requirements:
|
207
|
-
- - "~>"
|
208
|
-
- !ruby/object:Gem::Version
|
209
|
-
version: '1.12'
|
210
221
|
- - ">="
|
211
222
|
- !ruby/object:Gem::Version
|
212
|
-
version:
|
223
|
+
version: '0.20'
|
224
|
+
- - "<"
|
225
|
+
- !ruby/object:Gem::Version
|
226
|
+
version: '1.1'
|
213
227
|
type: :runtime
|
214
228
|
prerelease: false
|
215
229
|
version_requirements: !ruby/object:Gem::Requirement
|
216
230
|
requirements:
|
217
|
-
- - "~>"
|
218
|
-
- !ruby/object:Gem::Version
|
219
|
-
version: '1.12'
|
220
231
|
- - ">="
|
221
232
|
- !ruby/object:Gem::Version
|
222
|
-
version:
|
233
|
+
version: '0.20'
|
234
|
+
- - "<"
|
235
|
+
- !ruby/object:Gem::Version
|
236
|
+
version: '1.1'
|
223
237
|
description: Low Level Ruby Client for the Crossref Search API
|
224
238
|
email: myrmecocystus@gmail.com
|
225
239
|
executables:
|
@@ -227,10 +241,12 @@ executables:
|
|
227
241
|
extensions: []
|
228
242
|
extra_rdoc_files: []
|
229
243
|
files:
|
244
|
+
- ".github/workflows/ruby.yml"
|
230
245
|
- ".gitignore"
|
231
|
-
- ".
|
246
|
+
- ".rubocop.yml"
|
247
|
+
- ".rubocop_todo.yml"
|
232
248
|
- CHANGELOG.md
|
233
|
-
-
|
249
|
+
- CODE_OF_CONDUCT.md
|
234
250
|
- Gemfile
|
235
251
|
- Gemfile.lock
|
236
252
|
- LICENSE
|
@@ -240,8 +256,6 @@ files:
|
|
240
256
|
- lib/serrano.rb
|
241
257
|
- lib/serrano/cn.rb
|
242
258
|
- lib/serrano/cnrequest.rb
|
243
|
-
- lib/serrano/constants.rb
|
244
|
-
- lib/serrano/cursor_testing.rb
|
245
259
|
- lib/serrano/error.rb
|
246
260
|
- lib/serrano/faraday.rb
|
247
261
|
- lib/serrano/filterhandler.rb
|
@@ -256,7 +270,12 @@ files:
|
|
256
270
|
homepage: https://github.com/sckott/serrano
|
257
271
|
licenses:
|
258
272
|
- MIT
|
259
|
-
metadata:
|
273
|
+
metadata:
|
274
|
+
homepage_uri: https://github.com/sckott/serrano
|
275
|
+
documentation_uri: https://www.rubydoc.info/gems/serrano
|
276
|
+
changelog_uri: https://github.com/sckott/serrano/releases/tag/v0.6.2
|
277
|
+
source_code_uri: https://github.com/sckott/serrano
|
278
|
+
bug_tracker_uri: https://github.com/sckott/serrano/issues
|
260
279
|
post_install_message:
|
261
280
|
rdoc_options: []
|
262
281
|
require_paths:
|
@@ -265,15 +284,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
265
284
|
requirements:
|
266
285
|
- - ">="
|
267
286
|
- !ruby/object:Gem::Version
|
268
|
-
version: '2.
|
287
|
+
version: '2.1'
|
269
288
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
270
289
|
requirements:
|
271
290
|
- - ">="
|
272
291
|
- !ruby/object:Gem::Version
|
273
292
|
version: '0'
|
274
293
|
requirements: []
|
275
|
-
|
276
|
-
rubygems_version: 2.6.8
|
294
|
+
rubygems_version: 3.1.2
|
277
295
|
signing_key:
|
278
296
|
specification_version: 4
|
279
297
|
summary: Crossref Client
|
data/.travis.yml
DELETED
data/lib/serrano/constants.rb
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
require 'net/http'
|
2
|
-
|
3
|
-
NETWORKABLE_EXCEPTIONS = [Faraday::Error::ClientError,
|
4
|
-
URI::InvalidURIError,
|
5
|
-
Encoding::UndefinedConversionError,
|
6
|
-
ArgumentError,
|
7
|
-
NoMethodError,
|
8
|
-
TypeError]
|
9
|
-
|
10
|
-
$cn_formats = ["rdf-xml", "turtle", "citeproc-json",
|
11
|
-
"citeproc-json-ish", "text", "ris", "bibtex",
|
12
|
-
"crossref-xml", "datacite-xml", "bibentry",
|
13
|
-
"crossref-tdm"]
|
14
|
-
|
15
|
-
$cn_format_headers = {"rdf-xml" => "application/rdf+xml",
|
16
|
-
"turtle" => "text/turtle",
|
17
|
-
"citeproc-json" => "transform/application/vnd.citationstyles.csl+json",
|
18
|
-
"text" => "text/x-bibliography",
|
19
|
-
"ris" => "application/x-research-info-systems",
|
20
|
-
"bibtex" => "application/x-bibtex",
|
21
|
-
"crossref-xml" => "application/vnd.crossref.unixref+xml",
|
22
|
-
"datacite-xml" => "application/vnd.datacite.datacite+xml",
|
23
|
-
"bibentry" => "application/x-bibtex",
|
24
|
-
"crossref-tdm" => "application/vnd.crossref.unixsd+xml"}
|
25
|
-
|
26
|
-
$cn_types = {"rdf-xml" => "text/xml",
|
27
|
-
"turtle" => "text/plain",
|
28
|
-
"citeproc-json" => "application/json",
|
29
|
-
"citeproc-json-ish" => "application/json",
|
30
|
-
"text" => "text/plain",
|
31
|
-
"ris" => "text/plain",
|
32
|
-
"bibtex" => "text/plain",
|
33
|
-
"crossref-xml" => "text/xml",
|
34
|
-
"datacite-xml" => "text/xml",
|
35
|
-
"bibentry" => "text/plain",
|
36
|
-
"crossref-tdm" => "text/xml"}
|
@@ -1,52 +0,0 @@
|
|
1
|
-
require 'faraday'
|
2
|
-
require "multi_json"
|
3
|
-
|
4
|
-
query = "widget"
|
5
|
-
cursor = "*"
|
6
|
-
limit = 100
|
7
|
-
cursor_max = 500
|
8
|
-
rows = limit
|
9
|
-
|
10
|
-
filter = nil
|
11
|
-
offset = nil
|
12
|
-
sample = nil
|
13
|
-
sort = nil
|
14
|
-
order = nil
|
15
|
-
facet = nil
|
16
|
-
|
17
|
-
args = { query: query, filter: filter, offset: offset,
|
18
|
-
rows: limit, sample: sample, sort: sort,
|
19
|
-
order: order, facet: facet, cursor: cursor }
|
20
|
-
opts = args.delete_if { |k, v| v.nil? }
|
21
|
-
|
22
|
-
conn = Faraday.new(:url => "http://api.crossref.org/", :request => nil)
|
23
|
-
|
24
|
-
def _req(conn, path, opts)
|
25
|
-
res = conn.get path, opts
|
26
|
-
return MultiJson.load(res.body)
|
27
|
-
end
|
28
|
-
|
29
|
-
def _redo_req(conn, path, js, opts, cu, max_avail, cursor_max)
|
30
|
-
if !cu.nil? and cursor_max > js['message']['items'].length
|
31
|
-
res = [js]
|
32
|
-
total = js['message']['items'].length
|
33
|
-
while (!cu.nil? and cursor_max > total and total < max_avail)
|
34
|
-
opts[:cursor] = cu
|
35
|
-
out = _req(conn, path, opts)
|
36
|
-
cu = out['message']['next-cursor']
|
37
|
-
res << out
|
38
|
-
total = res.collect { |x| x['message']['items'].length }.inject(:+)
|
39
|
-
end
|
40
|
-
return res
|
41
|
-
else
|
42
|
-
return js
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
path = 'works'
|
47
|
-
|
48
|
-
js = _req(conn, path, opts)
|
49
|
-
cu = js['message']['next-cursor']
|
50
|
-
max_avail = js['message']['total-results']
|
51
|
-
res = _redo_req(conn, path, js, opts, cu, max_avail, cursor_max)
|
52
|
-
|