faraday_middleware-aws-sigv4 0.2.2 → 0.4.0

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
- SHA1:
3
- metadata.gz: 5261b18d9aa30fdf39be58b9c030156590629001
4
- data.tar.gz: 7e8879d43e869b8a7c72b869601d3265d9a3f0ab
2
+ SHA256:
3
+ metadata.gz: d0e5eb23ca6df3387ac50a4917e304311f606276c96fbab4aa0a8e8946ed97c4
4
+ data.tar.gz: 326b17872f5fe6d1127533eec5a46af0f2c5d5918485be48bfaf6c53ed198328
5
5
  SHA512:
6
- metadata.gz: fde65a4dbb4c7f1099b08262db7d699757e4b77bf13c5e028bcd1671b974f978c7a3da5d6bcb045aafe3d94343b9d085b10e8bc757ca78574180352bd72b0858
7
- data.tar.gz: 9a5f8f306279fb1ee07b4ef29d214bc77ad8b07d38b0df5d9d0609fbd8eb8a93b609956d93d5c1af9defd611babc0489fc3a4303fef451299d619bf8c631a106
6
+ metadata.gz: 7cb0cc83b9b82920b26106ebc2039684c17679161ef97c93a65c01a72bcf54daa9d510cc0d0d7e40fbb6888db28dcd1a4a62b6c3defc9823b4889aba75088570
7
+ data.tar.gz: c5165646f89f56de6b3c653112d6f71bcdb60cf63dcc1949de6fb9ec905bd9858c32c552564ecc916cde03479ee7f01f63890bbd883276fc6dedc9e8a2a7f3af
@@ -0,0 +1,50 @@
1
+ name: test
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+
7
+ jobs:
8
+ build:
9
+ runs-on: ubuntu-latest
10
+ strategy:
11
+ fail-fast: false
12
+ matrix:
13
+ ruby:
14
+ - 2.4
15
+ - 2.5
16
+ - 2.6
17
+ - 2.7
18
+ gemfile:
19
+ - gemfiles/faraday_0.15.gemfile
20
+ - gemfiles/faraday_0.16.gemfile
21
+ - gemfiles/faraday_0.17.gemfile
22
+
23
+ steps:
24
+ - uses: actions/checkout@v2
25
+ - uses: actions/setup-ruby@v1
26
+ with:
27
+ ruby-version: ${{ matrix.ruby }}
28
+ - uses: actions/cache@v2
29
+ with:
30
+ path: gemfiles/vendor/bundle
31
+ key: ${{ runner.os }}-gems-${{ matrix.ruby }}-${{ matrix.gemfile }}-${{ hashFiles('faraday_middleware-aws-sigv4.gemspec', '**/Gemfile', '${{ matrix.gemfile }}') }}
32
+ restore-keys: |
33
+ ${{ runner.os }}-gems-${{ matrix.ruby }}-${{ matrix.gemfile }}-
34
+
35
+ - name: Setup dependencies
36
+ run: |
37
+ bundle config path vendor/bundle
38
+ bundle install
39
+ env:
40
+ BUNDLE_GEMFILE: ${{ matrix.gemfile }}
41
+
42
+ - name: Run tests
43
+ run: ${{ matrix.env }} bundle exec rake
44
+ env:
45
+ BUNDLE_GEMFILE: ${{ matrix.gemfile }}
46
+
47
+ - name: Coveralls GitHub Action
48
+ uses: coverallsapp/github-action@v1.1.2
49
+ with:
50
+ github-token: ${{ secrets.GITHUB_TOKEN }}
data/.gitignore CHANGED
@@ -8,6 +8,7 @@
8
8
  /spec/reports/
9
9
  /tmp/
10
10
  test.rb
