serrano 0.3.0 → 0.3.6

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
  SHA1:
3
- metadata.gz: 17e8d485b799d87d73a32f1b1324a004647407fa
4
- data.tar.gz: cbba210bf1dbb7df00ef98b8e6824294a00472cd
3
+ metadata.gz: 36aad2a16040c5453b6f8254a7b6d01fad661c43
4
+ data.tar.gz: abdf146c4875f0ef7abbdf9b14dafb71c47bc7a9
5
5
  SHA512:
6
- metadata.gz: 65b752d0ab2e82da21b73569217a630affc64faa25947050311c30925f8eedd55469ae622d6bd19734929b4fb791c6e146f32d7c627300bd65ff5b9dd7eb4875
7
- data.tar.gz: bdd2dbe1a0e6b6c21ce71d404efdf0b97b61b02387f9363519821bd570eddc819bdcb545e375a7a794f186f9fb34cacc4a7fa800cf7634b3dd2b203e9d82b7ad
6
+ metadata.gz: '008664dcd932464f6360bf16c6a6cb097e326809c57d4e76e38ceee321aef9fe21d42ce1972e9a1e4db21cb53f2326f2aa9b3e8323be1a984ea13277b9f33756'
7
+ data.tar.gz: b5aeb13570f7907266f79879b4b141c1eea6576313d8758eb1c6cdf3f9b8467ea96cb3fa036ee73dd8b2a332dff4c04a2481e81795111e98010d2dfd388e55e8
data/.travis.yml CHANGED
@@ -3,5 +3,6 @@ cache: bundler
3
3
  rvm:
4
4
  - 2.1.8
5
5
  - 2.2.4
6
+ - 2.4.1
6
7
  script:
