async-rest 0.19.0 → 0.19.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: 9feb22e0660bd79fdf80e6fc2146afa4b6c51f6ef9a08e912415c59d99677232
4
- data.tar.gz: 4ed1027a6ff4cd8af484bbe7a237f3aef1933ef7e965551e0289ab672c8429e2
3
+ metadata.gz: ae3aeb21790cedb9bbbe38afbf40b3d5990b28cb1a6eaf076495fab5a25a77e1
4
+ data.tar.gz: 4c8fd49d8c4be1fe367f62fe50231f527ad9fb440a8533d40e34e4bd15fe5c60
5
5
  SHA512:
6
- metadata.gz: c79a403bc85492375ec4cc0f3a396a3beb834f1cd6813a631b0e6eeca99a65e4d7aae2c575892513ac93d4d885dce621e35cf8590fdcb0788254a031fc59b6bb
7
- data.tar.gz: 0c99e3832e8faf24bfec7778cc13879aa9f59b90f0fb9662ff585cdfa34d1227301baf44bc5f49be27c77064933abe6c1b5929b52eda78f06a3fee88b2378140
6
+ metadata.gz: cf1569c2fb59d7e216d3e677504e2b846cd3d47bf3411d55c5027c8cfb26334d3946996bb2e2c9e0180b2b040d543a6fa806a4af6e7952888387cce2f80b1dc2
7
+ data.tar.gz: 1fe580a38cc6a60d43943eb64ff28efddf32e3399b43c371fafeb7e6f6d39263bf66c45c2148742eaf628bfa5a6f123933859b2052f87b23c4e2e3b259a32737
checksums.yaml.gz.sig CHANGED
@@ -1,3 +1 @@
1
- � X �� ��Ja8�e�͡v��������U@W
2
- �ڕ���\M�i+�A\�՝�k��e�$�#C՘3�bS�x���l��|�U�����
3
- L��7��K���#�~_��(b���L��)Kc{�0N�cZ����SWY�lUR��yJ��JF����2�)��( �N<�\��v
1
+ 4`��ٍt��z�pged�Y�k\�K$bXr�������v0���V��Mb�B�jV˄l*[ǐ�o�=WI�TZY����P�=.���7�����E���`�M��odc��բ7)i�� ^��y����i��`�ħF۔©�*\�&C^'9�W�P骽�뺌� �]5���DZe�)�CI��)i�����_���ٳ��#��B�\[AV�:�(�LJ�l��e*�V�:�/��%V?�O4fj����p�� ���k�JZ���'`��k2�,�<!��I�׋�yH������*{Y�]Z��A�<7� �~��kf��(��}�����Ѕ�Ȭ�=��+����OW�h��s�h�#_�i���щ�F�؍^����<
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Async
7
7
  module REST
8
- VERSION = "0.19.0"
8
+ VERSION = "0.19.1"
9
9
  end
10
10
  end
@@ -7,13 +7,20 @@ module Async
7
7
  module REST
8
8
  module Wrapper
9
9
  class Generic
10
- protected def response_for(resource, request)
10
+ def retry_after_duration(value)
11
+ retry_after_time = Time.httpdate(value)
12
+ return [retry_after_time - Time.now, 0].max
13
+ rescue ArgumentError
14
+ return value.to_f
15
+ end
16
+
17
+ def response_for(resource, request)
11
18
  while true
12
19
  response = resource.call(request)
13
20
 
14
21
  if response.status == 429
15
22
  if retry_after = response.headers["retry-after"]
16
- sleep(retry_after.to_f)
23
+ sleep(retry_after_duration(retry_after))
17
24
  else
18
25
  # Without the `retry-after` header, we can't determine how long to wait, so we just return the response.
19
26
  return response
@@ -59,7 +66,7 @@ module Async
59
66
 
60
67
  def parser_for(response)
61
68
  # It's not always clear why this error is being thrown.
62
- return Unsupported
69
+ return nil
63
70
  end
64
71
 
65
72
  # Wrap the response body in the given klass.
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: async-rest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.19.0
4
+ version: 0.19.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -62,14 +62,14 @@ dependencies:
62
62
  requirements:
63
63
  - - "~>"
64
64
  - !ruby/object:Gem::Version
65
- version: '0.7'
65
+ version: '0.45'
66
66
  type: :runtime
67
67
  prerelease: false
68
68
  version_requirements: !ruby/object:Gem::Requirement
69
69
  requirements:
70
70
  - - "~>"
71
71
  - !ruby/object:Gem::Version
72
- version: '0.7'
72
+ version: '0.45'
73
73
  description:
74
74
  email:
75
75
  executables: []
metadata.gz.sig CHANGED
Binary file