11
+ /gemfiles/*.lock
11
12
 
12
13
  # rspec failure tracking
13
14
  .rspec_status
@@ -0,0 +1,4 @@
1
+ SimpleCov.start do
2
+ # exclude directories and files
3
+ add_filter "/spec/"
4
+ end
@@ -0,0 +1,15 @@
1
+ appraise 'faraday-0.15' do
2
+ gem 'faraday', '~> 0.15.0'
3
+ end
4
+
5
+ appraise 'faraday-0.16' do
6
+ gem 'faraday', '~> 0.16.0'
7
+ end
8
+
9
+ appraise 'faraday-0.17' do
10
+ gem 'faraday', '~> 0.17.0'
11
+ end
12
+
13
+ appraise 'faraday-1.0' do
14
+ gem 'faraday', '~> 1.0.0'
15
+ end
data/README.md CHANGED
@@ -3,9 +3,15 @@
3
3
  [Faraday](https://github.com/lostisland/faraday) middleware for AWS Signature Version 4 using [aws-sigv4](https://rubygems.org/gems/aws-sigv4).
4
4
 
5
5
  [![Gem Version](https://badge.fury.io/rb/faraday_middleware-aws-sigv4.svg)](https://badge.fury.io/rb/faraday_middleware-aws-sigv4)
6
- [![Build Status](https://travis-ci.org/winebarrel/faraday_middleware-aws-sigv4.svg?branch=master)](https://travis-ci.org/winebarrel/faraday_middleware-aws-sigv4)
6
+ ![test](https://github.com/winebarrel/faraday_middleware-aws-sigv4/workflows/test/badge.svg)
7
7
  [![Coverage Status](https://coveralls.io/repos/github/winebarrel/faraday_middleware-aws-sigv4/badge.svg?branch=master)](https://coveralls.io/github/winebarrel/faraday_middleware-aws-sigv4?branch=master)
8
8
 
9
+ * `faraday_middleware-aws-sigv4 < 0.3.0`
10
+ * `faraday < 0.15`
11
+ * `faraday_middleware-aws-sigv4 >= 0.3.0`
12
+ * `ruby >= 2.3`
13
+ * `faraday >= 0.15`
14
+
9
15
  ## Installation
10
16
 
11
17
  Add this line to your application's Gemfile:
@@ -25,7 +31,8 @@ Or install it yourself as:
25
31
  ## Usage
26
32
 
27
33
  ```ruby
28
- # `gem install faraday_middleware` is required.
34
+ # `gem install faraday_middleware` is required for this example.
35
+ # However, FaradayMiddleware::AwsSigV4 works without faraday_middleware.
29
36
  require 'faraday_middleware'
30
37
  require 'faraday_middleware/aws_sigv4'
31
38
  require 'pp'
@@ -38,7 +45,10 @@ conn = Faraday.new(url: 'https://apigateway.us-east-1.amazonaws.com') do |farada
38
45
  secret_access_key: ENV['AWS_SECRET_ACCESS_KEY']
39
46
  # see http://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/Sigv4/Signer.html
40
47
 
41
- faraday.response :json, :content_type => /\bjson\b/
48
+ # NOTE: The following middleware is from `faraday_middleware`
49
+ # cf. https://github.com/lostisland/faraday_middleware/blob/master/lib/faraday_middleware.rb
50
+ # **It is not an essential middleware to work.**
51
+ faraday.response :json, content_type: /\bjson\b/
42
52
  faraday.response :raise_error
43
53
 
44
54
  faraday.adapter Faraday.default_adapter
@@ -58,7 +68,18 @@ pp res.body
58
68
  # "throttleSettings"=>{"rateLimit"=>10000.0, "burstLimit"=>5000}}
59
69
  ```
60
70
 
71
+ ## Upgrading from `faraday_middleware-aws-signers-v4`
72
+
73
+ If you previously provided the `service_name` option, you need to rename it `service`
74
+
75
+ ## Test
76
+
77
+ ```sh
78
+ bundle install
79
+ bundle exec appraisal install
80
+ bundle exec appraisal faraday-0.16 rake
81
+ ```
82
+
61
83
  ## Related Links
62
84
 
63
85
  * http://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/Sigv4/Signer.html
64
- * https://github.com/winebarrel/faraday_middleware-aws-signers-v4 (aws-sdk-v2 version)
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'faraday_middleware-aws-sigv4'
7
- spec.version = '0.2.2'
7
+ spec.version = '0.4.0'
8
8
  spec.authors = ['Genki Sugawara']
9
9
  spec.email = ['sugawara@cookpad.com']
10
10
 
@@ -20,7 +20,9 @@ Gem::Specification.new do |spec|
20
20
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
21
  spec.require_paths = ['lib']
22
22
 
23
- spec.add_dependency 'faraday', '~> 0.13'
23
+ spec.required_ruby_version = '>= 2.3'
24
+
25
+ spec.add_dependency 'faraday', '>= 0.15'
24
26
  spec.add_dependency 'aws-sigv4', '~> 1.0'
25
27
 
26
28
  spec.add_development_dependency 'faraday_middleware'
@@ -28,6 +30,8 @@ Gem::Specification.new do |spec|
28
30
  spec.add_development_dependency 'rake'
29
31
  spec.add_development_dependency 'rspec', '~> 3.0'
30
32
  spec.add_development_dependency 'timecop'
31
- spec.add_development_dependency 'coveralls'
32
- spec.add_development_dependency 'aws-sdk-core', '~> 3.0'
33
+ spec.add_development_dependency 'aws-sdk-core', '~> 3.14.0'
34
+ spec.add_development_dependency 'appraisal', '>= 2.2'
35
+ spec.add_development_dependency 'simplecov'
36
+ spec.add_development_dependency 'simplecov-lcov'
33
37
  end
@@ -0,0 +1,2 @@
1
+ ---
2
+ BUNDLE_RETRY: "1"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "faraday", "~> 0.15.0"
6
+
7
+ gemspec path: "../"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "faraday", "~> 0.16.0"
6
+
7
+ gemspec path: "../"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "faraday", "~> 0.17.0"
6
+
7
+ gemspec path: "../"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "faraday", "~> 1.0.0"
6
+
7
+ gemspec path: "../"
@@ -18,14 +18,12 @@ class FaradayMiddleware::AwsSigV4 < Faraday::Middleware
18
18
  private
19
19
 
20
20
  def sign!(env)
21
- if net_http_adapter?
22
- normalize_for_net_http!(env)
23
- end
24
-
25
21
  request = build_aws_sigv4_request(env)
26
22
  signature = @signer.sign_request(request)
27
23
 
28
- env.request_headers.update(signature.headers)
24
+ signature.headers.each do |name, value|
25
+ env.request_headers[name] = value
26
+ end
29
27
  end
30
28
 
31
29
  def build_aws_sigv4_request(env)
@@ -36,8 +34,4 @@ class FaradayMiddleware::AwsSigV4 < Faraday::Middleware
36
34
  body: env.body,
37
35
  }
38
36
  end
39
-
40
- def net_http_adapter?
41
- @app.is_a?(Faraday::Adapter::NetHttp)
42
- end
43
37
  end
@@ -1,13 +1,4 @@
1
1
  module FaradayMiddleware::AwsSigV4Util
2
- def normalize_for_net_http!(env)
3
- if Net::HTTP::HAVE_ZLIB
4
- env.request_headers['Accept-Encoding'] ||= 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3'
5
- end
6
-
7
- env.request_headers['Accept'] ||= '*/*'
8
- env
9
- end
10
-
11
2
  def seahorse_encode_query(url)