7
8
  bundle exec rake test TESTOPTS="-v"
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## 0.3.6 (2017-04-04)
2
+
3
+ * Updated dependency versions
4
+ * Now using `vcr` gem for caching HTTP requests for test suite (#38)
5
+ * Changed base URL for Crossref API for all requests to `https` (#37)
6
+ * Updated docs for `facet` parameter that it can be either a
7
+ boolean or a query string, e.g,. `license:*` to facet by license (#36)
8
+ * Documented in `offset` parameter the max of 10K instituted somewhat
9
+ recently (#34)
10
+ * Documented in top level `Serrano` module and in README the new
11
+ rate limit on all requests - which varies through time. (#32)
12
+
1
13
  ## 0.3.0 (2016-10-20)
2
14
 
3
15
  * Field queries now supported in appropriate methods:
data/Gemfile.lock CHANGED
@@ -1,50 +1,64 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- serrano (0.3.0)
5
- faraday (~> 0.9.2)
6
- faraday_middleware (~> 0.10.0)
4
+ serrano (0.3.1)
5
+ faraday (~> 0.12.0.1)
6
+ faraday_middleware (~> 0.11.0.1)
7
7
  multi_json (~> 1.12, >= 1.12.1)
8
- thor (~> 0.19.1)
8
+ thor (~> 0.19.4)
9
9
 
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- codecov (0.1.6)
13
+ addressable (2.5.0)
14
+ public_suffix (~> 2.0, >= 2.0.2)
15
+ codecov (0.1.10)
14
16
  json
15
17
  simplecov
16
18
  url
19
+ crack (0.4.3)
20
+ safe_yaml (~> 1.0.0)
17
21
  docile (1.1.5)
18
- faraday (0.9.2)
22
+ faraday (0.12.0.1)
19
23
  multipart-post (>= 1.2, < 3)
20
- faraday_middleware (0.10.0)
21
- faraday (>= 0.7.4, < 0.10)
22
- json (2.0.2)
24
+ faraday_middleware (0.11.0.1)
25
+ faraday (>= 0.7.4, < 1.0)
26
+ hashdiff (0.3.2)
27
+ json (2.0.3)
23
28
  multi_json (1.12.1)
24
29
  multipart-post (2.0.0)
25
30
  power_assert (0.3.1)
26
- rake (11.3.0)
27
- simplecov (0.12.0)
31
+ public_suffix (2.0.5)
32
+ rake (12.0.0)
33
+ safe_yaml (1.0.4)
34
+ simplecov (0.14.1)
28
35
  docile (~> 1.1.0)
29
36
  json (>= 1.8, < 3)
30
37
  simplecov-html (~> 0.10.0)
31
38
  simplecov-html (0.10.0)
32
39
  test-unit (3.2.1)
33
40
  power_assert
34
- thor (0.19.1)
41
+ thor (0.19.4)
35
42
  url (0.3.2)
43
+ vcr (3.0.3)
44
+ webmock (2.3.2)
45
+ addressable (>= 2.3.6)
46
+ crack (>= 0.3.2)
47
+ hashdiff
36
48
 
37
49
  PLATFORMS
38
50
  ruby
39
51
 
40
52
  DEPENDENCIES
41
- bundler (~> 1.13, >= 1.13.5)
42
- codecov (~> 0.1.6)
43
- json (~> 2.0, >= 2.0.2)
44
- rake (~> 11.3)
53
+ bundler (~> 1.14, >= 1.14.6)
54
+ codecov (~> 0.1.10)
55
+ json (~> 2.0, >= 2.0.3)
56
+ rake (~> 12.0, >= 12.0.0)
45
57
  serrano!
46
- simplecov (~> 0.12.0)
58
+ simplecov (~> 0.14.1)
47
59
  test-unit (~> 3.2, >= 3.2.1)
60
+ vcr (~> 3.0, >= 3.0.3)
61
+ webmock (~> 2.3, >= 2.3.2)
48
62
 
49
63
  BUNDLED WITH
50
- 1.13.5
64
+ 1.14.6
data/README.md CHANGED
@@ -46,6 +46,15 @@ Note about searching:
46
46
 
47
47
  You are using the Crossref search API described at https://github.com/CrossRef/rest-api-doc/blob/master/rest_api.md. When you search with query terms, on Crossref servers they are not searching full text, or even abstracts of articles, but only what is available in the data that is returned to you. That is, they search article titles, authors, etc. For some discussion on this, see https://github.com/CrossRef/rest-api-doc/issues/101
48
48
 
49
+ Rate limits:
50
+
51
+ Crossref introduced rate limiting recently. The rate limits apparently vary,
52
+ so we can't give a predictable rate limit. As of this writing, the rate
53
+ limit is 50 requests per second. Look for the headers `X-Rate-Limit-Limit`
54
+ and `X-Rate-Limit-Interval` in requests to see what the current rate
55
+ limits are.
56
+
57
+
49
58
  ## Install
50
59
 
51
60
  ### Release version
data/lib/serrano.rb CHANGED
@@ -10,8 +10,9 @@ require 'rexml/document'
10
10
  require 'rexml/xpath'
11
11
 
12
12
  # @!macro serrano_params
13
- # @param offset [Fixnum] Number of record to start at, from 1 to infinity.
14
- # @param limit [Fixnum] Number of results to return. Not relavant when searching with specific dois. Default: 20. Max: 1000
13
+ # @param offset [Fixnum] Number of record to start at, any non-negative integer up to 10,000
14
+ # @param limit [Fixnum] Number of results to return. Not relavant when searching with specific dois.
15
+ # Default: 20. Max: 1000
15
16
  # @param sample [Fixnum] Number of random results to return. when you use the sample parameter,
16
17
  # the limit and offset parameters are ignored. This parameter only used when works requested.
17
18
  # Max: 100.
@@ -22,7 +23,8 @@ require 'rexml/xpath'
22
23
  # order will be by the relevance score. If no query is included, then the sort order
23
24
  # will be by DOI update date.
24
25
  # @param order [String] Sort order, one of 'asc' or 'desc'
25
- # @param facet [Boolean] Include facet results. Default: false
26
+ # @param facet [Boolean/String] Include facet results OR a query (e.g., `license:*`) to facet by
27
+ # license. Default: false
26
28
  # @param verbose [Boolean] Print request headers to stdout. Default: false
27
29
 
28
30
  # @!macro cursor_params
@@ -90,13 +92,20 @@ require 'rexml/xpath'
90
92
  # available in the data that is returned to you. That is, they search
91
93
  # article titles, authors, etc. For some discussion on this, see
92
94
  # https://github.com/CrossRef/rest-api-doc/issues/101
95
+ #
96
+ # Rate limiting
97
+ # Crossref introduced rate limiting recently. The rate limits apparently vary,
98
+ # so we can't give a predictable rate limit. As of this writing, the rate
99
+ # limit is 50 requests per second. Look for the headers `X-Rate-Limit-Limit`
100
+ # and `X-Rate-Limit-Interval` in requests to see what the current rate
101
+ # limits are.
93
102
 
94
103
  module Serrano
95
104
  extend Configuration
96
105
 
97
106
  define_setting :access_token
98
107
  define_setting :access_secret
99
- define_setting :base_url, "http://api.crossref.org/"
108
+ define_setting :base_url, "https://api.crossref.org/"
100
109
 
101
110
  ##
102
111
  # Search the works route
@@ -63,7 +63,7 @@ module FaradayMiddleware
63
63
  def is_json?(string)
64
64
  MultiJson.load(string)
65
65
  return true
66
- rescue MultiJson::ParseError => e
66
+ rescue MultiJson::ParseError
67
67
  return false
68
68
  end
69
69
 
@@ -56,13 +56,13 @@ module Serrano
56
56
  opts = args.delete_if { |k, v| v.nil? }
57
57
 
58
58
  if verbose
59
- conn = Faraday.new(:url => Serrano.base_url, :request => options) do |f|
59
+ conn = Faraday.new(:url => Serrano.base_url, :request => options || []) do |f|
60
60
  f.response :logger
61
61
  f.adapter Faraday.default_adapter
62
62
  f.use FaradayMiddleware::RaiseHttpException
63
63
  end
64
64
  else
65
- conn = Faraday.new(:url => Serrano.base_url, :request => options) do |f|
65
+ conn = Faraday.new(:url => Serrano.base_url, :request => options || []) do |f|
66
66
  f.adapter Faraday.default_adapter
67
67
  f.use FaradayMiddleware::RaiseHttpException
68
68
  end
@@ -74,13 +74,13 @@ module Serrano
74
74
  opts = arguments.delete_if { |k, v| v.nil? }
75
75
 
76
76
  if verbose
77
- $conn = Faraday.new(:url => Serrano.base_url, :request => options) do |f|
77
+ $conn = Faraday.new(:url => Serrano.base_url, :request => options || []) do |f|
78
78
  f.response :logger
79
79
  f.adapter Faraday.default_adapter
80
80
  f.use FaradayMiddleware::RaiseHttpException
81
81
  end
82
82
  else
83
- $conn = Faraday.new(:url => Serrano.base_url, :request => options) do |f|
83
+ $conn = Faraday.new(:url => Serrano.base_url, :request => options || []) do |f|
84
84
  f.adapter Faraday.default_adapter
85
85
  f.use FaradayMiddleware::RaiseHttpException
86
86
  end
@@ -1,3 +1,3 @@
1
1
  module Serrano
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.6"
3
3
  end
data/serrano.gemspec CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
8
8
  s.version = Serrano::VERSION
9
9
  s.platform = Gem::Platform::RUBY
10
10
  s.required_ruby_version = '>= 2.0'
11
- s.date = '2016-10-20'
11
+ s.date = '2017-04-04'
12
12
  s.summary = "Crossref Client"
13
13
  s.description = "Low Level Ruby Client for the Crossref Search API"
14
14
  s.authors = "Scott Chamberlain"
@@ -22,15 +22,17 @@ Gem::Specification.new do |s|
22
22
  s.bindir = 'bin'
23
23
  s.executables = ['serrano']
24
24
 
25
- s.add_development_dependency 'bundler', '~> 1.13', '>= 1.13.5'
26
- s.add_development_dependency 'rake', '~> 11.3'
25
+ s.add_development_dependency 'bundler', '~> 1.14', '>= 1.14.6'
26
+ s.add_development_dependency 'rake', '~> 12.0', '>= 12.0.0'
27
27
  s.add_development_dependency 'test-unit', '~> 3.2', '>= 3.2.1'
28
- s.add_development_dependency 'simplecov', '~> 0.12.0'
29
- s.add_development_dependency 'codecov', '~> 0.1.6'
30
- s.add_development_dependency 'json', '~> 2.0', '>= 2.0.2'
28
+ s.add_development_dependency 'simplecov', '~> 0.14.1'
29
+ s.add_development_dependency 'codecov', '~> 0.1.10'
30
+ s.add_development_dependency 'json', '~> 2.0', '>= 2.0.3'
31
+ s.add_development_dependency 'vcr', '~> 3.0', '>= 3.0.3'
32
+ s.add_development_dependency 'webmock', '~> 2.3', '>= 2.3.2'
31
33
 
32
- s.add_runtime_dependency 'faraday', '~> 0.9.2'
33
- s.add_runtime_dependency 'faraday_middleware', '~> 0.10.0'
34
- s.add_runtime_dependency 'thor', '~> 0.19.1'
34
+ s.add_runtime_dependency 'faraday', '~> 0.12.0.1'
35
+ s.add_runtime_dependency 'faraday_middleware', '~> 0.11.0.1'
36
+ s.add_runtime_dependency 'thor', '~> 0.19.4'
35
37
  s.add_runtime_dependency 'multi_json', '~> 1.12', '>= 1.12.1'
36
38
  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.3.0
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Chamberlain
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-20 00:00:00.000000000 Z
11
+ date: 2017-04-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,34 +16,40 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.13'
19
+ version: '1.14'
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 1.13.5
22
+ version: 1.14.6
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: '1.13'
29
+ version: '1.14'
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 1.13.5
32
+ version: 1.14.6
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: rake
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '11.3'
39
+ version: '12.0'
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 12.0.0
40
43
  type: :development
41
44
  prerelease: false
42
45
  version_requirements: !ruby/object:Gem::Requirement
43
46
  requirements:
44
47
  - - "~>"
45
48
  - !ruby/object:Gem::Version
46
- version: '11.3'
49
+ version: '12.0'
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 12.0.0
47
53
  - !ruby/object:Gem::Dependency
48
54
  name: test-unit
49
55
  requirement: !ruby/object:Gem::Requirement
@@ -70,28 +76,28 @@ dependencies:
70
76
  requirements:
71
77
  - - "~>"
72
78
  - !ruby/object:Gem::Version
73
- version: 0.12.0
79
+ version: 0.14.1
74
80
  type: :development
75
81
  prerelease: false
76
82
  version_requirements: !ruby/object:Gem::Requirement
77
83
  requirements:
78
84
  - - "~>"
79
85
  - !ruby/object:Gem::Version
80
- version: 0.12.0
86
+ version: 0.14.1
81
87
  - !ruby/object:Gem::Dependency
82
88
  name: codecov
83
89
  requirement: !ruby/object:Gem::Requirement
84
90
  requirements:
85
91
  - - "~>"
86
92
  - !ruby/object:Gem::Version
87
- version: 0.1.6
93
+ version: 0.1.10
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.1.6
100
+ version: 0.1.10
95
101
  - !ruby/object:Gem::Dependency
96
102
  name: json
97
103
  requirement: !ruby/object:Gem::Requirement
@@ -101,7 +107,7 @@ dependencies:
101
107
  version: '2.0'
102
108
  - - ">="
103
109
  - !ruby/object:Gem::Version
104
- version: 2.0.2
110
+ version: 2.0.3
105
111
  type: :development
106
112
  prerelease: false
107
113
  version_requirements: !ruby/object:Gem::Requirement
@@ -111,49 +117,89 @@ dependencies:
111
117
  version: '2.0'
112
118
  - - ">="
113
119
  - !ruby/object:Gem::Version
114
- version: 2.0.2
120
+ version: 2.0.3
121
+ - !ruby/object:Gem::Dependency
122
+ name: vcr
123
+ requirement: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - "~>"
126
+ - !ruby/object:Gem::Version
127
+ version: '3.0'
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ version: 3.0.3
131
+ type: :development
132
+ prerelease: false
133
+ version_requirements: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - "~>"
136
+ - !ruby/object:Gem::Version
137
+ version: '3.0'
138
+ - - ">="
139
+ - !ruby/object:Gem::Version
140
+ version: 3.0.3
141
+ - !ruby/object:Gem::Dependency
142
+ name: webmock
143
+ requirement: !ruby/object:Gem::Requirement
144
+ requirements:
145
+ - - "~>"
146
+ - !ruby/object:Gem::Version
147
+ version: '2.3'
148
+ - - ">="
149
+ - !ruby/object:Gem::Version
150
+ version: 2.3.2
151
+ type: :development
152
+ prerelease: false
153
+ version_requirements: !ruby/object:Gem::Requirement
154
+ requirements:
155
+ - - "~>"
156
+ - !ruby/object:Gem::Version
157
+ version: '2.3'
158
+ - - ">="
159
+ - !ruby/object:Gem::Version
160
+ version: 2.3.2
115
161
  - !ruby/object:Gem::Dependency
116
162
  name: faraday
117
163
  requirement: !ruby/object:Gem::Requirement
118
164
  requirements:
119
165
  - - "~>"
120
166
  - !ruby/object:Gem::Version
121
- version: 0.9.2
167
+ version: 0.12.0.1
122
168
  type: :runtime
123
169
  prerelease: false
124
170
  version_requirements: !ruby/object:Gem::Requirement
125
171
  requirements:
126
172
  - - "~>"
127
173
  - !ruby/object:Gem::Version
128
- version: 0.9.2
174
+ version: 0.12.0.1
129
175
  - !ruby/object:Gem::Dependency
130
176
  name: faraday_middleware
131
177
  requirement: !ruby/object:Gem::Requirement
132
178
  requirements:
133
179
  - - "~>"
134
180
  - !ruby/object:Gem::Version
135
- version: 0.10.0
181
+ version: 0.11.0.1
136
182
  type: :runtime
137
183
  prerelease: false
138
184
  version_requirements: !ruby/object:Gem::Requirement
139
185
  requirements:
140
186
  - - "~>"
141
187
  - !ruby/object:Gem::Version
142
- version: 0.10.0
188
+ version: 0.11.0.1
143
189
  - !ruby/object:Gem::Dependency
144
190
  name: thor
145
191
  requirement: !ruby/object:Gem::Requirement
146
192
  requirements:
147
193
  - - "~>"
148
194
  - !ruby/object:Gem::Version
149
- version: 0.19.1
195
+ version: 0.19.4
150
196
  type: :runtime
151
197
  prerelease: false
152
198
  version_requirements: !ruby/object:Gem::Requirement
153
199
  requirements:
154
200
  - - "~>"
155
201
  - !ruby/object:Gem::Version
156
- version: 0.19.1
202
+ version: 0.19.4
157
203
  - !ruby/object:Gem::Dependency
158
204
  name: multi_json
159
205
  requirement: !ruby/object:Gem::Requirement
@@ -227,9 +273,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
227
273
  version: '0'
228
274
  requirements: []
229
275
  rubyforge_project:
230
- rubygems_version: 2.6.6
276
+ rubygems_version: 2.6.8
231
277
  signing_key:
232
278
  specification_version: 4
233
279
  summary: Crossref Client
234
280
  test_files: []
235
- has_rdoc: