faraday_middleware-escher 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/faraday/middleware/escher/request_signer.rb +5 -2
- data/prototype/client.rb +12 -12
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b617defc8bb9224584ac172ac307574da0cc2390
|
4
|
+
data.tar.gz: c14eded164c5a69cdf5bc130ae7178e89411e9db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 42d68d65e8f07781d2263d4a360f18cea044388638ed0f8bdf83dec694366afb7ec604f7a22ab10c297a48bff1cd34d2b512508e1eebf021b5df5c194b17f17d
|
7
|
+
data.tar.gz: 150ae63241bd1dcecd5854f4cf55df4e659b0318a4569450eab097a4c9882f92cef9e1132066b3e62fc80f42ab1a5962e9f3101f7aa12e5e6b99edeeb2667f5a
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.2
|
@@ -19,10 +19,13 @@ class Faraday::Middleware::Escher::RequestSigner < Faraday::Middleware::Escher::
|
|
19
19
|
endpoint = uri_path.empty? ? '/' : uri_path
|
20
20
|
endpoint_with_query = [endpoint,env[:url].query].join('?')
|
21
21
|
|
22
|
+
request_headers = Hash[env[:request_headers].map{|k,v| [k,v] }]
|
23
|
+
request_headers['host'] ||= @host
|
24
|
+
|
22
25
|
request_data = {
|
23
26
|
uri: endpoint_with_query,
|
24
27
|
method: env[:method].to_s.upcase,
|
25
|
-
headers: env[:request_headers].map{|k,v| [k,v] }.push(['host',@host])
|
28
|
+
headers: request_headers.to_a # env[:request_headers].map{|k,v| [k,v] }.push(['host',@host])
|
26
29
|
}
|
27
30
|
|
28
31
|
request_data[:body]= env[:body] unless env[:body].nil?
|
@@ -39,4 +42,4 @@ class Faraday::Middleware::Escher::RequestSigner < Faraday::Middleware::Escher::
|
|
39
42
|
|
40
43
|
end
|
41
44
|
|
42
|
-
end
|
45
|
+
end
|
data/prototype/client.rb
CHANGED
@@ -2,24 +2,24 @@ $LOAD_PATH.unshift(File.absolute_path(File.join(__dir__, '..', 'lib')))
|
|
2
2
|
|
3
3
|
require_relative 'credentials'
|
4
4
|
|
5
|
-
require 'faraday_middleware/escher'
|
5
|
+
require 'faraday_middleware/escher'
|
6
6
|
|
7
|
-
conn = Faraday.new do |builder|
|
7
|
+
conn = Faraday.new do |builder|
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
builder.use FaradayMiddleware::Escher::RequestSigner,
|
10
|
+
credential_scope: CredentialScope,
|
11
|
+
options: AuthOptions,
|
12
|
+
active_key: -> { Escher::Keypool.new.get_active_key('EscherExample') }
|
13
13
|
|
14
|
-
|
15
|
-
# credential_scope: CredentialScope,
|
16
|
-
# options: AuthOptions,
|
17
|
-
# keydb_constructor: -> { Escher::Keypool.new.get_key_db }
|
14
|
+
builder.adapter :net_http
|
18
15
|
|
19
|
-
builder.adapter :net_http
|
20
16
|
|
17
|
+
end
|
21
18
|
|
22
|
-
|
19
|
+
# builder.use FaradayMiddleware::Escher::ResponseValidator,
|
20
|
+
# credential_scope: CredentialScope,
|
21
|
+
# options: AuthOptions,
|
22
|
+
# keydb_constructor: -> { Escher::Keypool.new.get_key_db }
|
23
23
|
|
24
24
|
require 'json'
|
25
25
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: faraday_middleware-escher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Luzsi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -190,4 +190,3 @@ test_files:
|
|
190
190
|
- spec/escher/base_spec.rb
|
191
191
|
- spec/escher/request_signer_spec.rb
|
192
192
|
- spec/spec_helper.rb
|
193
|
-
has_rdoc:
|