serrano 0.6.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +5 -3
- data/.gitignore +1 -1
- data/CHANGELOG.md +4 -0
- data/Gemfile +1 -1
- data/README.md +2 -1
- data/Rakefile +17 -20
- data/lib/serrano.rb +62 -63
- data/lib/serrano/cn.rb +3 -3
- data/lib/serrano/cnrequest.rb +30 -30
- data/lib/serrano/faraday.rb +11 -11
- data/lib/serrano/filterhandler.rb +20 -20
- data/lib/serrano/filters.rb +67 -67
- data/lib/serrano/request.rb +31 -31
- data/lib/serrano/request_cursor.rb +49 -49
- data/lib/serrano/styles.rb +15 -15
- data/lib/serrano/utils.rb +6 -7
- data/lib/serrano/version.rb +1 -1
- data/serrano.gemspec +34 -34
- metadata +48 -57
- data/.rubocop.yml +0 -50
- data/.rubocop_todo.yml +0 -105
- data/Gemfile.lock +0 -82
data/lib/serrano/styles.rb
CHANGED
@@ -1,28 +1,28 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require "faraday"
|
4
|
+
require "multi_json"
|
5
5
|
|
6
6
|
def fetch_styles
|
7
|
-
base =
|
8
|
-
conn = Faraday.new(url: base)
|
7
|
+
base = "https://api.github.com/repos/citation-style-language/styles"
|
8
|
+
conn = Faraday.new(url: base) { |f|
|
9
9
|
f.use FaradayMiddleware::RaiseHttpException
|
10
10
|
f.adapter Faraday.default_adapter
|
11
|
-
|
12
|
-
args = {
|
13
|
-
tt = conn.get
|
11
|
+
}
|
12
|
+
args = {per_page: 1}
|
13
|
+
tt = conn.get "commits", args
|
14
14
|
commres = MultiJson.load(tt.body)
|
15
|
-
sha = commres[0][
|
16
|
-
sty = conn.get
|
15
|
+
sha = commres[0]["sha"]
|
16
|
+
sty = conn.get "git/trees/" + sha
|
17
17
|
res = MultiJson.load(sty.body)
|
18
|
-
files = res[
|
19
|
-
matches = files.collect
|
20
|
-
if x.match(
|
18
|
+
files = res["tree"].collect { |x| x["path"] }
|
19
|
+
matches = files.collect { |x|
|
20
|
+
if x.match("csl").nil?
|
21
21
|
nil
|
22
22
|
else
|
23
|
-
x.match(
|
23
|
+
x.match("csl").string
|
24
24
|
end
|
25
|
-
|
25
|
+
}
|
26
26
|
csls = matches.compact
|
27
|
-
csls.collect { |z| z.gsub(
|
27
|
+
csls.collect { |z| z.gsub(".csl", "") }
|
28
28
|
end
|
data/lib/serrano/utils.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
def make_ua
|
4
|
-
requa =
|
5
|
-
habua =
|
6
|
-
ua = requa +
|
4
|
+
requa = "Faraday/v" + Faraday::VERSION
|
5
|
+
habua = "Serrano/v" + Serrano::VERSION
|
6
|
+
ua = requa + " " + habua
|
7
7
|
if Serrano.mailto
|
8
|
-
ua
|
8
|
+
ua += " (mailto:%s)" % Serrano.mailto
|
9
9
|
end
|
10
10
|
# ua += format(' (mailto:%s)', Serrano.mailto) if Serrano.mailto
|
11
11
|
ua
|
@@ -18,9 +18,8 @@ end
|
|
18
18
|
|
19
19
|
def rename_query_filters(foo)
|
20
20
|
foo = foo.tostrings
|
21
|
-
foo = foo.map { |x, y| [x.to_s.sub(
|
22
|
-
foo
|
23
|
-
foo
|
21
|
+
foo = foo.map { |x, y| [x.to_s.sub("container_title", "container-title"), y] }.to_h
|
22
|
+
foo.map { |x, y| [x.to_s.sub("query_", "query."), y] }.to_h
|
24
23
|
end
|
25
24
|
|
26
25
|
class Hash
|
data/lib/serrano/version.rb
CHANGED
data/serrano.gemspec
CHANGED
@@ -1,51 +1,51 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
lib = File.expand_path(
|
3
|
+
lib = File.expand_path("lib", __dir__)
|
4
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
-
require
|
5
|
+
require "serrano/version"
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
|
-
s.name
|
9
|
-
s.version
|
10
|
-
s.platform
|
11
|
-
s.required_ruby_version =
|
12
|
-
s.date
|
13
|
-
s.summary
|
14
|
-
s.description =
|
15
|
-
s.authors
|
16
|
-
s.email
|
17
|
-
s.homepage
|
18
|
-
s.licenses
|
8
|
+
s.name = "serrano"
|
9
|
+
s.version = Serrano::VERSION
|
10
|
+
s.platform = Gem::Platform::RUBY
|
11
|
+
s.required_ruby_version = ">= 2.1"
|
12
|
+
s.date = "2020-10-19"
|
13
|
+
s.summary = "Crossref Client"
|
14
|
+
s.description = "Low Level Ruby Client for the Crossref Search API"
|
15
|
+
s.authors = "Scott Chamberlain"
|
16
|
+
s.email = "myrmecocystus@gmail.com"
|
17
|
+
s.homepage = "https://github.com/sckott/serrano"
|
18
|
+
s.licenses = "MIT"
|
19
19
|
|
20
20
|
s.files = `git ls-files -z`.split("\x0").reject do |f|
|
21
21
|
f.match(%r{^(test|spec|features)/})
|
22
22
|
end
|
23
|
-
s.require_paths = [
|
23
|
+
s.require_paths = ["lib"]
|
24
24
|
|
25
|
-
s.bindir
|
26
|
-
s.executables = [
|
25
|
+
s.bindir = "bin"
|
26
|
+
s.executables = ["serrano"]
|
27
27
|
|
28
|
-
s.add_development_dependency
|
29
|
-
s.add_development_dependency
|
30
|
-
s.add_development_dependency
|
31
|
-
s.add_development_dependency
|
32
|
-
s.add_development_dependency
|
33
|
-
s.add_development_dependency
|
34
|
-
s.add_development_dependency
|
35
|
-
s.add_development_dependency
|
36
|
-
s.add_development_dependency
|
28
|
+
s.add_development_dependency "bundler", '~> 2.1', '>= 2.1.4'
|
29
|
+
s.add_development_dependency "codecov", "~> 0.2.0"
|
30
|
+
s.add_development_dependency "json", '~> 2.3', '>= 2.3.1'
|
31
|
+
s.add_development_dependency "rake", '~> 13.0', '>= 13.0.1'
|
32
|
+
s.add_development_dependency "standard", "~> 0.7"
|
33
|
+
s.add_development_dependency "simplecov", "~> 0.19.0"
|
34
|
+
s.add_development_dependency "test-unit", '~> 3.3', '>= 3.3.6'
|
35
|
+
s.add_development_dependency "vcr", "~> 6.0"
|
36
|
+
s.add_development_dependency "webmock", '~> 3.9', '>= 3.9.3'
|
37
37
|
|
38
|
-
s.add_runtime_dependency
|
39
|
-
s.add_runtime_dependency
|
40
|
-
s.add_runtime_dependency
|
41
|
-
s.add_runtime_dependency 'thor', '
|
38
|
+
s.add_runtime_dependency "faraday", "~> 1.1"
|
39
|
+
s.add_runtime_dependency "faraday_middleware", "~> 1.0"
|
40
|
+
s.add_runtime_dependency "multi_json", '~> 1.15'
|
41
|
+
s.add_runtime_dependency 'thor', '~> 1.0', '>= 1.0.1'
|
42
42
|
|
43
43
|
s.metadata = {
|
44
|
-
|
45
|
-
|
46
|
-
|
44
|
+
"homepage_uri" => "https://github.com/sckott/serrano",
|
45
|
+
"documentation_uri" => "https://www.rubydoc.info/gems/serrano",
|
46
|
+
"changelog_uri" =>
|
47
47
|
"https://github.com/sckott/serrano/releases/tag/v#{s.version}",
|
48
|
-
|
49
|
-
|
48
|
+
"source_code_uri" => "https://github.com/sckott/serrano",
|
49
|
+
"bug_tracker_uri" => "https://github.com/sckott/serrano/issues"
|
50
50
|
}
|
51
51
|
end
|
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: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Chamberlain
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-10-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,116 +16,122 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '2.
|
19
|
+
version: '2.1'
|
20
20
|
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 2.
|
22
|
+
version: 2.1.4
|
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: '2.
|
29
|
+
version: '2.1'
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 2.
|
32
|
+
version: 2.1.4
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: codecov
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: 0.
|
39
|
+
version: 0.2.0
|
40
40
|
type: :development
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: 0.
|
46
|
+
version: 0.2.0
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: json
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '2.
|
53
|
+
version: '2.3'
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: 2.3.1
|
54
57
|
type: :development
|
55
58
|
prerelease: false
|
56
59
|
version_requirements: !ruby/object:Gem::Requirement
|
57
60
|
requirements:
|
58
61
|
- - "~>"
|
59
62
|
- !ruby/object:Gem::Version
|
60
|
-
version: '2.
|
63
|
+
version: '2.3'
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: 2.3.1
|
61
67
|
- !ruby/object:Gem::Dependency
|
62
68
|
name: rake
|
63
69
|
requirement: !ruby/object:Gem::Requirement
|
64
70
|
requirements:
|
65
|
-
- - ">="
|
66
|
-
- !ruby/object:Gem::Version
|
67
|
-
version: 12.3.1
|
68
71
|
- - "~>"
|
69
72
|
- !ruby/object:Gem::Version
|
70
73
|
version: '13.0'
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 13.0.1
|
71
77
|
type: :development
|
72
78
|
prerelease: false
|
73
79
|
version_requirements: !ruby/object:Gem::Requirement
|
74
80
|
requirements:
|
75
|
-
- - ">="
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
version: 12.3.1
|
78
81
|
- - "~>"
|
79
82
|
- !ruby/object:Gem::Version
|
80
83
|
version: '13.0'
|
84
|
+
- - ">="
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: 13.0.1
|
81
87
|
- !ruby/object:Gem::Dependency
|
82
|
-
name:
|
88
|
+
name: standard
|
83
89
|
requirement: !ruby/object:Gem::Requirement
|
84
90
|
requirements:
|
85
91
|
- - "~>"
|
86
92
|
- !ruby/object:Gem::Version
|
87
|
-
version: 0.
|
93
|
+
version: '0.7'
|
88
94
|
type: :development
|
89
95
|
prerelease: false
|
90
96
|
version_requirements: !ruby/object:Gem::Requirement
|
91
97
|
requirements:
|
92
98
|
- - "~>"
|
93
99
|
- !ruby/object:Gem::Version
|
94
|
-
version: 0.
|
100
|
+
version: '0.7'
|
95
101
|
- !ruby/object:Gem::Dependency
|
96
102
|
name: simplecov
|
97
103
|
requirement: !ruby/object:Gem::Requirement
|
98
104
|
requirements:
|
99
105
|
- - "~>"
|
100
106
|
- !ruby/object:Gem::Version
|
101
|
-
version: 0.
|
107
|
+
version: 0.19.0
|
102
108
|
type: :development
|
103
109
|
prerelease: false
|
104
110
|
version_requirements: !ruby/object:Gem::Requirement
|
105
111
|
requirements:
|
106
112
|
- - "~>"
|
107
113
|
- !ruby/object:Gem::Version
|
108
|
-
version: 0.
|
114
|
+
version: 0.19.0
|
109
115
|
- !ruby/object:Gem::Dependency
|
110
116
|
name: test-unit
|
111
117
|
requirement: !ruby/object:Gem::Requirement
|
112
118
|
requirements:
|
113
119
|
- - "~>"
|
114
120
|
- !ruby/object:Gem::Version
|
115
|
-
version: '3.
|
121
|
+
version: '3.3'
|
116
122
|
- - ">="
|
117
123
|
- !ruby/object:Gem::Version
|
118
|
-
version: 3.
|
124
|
+
version: 3.3.6
|
119
125
|
type: :development
|
120
126
|
prerelease: false
|
121
127
|
version_requirements: !ruby/object:Gem::Requirement
|
122
128
|
requirements:
|
123
129
|
- - "~>"
|
124
130
|
- !ruby/object:Gem::Version
|
125
|
-
version: '3.
|
131
|
+
version: '3.3'
|
126
132
|
- - ">="
|
127
133
|
- !ruby/object:Gem::Version
|
128
|
-
version: 3.
|
134
|
+
version: 3.3.6
|
129
135
|
- !ruby/object:Gem::Dependency
|
130
136
|
name: vcr
|
131
137
|
requirement: !ruby/object:Gem::Requirement
|
@@ -146,40 +152,34 @@ dependencies:
|
|
146
152
|
requirements:
|
147
153
|
- - "~>"
|
148
154
|
- !ruby/object:Gem::Version
|
149
|
-
version: '3.
|
155
|
+
version: '3.9'
|
150
156
|
- - ">="
|
151
157
|
- !ruby/object:Gem::Version
|
152
|
-
version: 3.
|
158
|
+
version: 3.9.3
|
153
159
|
type: :development
|
154
160
|
prerelease: false
|
155
161
|
version_requirements: !ruby/object:Gem::Requirement
|
156
162
|
requirements:
|
157
163
|
- - "~>"
|
158
164
|
- !ruby/object:Gem::Version
|
159
|
-
version: '3.
|
165
|
+
version: '3.9'
|
160
166
|
- - ">="
|
161
167
|
- !ruby/object:Gem::Version
|
162
|
-
version: 3.
|
168
|
+
version: 3.9.3
|
163
169
|
- !ruby/object:Gem::Dependency
|
164
170
|
name: faraday
|
165
171
|
requirement: !ruby/object:Gem::Requirement
|
166
172
|
requirements:
|
167
173
|
- - "~>"
|
168
174
|
- !ruby/object:Gem::Version
|
169
|
-
version: '1.
|
170
|
-
- - ">="
|
171
|
-
- !ruby/object:Gem::Version
|
172
|
-
version: 1.0.1
|
175
|
+
version: '1.1'
|
173
176
|
type: :runtime
|
174
177
|
prerelease: false
|
175
178
|
version_requirements: !ruby/object:Gem::Requirement
|
176
179
|
requirements:
|
177
180
|
- - "~>"
|
178
181
|
- !ruby/object:Gem::Version
|
179
|
-
version: '1.
|
180
|
-
- - ">="
|
181
|
-
- !ruby/object:Gem::Version
|
182
|
-
version: 1.0.1
|
182
|
+
version: '1.1'
|
183
183
|
- !ruby/object:Gem::Dependency
|
184
184
|
name: faraday_middleware
|
185
185
|
requirement: !ruby/object:Gem::Requirement
|
@@ -200,40 +200,34 @@ dependencies:
|
|
200
200
|
requirements:
|
201
201
|
- - "~>"
|
202
202
|
- !ruby/object:Gem::Version
|
203
|
-
version: '1.
|
204
|
-
- - ">="
|
205
|
-
- !ruby/object:Gem::Version
|
206
|
-
version: 1.13.1
|
203
|
+
version: '1.15'
|
207
204
|
type: :runtime
|
208
205
|
prerelease: false
|
209
206
|
version_requirements: !ruby/object:Gem::Requirement
|
210
207
|
requirements:
|
211
208
|
- - "~>"
|
212
209
|
- !ruby/object:Gem::Version
|
213
|
-
version: '1.
|
214
|
-
- - ">="
|
215
|
-
- !ruby/object:Gem::Version
|
216
|
-
version: 1.13.1
|
210
|
+
version: '1.15'
|
217
211
|
- !ruby/object:Gem::Dependency
|
218
212
|
name: thor
|
219
213
|
requirement: !ruby/object:Gem::Requirement
|
220
214
|
requirements:
|
221
|
-
- - "
|
215
|
+
- - "~>"
|
222
216
|
- !ruby/object:Gem::Version
|
223
|
-
version: '0
|
224
|
-
- - "
|
217
|
+
version: '1.0'
|
218
|
+
- - ">="
|
225
219
|
- !ruby/object:Gem::Version
|
226
|
-
version:
|
220
|
+
version: 1.0.1
|
227
221
|
type: :runtime
|
228
222
|
prerelease: false
|
229
223
|
version_requirements: !ruby/object:Gem::Requirement
|
230
224
|
requirements:
|
231
|
-
- - "
|
225
|
+
- - "~>"
|
232
226
|
- !ruby/object:Gem::Version
|
233
|
-
version: '0
|
234
|
-
- - "
|
227
|
+
version: '1.0'
|
228
|
+
- - ">="
|
235
229
|
- !ruby/object:Gem::Version
|
236
|
-
version:
|
230
|
+
version: 1.0.1
|
237
231
|
description: Low Level Ruby Client for the Crossref Search API
|
238
232
|
email: myrmecocystus@gmail.com
|
239
233
|
executables:
|
@@ -243,12 +237,9 @@ extra_rdoc_files: []
|
|
243
237
|
files:
|
244
238
|
- ".github/workflows/ruby.yml"
|
245
239
|
- ".gitignore"
|
246
|
-
- ".rubocop.yml"
|
247
|
-
- ".rubocop_todo.yml"
|
248
240
|
- CHANGELOG.md
|
249
241
|
- CODE_OF_CONDUCT.md
|
250
242
|
- Gemfile
|
251
|
-
- Gemfile.lock
|
252
243
|
- LICENSE
|
253
244
|
- README.md
|
254
245
|
- Rakefile
|
@@ -273,7 +264,7 @@ licenses:
|
|
273
264
|
metadata:
|
274
265
|
homepage_uri: https://github.com/sckott/serrano
|
275
266
|
documentation_uri: https://www.rubydoc.info/gems/serrano
|
276
|
-
changelog_uri: https://github.com/sckott/serrano/releases/tag/
|
267
|
+
changelog_uri: https://github.com/sckott/serrano/releases/tag/v1.0.0
|
277
268
|
source_code_uri: https://github.com/sckott/serrano
|
278
269
|
bug_tracker_uri: https://github.com/sckott/serrano/issues
|
279
270
|
post_install_message:
|
data/.rubocop.yml
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
inherit_from: .rubocop_todo.yml
|
2
|
-
|
3
|
-
Naming/FileName:
|
4
|
-
Exclude:
|
5
|
-
- 'test/test-helper.rb'
|
6
|
-
|
7
|
-
Metrics/ParameterLists:
|
8
|
-
Max: 18
|
9
|
-
|
10
|
-
Metrics/ModuleLength:
|
11
|
-
Max: 800
|
12
|
-
|
13
|
-
# Offense count: 22
|
14
|
-
# Configuration parameters: AllowedVariables.
|
15
|
-
Lint/UselessAssignment:
|
16
|
-
Exclude:
|
17
|
-
- 'lib/serrano/filters.rb'
|
18
|
-
|
19
|
-
Lint/RaiseException:
|
20
|
-
Enabled: true
|
21
|
-
|
22
|
-
Lint/StructNewOverride:
|
23
|
-
Enabled: true
|
24
|
-
|
25
|
-
Style/HashEachMethods:
|
26
|
-
Enabled: true
|
27
|
-
|
28
|
-
Style/HashTransformKeys:
|
29
|
-
Enabled: true
|
30
|
-
|
31
|
-
Style/HashTransformValues:
|
32
|
-
Enabled: true
|
33
|
-
|
34
|
-
Layout/LineLength:
|
35
|
-
Max: 525
|
36
|
-
|
37
|
-
Layout/SpaceAroundMethodCallOperator:
|
38
|
-
Enabled: true
|
39
|
-
|
40
|
-
Style/ExponentialNotation:
|
41
|
-
Enabled: true
|
42
|
-
|
43
|
-
Layout/EmptyLinesAroundAttributeAccessor:
|
44
|
-
Enabled: true
|
45
|
-
|
46
|
-
Style/SlicingWithRange:
|
47
|
-
Enabled: true
|
48
|
-
|
49
|
-
Lint/DeprecatedOpenSSLConstant:
|
50
|
-
Enabled: false
|