faraday_middleware-aws-signers-v4 0.1.1 → 0.1.2

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
  SHA1:
3
- metadata.gz: d0eb4ee868fba7b3cace89ae9e04b87e0438d7af
4
- data.tar.gz: 5f3c8472650cd5ce2a81a65c2a9c405969e9106a
3
+ metadata.gz: 4ba70dd3bae68eb5ac7bdd6a1541d1eeb3c1cdc7
4
+ data.tar.gz: 83f657d1a18bfb39cb77f796864959b9bc35730f
5
5
  SHA512:
6
- metadata.gz: 55df2b1245881f2c98baf7fa48f6d4b3d7dd6bdf74829b84d0d8138d9824ec6954eddbe4d7ee95296316f6f4f75d94016a0d4c938e7efee6382bae1c95c1381f
7
- data.tar.gz: 37f74f3a2ac67b05fe726812781eb4ede43cb4e0036816329c210e8f0e113f70038ebecb57db94193b200a4b39e81e579bc24877cfecaf981bb4b8b37ee274ee
6
+ metadata.gz: 860e21850b3d39d7c57a76840ceac8a6a83a2d2d97b89e55ad285bf17105eef6174772db30e99f077cdc87950a0d5c2afb2f63a4e7deca09ad2f0b158207a852
7
+ data.tar.gz: abb14ce16ba163b15d54353373fe17fa79bc2ee584b58eb5ae1875ab721b0a2c5a7a66fa73223feba63fa58312ed1d83ced22e7769aa8b372472addf0e52f19f
data/README.md CHANGED
@@ -4,6 +4,7 @@
4
4
 
5
5
  [![Gem Version](https://badge.fury.io/rb/faraday_middleware-aws-signers-v4.svg)](http://badge.fury.io/rb/faraday_middleware-aws-signers-v4)
6
6
  [![Build Status](https://travis-ci.org/winebarrel/faraday_middleware-aws-signers-v4.svg)](https://travis-ci.org/winebarrel/faraday_middleware-aws-signers-v4)
7
+ [![Coverage Status](https://coveralls.io/repos/winebarrel/faraday_middleware-aws-signers-v4/badge.svg?branch=master&service=github)](https://coveralls.io/github/winebarrel/faraday_middleware-aws-signers-v4?branch=master)
7
8
 
8
9
  ## Installation
9
10
 
@@ -31,6 +32,8 @@ require 'pp'
31
32
  conn = Faraday.new(url: 'https://apigateway.us-east-1.amazonaws.com') do |faraday|
32
33
  faraday.request :aws_signers_v4,
33
34
  credentials: Aws::Credentials.new(ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY']),
35
+ # If you use the credentials file:
36
+ #credentials: Aws::SharedCredentials.new.credentials,
34
37
  service_name: 'apigateway',
35
38
  region: 'us-east-1'
36
39
 
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
  Gem::Specification.new do |spec|
3
3
  spec.name = 'faraday_middleware-aws-signers-v4'
4
- spec.version = '0.1.1'
4
+ spec.version = '0.1.2'
5
5
  spec.authors = ['Genki Sugawara']
6
6
  spec.email = ['sgwr_dts@yahoo.co.jp']
7
7
 
@@ -23,4 +23,5 @@ Gem::Specification.new do |spec|
23
23
  spec.add_development_dependency 'rspec', '>= 3.0.0'
24
24
  spec.add_development_dependency 'timecop'
25
25
  spec.add_development_dependency 'faraday_middleware'
26
+ spec.add_development_dependency 'coveralls'
26
27
  end
@@ -30,12 +30,17 @@ class FaradayMiddleware::AwsSignersV4 < Faraday::Middleware
30
30
  service_name = options.fetch(:service_name)
31
31
  region = options.fetch(:region)
32
32
  @signer = Aws::Signers::V4.new(credentials, service_name, region)
33
-
34
- @net_http = app.is_a?(Faraday::Adapter::NetHttp)
33
+ @net_http = net_http?(app)
35
34
  end
36
35
 
37
36
  def call(env)
38
37
  normalize_for_net_http!(env)
38
+
39
+ # Escape the query string or the request won't sign correctly
40
+ if env.url and env.url.query
41
+ env.url.query = Seahorse::Util.uri_escape(env.url.query)
42
+ end
43
+
39
44
  req = Request.new(env)
40
45
  @signer.sign(req)
41
46
  @app.call(env)
@@ -43,6 +48,10 @@ class FaradayMiddleware::AwsSignersV4 < Faraday::Middleware
43
48
 
44
49
  private
45
50
 
51
+ def net_http?(app)
52
+ app.is_a?(Faraday::Adapter::NetHttp)
53
+ end
54
+
46
55
  def normalize_for_net_http!(env)
47
56
  return unless @net_http
48
57
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faraday_middleware-aws-signers-v4
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Sugawara
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-07-28 00:00:00.000000000 Z
11
+ date: 2015-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - '>='
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: coveralls
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
111
125
  description: Faraday middleware for AWS Signature Version 4.
112
126
  email:
113
127
  - sgwr_dts@yahoo.co.jp
@@ -148,7 +162,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
148
162
  version: '0'
149
163
  requirements: []
150
164
  rubyforge_project:
151
- rubygems_version: 2.0.14
165
+ rubygems_version: 2.0.14.1
152
166
  signing_key:
153
167
  specification_version: 4
154
168
  summary: Faraday middleware for AWS Signature Version 4.