record_store 6.0.0 → 6.0.1
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: 9c526e771b65c9da7f83836311bfc8c7b2af502a6801256ccdaa540b54df4138
|
4
|
+
data.tar.gz: f5e34d123f4dbef6d2206c4703310af91784deb0d0d2681de05f4aea78b83985
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5c507ba11cdefb048f6ceb74f30c1edef6a0f4bd0f0558126f7be02de3b9b38bab5c9d02bf8c8fec9f07ac59207dd24115fac7d0819141029f2691da989ada2
|
7
|
+
data.tar.gz: d688116ba3470d5ff1a4ab4d74b8d38d8d274d1180988839679d1d9b8aeb2e813a20b3fbc0634077e9a216b74d28ca1b0e3da125c43240488f5626a9c6fbd265
|
data/CHANGELOG.md
CHANGED
@@ -0,0 +1,30 @@
|
|
1
|
+
# Patch Dnsimple client method which retrieves headers for API rate limit dynamically
|
2
|
+
module Dnsimple
|
3
|
+
class Client
|
4
|
+
def execute(method, path, data = nil, options = {})
|
5
|
+
response = request(method, path, data, options)
|
6
|
+
rate_limit_sleep(response.headers["x-ratelimit-reset"].to_i, response.headers["x-ratelimit-remaining"].to_i)
|
7
|
+
|
8
|
+
case response.code
|
9
|
+
when 200..299
|
10
|
+
response
|
11
|
+
when 401
|
12
|
+
raise AuthenticationFailed, response["message"]
|
13
|
+
when 404
|
14
|
+
raise NotFoundError, response
|
15
|
+
else
|
16
|
+
raise RequestError, response
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def rate_limit_sleep(rate_limit_reset, rate_limit_remaining)
|
23
|
+
rate_limit_reset_in = [0, rate_limit_reset - Time.now.to_i].max
|
24
|
+
rate_limit_periods = rate_limit_remaining + 1
|
25
|
+
wait_time = rate_limit_reset_in / rate_limit_periods.to_f
|
26
|
+
|
27
|
+
sleep(wait_time) if wait_time > 0
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/record_store/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: record_store
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.0.
|
4
|
+
version: 6.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Willem van Bergen
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-
|
12
|
+
date: 2020-05-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
@@ -355,6 +355,7 @@ files:
|
|
355
355
|
- lib/record_store/cli.rb
|
356
356
|
- lib/record_store/provider.rb
|
357
357
|
- lib/record_store/provider/dnsimple.rb
|
358
|
+
- lib/record_store/provider/dnsimple/patch_api_header.rb
|
358
359
|
- lib/record_store/provider/dynect.rb
|
359
360
|
- lib/record_store/provider/google_cloud_dns.rb
|
360
361
|
- lib/record_store/provider/ns1.rb
|