nethttputils 0.3.2.3 → 0.3.2.4

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: 52cb3586cf1e8edfff5a39bfc518dcf103763d51
4
- data.tar.gz: 7e5dc6573a3bef30c8bbf8f6276ef9b95492156f
3
+ metadata.gz: 38a12dc1f12b37cdbb3094c424fcd5ab11777dd9
4
+ data.tar.gz: c9fc99deed5181dfc566968a4c7ab54aefe3ed9e
5
5
  SHA512:
6
- metadata.gz: c248f4e9bc55c5080c1073b52ed75ccfbeef7b5261b21316e2e6a3f4b6d743cdab14807906c0f553227581b6b9cb225c1fae07df4723404eb7346bfe1f2bde93
7
- data.tar.gz: f741a5256f92133596a5ffee7c361f59188825995f871f4a20b290147071a70466d5833e63b3c150f9f77385361713404a19bfd8170bcb833dfb37f7b56455f1
6
+ metadata.gz: 503c47b1ba730c6525bd9325a8431875a0e1494ba8f87faa0a9e3e27536410b4c9640c368e1ef8ec8636a2150c867f3e6a952e8f74e11f0138ac7c5e8811e413
7
+ data.tar.gz: 8ca0c0f35fab0df31616d4c766029d8407a78fba6aed04f40cbad4a111dea689175c8f5c5f36de853ef85a58bf2640f5cecfb14c51e2258441893d2dcaa39195
data/lib/nethttputils.rb CHANGED
@@ -104,7 +104,7 @@ module NetHTTPUtils
104
104
  logger = NetHTTPUtils.logger
105
105
 
106
106
  uri = http.instance_variable_get :@uri
107
- logger.warn "Warning: query params included in `url` argument are discarded because `:form` isn't empty" if uri.query && !form.empty?
107
+ logger.debug "Warning: query params included in `url` argument are discarded because `:form` isn't empty" if uri.query && !form.empty?
108
108
  # we can't just merge because URI fails to parse such queries as "/?1"
109
109
 
110
110
  uri.query = URI.encode_www_form form if %i{ HEAD GET }.include?(mtd = mtd.upcase) && !form.empty?
@@ -195,7 +195,7 @@ module NetHTTPUtils
195
195
  if remaining
196
196
  logger.debug "x-remaining: #{remaining}"
197
197
  if remaining <= 100
198
- t = (reset_time - current_timestamp + 1).fdiv remaining
198
+ t = (reset_time - current_timestamp + 1).fdiv([remaining - 5, 1].max)
199
199
  logger.warn "x-ratelimit sleep #{t} seconds"
200
200
  sleep t
201
201
  end
@@ -287,9 +287,9 @@ module NetHTTPUtils
287
287
  when /\A(20\d|3\d\d|405)\z/
288
288
  nil
289
289
  else
290
- ct = body.instance_variable_get(:@last_response).to_hash.fetch("content-type")
290
+ ct = body.instance_variable_get(:@last_response).to_hash["content-type"]
291
291
  raise Error.new(
292
- (ct == ["image/png"] ? ct : body),
292
+ (ct == ["image/png"] ? ct.first : body),
293
293
  code.to_i
294
294
  )
295
295
  end
data/nethttputils.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "nethttputils"
3
- spec.version = "0.3.2.3"
3
+ spec.version = "0.3.2.4"
4
4
  spec.summary = "this tool is like a pet that I adopted young and now I depend on, sorry"
5
5
  spec.description = <<-EOF
6
6
  Back in 2015 I was a guy automating things at my job and two scripts had a common need --
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nethttputils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2.3
4
+ version: 0.3.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Maslov aka Nakilon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-20 00:00:00.000000000 Z
11
+ date: 2019-02-02 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |2
14
14
  Back in 2015 I was a guy automating things at my job and two scripts had a common need --