ridley 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/ridley/connection.rb +17 -26
- data/lib/ridley/middleware/parse_json.rb +2 -1
- data/lib/ridley/version.rb +1 -1
- metadata +3 -3
data/lib/ridley/connection.rb
CHANGED
@@ -8,9 +8,8 @@ module Ridley
|
|
8
8
|
include Celluloid
|
9
9
|
|
10
10
|
VALID_OPTIONS = [
|
11
|
-
:
|
12
|
-
:
|
13
|
-
:request,
|
11
|
+
:retries,
|
12
|
+
:retry_interval,
|
14
13
|
:ssl,
|
15
14
|
:proxy
|
16
15
|
]
|
@@ -29,16 +28,10 @@ module Ridley
|
|
29
28
|
# @param [String] client_name
|
30
29
|
# @param [String] client_key
|
31
30
|
#
|
32
|
-
# @option options [Hash] :params
|
33
|
-
# URI query unencoded key/value pairs
|
34
|
-
# @option options [Hash] :headers
|
35
|
-
# unencoded HTTP header key/value pairs
|
36
31
|
# @option options [Integer] :retries (5)
|
37
32
|
# retry requests on 5XX failures
|
38
33
|
# @option options [Float] :retry_interval (0.5)
|
39
34
|
# how often we should pause between retries
|
40
|
-
# @option options [Hash] :request
|
41
|
-
# request options
|
42
35
|
# @option options [Hash] :ssl
|
43
36
|
# * :verify (Boolean) [true] set to false to disable SSL verification
|
44
37
|
# @option options [URI, String, Hash] :proxy
|
@@ -50,23 +43,21 @@ module Ridley
|
|
50
43
|
@retries = options[:retries]
|
51
44
|
@retry_interval = options[:retry_interval]
|
52
45
|
|
53
|
-
options =
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
}
|
69
|
-
)
|
46
|
+
options[:builder] = Faraday::Builder.new do |b|
|
47
|
+
b.response :json
|
48
|
+
b.request :retry,
|
49
|
+
max: @retries,
|
50
|
+
interval: @retry_interval,
|
51
|
+
exceptions: [
|
52
|
+
Ridley::Errors::HTTP5XXError,
|
53
|
+
Errno::ETIMEDOUT,
|
54
|
+
Faraday::Error::TimeoutError
|
55
|
+
]
|
56
|
+
b.response :chef_response
|
57
|
+
b.request :chef_auth, client_name, client_key
|
58
|
+
|
59
|
+
b.adapter :net_http_persistent
|
60
|
+
end
|
70
61
|
|
71
62
|
uri_hash = Addressable::URI.parse(server_url).to_hash.slice(:scheme, :host, :port)
|
72
63
|
|
@@ -28,7 +28,8 @@ module Ridley
|
|
28
28
|
#
|
29
29
|
# @return [Hash]
|
30
30
|
def parse(body)
|
31
|
-
|
31
|
+
result = MultiJson.decode(body)
|
32
|
+
result.is_a?(Hash) ? Hashie::Mash.new(result) : result
|
32
33
|
end
|
33
34
|
|
34
35
|
# Extracts the type of the response from the response headers
|
data/lib/ridley/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ridley
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-03-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json
|
@@ -400,7 +400,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
400
400
|
version: '0'
|
401
401
|
segments:
|
402
402
|
- 0
|
403
|
-
hash: -
|
403
|
+
hash: -2528594805736736498
|
404
404
|
requirements: []
|
405
405
|
rubyforge_project:
|
406
406
|
rubygems_version: 1.8.24
|