async-rest 0.12.0 → 0.12.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: bb987666810a3a57e687ffd7a3bdc84fa1d1202d9d175793c233d6fa7fd4f601
4
- data.tar.gz: fd8512c49fc42b9c1d19be516f245f833731f293ebaed31656a6b7d29f1d6d44
3
+ metadata.gz: 7a4bf59de34f8a513da719adecb09b3f82d8d5dfe29ef4e3c3b992368abcf03b
4
+ data.tar.gz: 6a579ab8c70d1d0619cce37b1192b258ed03ff1adc0db36a334199b3da485fb4
5
5
  SHA512:
6
- metadata.gz: 5e514f403513ee3886568b073ac2881af75de114b665d868874939aace962da6dcc8fefbb57f1fbcea3735e2705d3f7c17d82c25cfcb091f7b3356a56b45a9db
7
- data.tar.gz: 2c08eb8becbabc19a0c1f6760722735f86a2fa659faf63c3fc6a4aabd998408aa9e0beb6bf0ecd8780dd6c8e94167d2678411baffd82040e352dfe88e6d6ace4
6
+ metadata.gz: f0efb171429e1267c867c54ce3a3c1534f359f6e3e11d9a22752e1566da5af595369825f729d005a670867fe5d9de869beea5b31d701462a0429886e06226c43
7
+ data.tar.gz: 3c4eb83006339c58a15432a87d7ddd9d9d0c6b1f638c4599dd9aa02e0a7e9660768f83f55e46723673e2f6e7c9eca68fff94c81b65228a2ab03548d5f3d82dd1
@@ -7,8 +7,6 @@ matrix:
7
7
  - rvm: 2.4
8
8
  - rvm: 2.5
9
9
  - rvm: 2.6
10
- - rvm: 2.6
11
- gemfile: gems/event.gemfile
12
10
  - rvm: 2.6
13
11
  env: COVERAGE=PartialSummary,Coveralls
14
12
  - rvm: jruby-head
@@ -26,7 +26,21 @@ module Async
26
26
  class RequestError < Error
27
27
  end
28
28
 
29
+ class UnsupportedError < Error
30
+ end
31
+
29
32
  class ResponseError < Error
33
+ def initialize(response)
34
+ super(response.read)
35
+
36
+ @response = response
37
+ end
38
+
39
+ def to_s
40
+ "#{@response}: #{super}"
41
+ end
42
+
43
+ attr :response
30
44
  end
31
45
  end
32
46
  end
@@ -116,7 +116,7 @@ module Async
116
116
  @metadata = response.headers
117
117
  @value = response.read
118
118
  else
119
-
119
+ raise ResponseError, response
120
120
  end
121
121
  end
122
122
 
@@ -58,7 +58,7 @@ module Async
58
58
 
59
59
  return resource unless block_given?
60
60
 
61
- Async.run do
61
+ Async do
62
62
  begin
63
63
  yield resource
64
64
  ensure
@@ -20,6 +20,6 @@
20
20
 
21
21
  module Async
22
22
  module REST
23
- VERSION = "0.12.0"
23
+ VERSION = "0.12.1"
24
24
  end
25
25
  end
@@ -35,7 +35,9 @@ module Async
35
35
  end
36
36
 
37
37
  def prepare_request(payload, headers)
38
- headers['accept'] ||= @content_types.keys
38
+ @content_types.each_key do |key|
39
+ headers.add('accept', key)
40
+ end
39
41
 
40
42
  if payload
41
43
  headers['content-type'] = URLEncoded::APPLICATION_FORM_URLENCODED
@@ -36,6 +36,7 @@ module Async
36
36
  end
37
37
 
38
38
  def parser_for(response)
39
+ # It's not always clear why this error is being thrown.
39
40
  return Unsupported
40
41
  end
41
42
 
@@ -50,7 +51,7 @@ module Async
50
51
 
51
52
  class Unsupported < HTTP::Body::Wrapper
52
53
  def join
53
- raise ResponseError, super
54
+ raise UnsupportedError, super
54
55
  end
55
56
  end
56
57
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: async-rest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.0
4
+ version: 0.12.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-03 00:00:00.000000000 Z
11
+ date: 2019-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async-http