12
3
  return url unless url.query
13
4
 
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faraday_middleware-aws-sigv4
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Sugawara
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-09-12 00:00:00.000000000 Z
11
+ date: 2020-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0.13'
19
+ version: '0.15'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '0.13'
26
+ version: '0.15'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: aws-sigv4
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -109,7 +109,35 @@ dependencies:
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
- name: coveralls
112
+ name: aws-sdk-core
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 3.14.0
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 3.14.0
125
+ - !ruby/object:Gem::Dependency
126
+ name: appraisal
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '2.2'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '2.2'
139
+ - !ruby/object:Gem::Dependency
140
+ name: simplecov
113
141
  requirement: !ruby/object:Gem::Requirement
114
142
  requirements:
115
143
  - - ">="
@@ -123,19 +151,19 @@ dependencies:
123
151
  - !ruby/object:Gem::Version
124
152
  version: '0'
125
153
  - !ruby/object:Gem::Dependency
126
- name: aws-sdk-core
154
+ name: simplecov-lcov
127
155
  requirement: !ruby/object:Gem::Requirement
128
156
  requirements:
129
- - - "~>"
157
+ - - ">="
130
158
  - !ruby/object:Gem::Version
131
- version: '3.0'
159
+ version: '0'
132
160
  type: :development
133
161
  prerelease: false
134
162
  version_requirements: !ruby/object:Gem::Requirement
135
163
  requirements:
136
- - - "~>"
164
+ - - ">="
137
165
  - !ruby/object:Gem::Version
138
- version: '3.0'
166
+ version: '0'
139
167
  description: Faraday middleware for AWS Signature Version 4 using aws-sigv4.
140
168
  email:
141
169
  - sugawara@cookpad.com
@@ -143,9 +171,11 @@ executables: []
143
171
  extensions: []
144
172
  extra_rdoc_files: []
145
173
  files:
174
+ - ".github/workflows/test.yml"
146
175
  - ".gitignore"
147
176
  - ".rspec"
148
- - ".travis.yml"
177
+ - ".simplecov"
178
+ - Appraisals
149
179
  - Gemfile
150
180
  - LICENSE.txt
151
181
  - README.md
@@ -153,6 +183,11 @@ files:
153
183
  - bin/console
154
184
  - bin/setup
155
185
  - faraday_middleware-aws-sigv4.gemspec
186
+ - gemfiles/.bundle/config
187
+ - gemfiles/faraday_0.15.gemfile
188
+ - gemfiles/faraday_0.16.gemfile
189
+ - gemfiles/faraday_0.17.gemfile
190
+ - gemfiles/faraday_1.0.gemfile
156
191
  - lib/faraday_middleware/aws_sigv4.rb
157
192
  - lib/faraday_middleware/request/aws_sigv4.rb
158
193
  - lib/faraday_middleware/request/aws_sigv4_util.rb
@@ -168,15 +203,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
168
203
  requirements:
169
204
  - - ">="
170
205
  - !ruby/object:Gem::Version
171
- version: '0'
206
+ version: '2.3'
172
207
  required_rubygems_version: !ruby/object:Gem::Requirement
173
208
  requirements:
174
209
  - - ">="
175
210
  - !ruby/object:Gem::Version
176
211
  version: '0'
177
212
  requirements: []
178
- rubyforge_project:
179
- rubygems_version: 2.5.2
213
+ rubygems_version: 3.1.2
180
214
  signing_key:
181
215
  specification_version: 4
182
216
  summary: Faraday middleware for AWS Signature Version 4 using aws-sigv4.
@@ -1,8 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- cache: bundler
4
- rvm:
5
- - 2.2.6
6
- - 2.3.4
7
- - 2.4.1
8
- before_install: gem install bundler -v 1.14.3