clientele 0.3.15 → 0.3.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/clientele/configuration.rb +25 -4
- data/lib/clientele/request.rb +2 -0
- data/lib/clientele/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e00adee7beb377011ab43eb243b79d8d41a3416
|
4
|
+
data.tar.gz: 1ab8f9447b8a70ba9103c0d30089105a99192d10
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef06a52d69b52013569dd4c265d4c95b95ad9e2afb1950fc1372bd43064a94ba5c858305e136c8d6ad1cde028e6b631055bf466b0a331ab79b1d10f7796557f3
|
7
|
+
data.tar.gz: 0bc3f5d3d8e658639cf28f979c744998bd5f8df4f58b185719c7058ae2a99b9f745ed000db1d0d3c1fa9f2acaeae3871e54da4b8aeeb27197ddc04dafe42e11e
|
@@ -1,20 +1,41 @@
|
|
1
1
|
require 'logger'
|
2
2
|
|
3
3
|
require 'faraday'
|
4
|
+
require 'faraday_middleware'
|
4
5
|
|
5
6
|
module Clientele
|
6
7
|
class Configuration < BlockParty::Configuration
|
7
8
|
|
8
|
-
attr_accessor :logger, :adapter, :headers, :hashify_content_type, :root_url, :follow_redirects, :redirect_limit
|
9
|
+
attr_accessor :logger, :adapter, :headers, :hashify_content_type, :root_url, :follow_redirects, :redirect_limit, :ensure_trailing_slash, :faraday_configuration
|
9
10
|
|
10
11
|
def initialize
|
11
|
-
self.logger =
|
12
|
-
self.adapter =
|
13
|
-
self.headers =
|
12
|
+
self.logger = Logger.new($stdout)
|
13
|
+
self.adapter = Faraday.default_adapter
|
14
|
+
self.headers = {}
|
14
15
|
self.hashify_content_type = /\bjson$/
|
15
16
|
self.follow_redirects = true
|
16
17
|
self.redirect_limit = 5
|
17
18
|
self.ensure_trailing_slash = true
|
19
|
+
|
20
|
+
self.faraday_configuration = default_faraday_configuration
|
21
|
+
end
|
22
|
+
|
23
|
+
def default_faraday_configuration
|
24
|
+
@default_faraday_configuration ||= Proc.new do |conn, options|
|
25
|
+
|
26
|
+
conn.use FaradayMiddleware::FollowRedirects, limit: options[:redirect_limit] if options[:follow_redirects]
|
27
|
+
|
28
|
+
conn.request :url_encoded
|
29
|
+
|
30
|
+
conn.response :rashify
|
31
|
+
conn.response :logger, options[:logger], bodies: true
|
32
|
+
conn.response :json, content_type: options[:hashify_content_type], preserve_raw: true
|
33
|
+
|
34
|
+
conn.adapter options[:adapter] if options[:adapter]
|
35
|
+
|
36
|
+
conn.options.params_encoder = options[:params_encoder] if options[:params_encoder]
|
37
|
+
|
38
|
+
end
|
18
39
|
end
|
19
40
|
|
20
41
|
end
|
data/lib/clientele/request.rb
CHANGED
data/lib/clientele/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clientele
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Keele
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|