stitches 3.8.1 → 3.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ac1389298b9ccff356bb73c3e925501265eddb4d68932ac7bc6e41ab35535353
4
- data.tar.gz: c800e4a091a67181e065cb0d42c45a7a730b710ce4a83fb513b6606ea7e6e47d
3
+ metadata.gz: ad83ebbf3aed8767a280f814d64be8819dd200586bd737de0cdb402516539476
4
+ data.tar.gz: fba83f42359be56a03517351dab3bb877bf9fc50d7acfb6de6c48117544472e3
5
5
  SHA512:
6
- metadata.gz: 439faf8691f51448dad6b45b35c77a63e5b31075181a55e6fe03ec1381bfe91841cc2a73172390d6e32b5f1f38f7fd3ea069b15c98d8086f4fd21b1c0842b241
7
- data.tar.gz: 8c435dc519da97c5cc3aec267dffcb0ffb96e2479b98c14ac44217b5dd4de50afdd818c18063f7d126e7cb56a97f197bd592235591fe9e982243f12314b633d0
6
+ metadata.gz: 5288beef3b5831fbade2a210b5b18c404ceae447833e35303c4cdc041888c0fbd8a71e2d343b10387316c5bfa2b13d04a3727c5b83fcf3114cf7b2c26a7a043b
7
+ data.tar.gz: 0fc6d6ba8044ba4df0fcd57826c6028926158a0201b96c27122e66d73070288a148bfee47d8352345f4e7840dd85531182ced2f933c39f1b10dc398e3c83d70d
@@ -5,7 +5,7 @@ version: 2
5
5
  jobs:
6
6
  release:
7
7
  docker:
8
- - image: circleci/ruby:2.6.4
8
+ - image: circleci/ruby:2.7.0
9
9
  steps:
10
10
  - checkout
11
11
  - run: bundle config stitchfix01.jfrog.io $ARTIFACTORY_USER:$ARTIFACTORY_TOKEN
@@ -17,9 +17,9 @@ jobs:
17
17
  - run:
18
18
  name: Build/release gem to artifactory
19
19
  command: bundle exec rake push_artifactory
20
- ruby-2.6.4-rails-6.0:
20
+ ruby-2.7.0-rails-6.0:
21
21
  docker:
22
- - image: circleci/ruby:2.6.4
22
+ - image: circleci/ruby:2.7.0
23
23
  environment:
24
24
  BUNDLE_GEMFILE: Gemfile.rails-6.0
25
25
  working_directory: "~/stitches"
@@ -35,13 +35,13 @@ jobs:
35
35
  fi
36
36
  - run:
37
37
  name: Notify Pager Duty
38
- command: bundle exec y-notify "#eng-platform-alerts"
38
+ command: bundle exec y-notify "#devex-alerts"
39
39
  when: on_fail
40
40
  - store_test_results:
41
41
  path: "/tmp/test-results"
42
- ruby-2.5.6-rails-6.0:
42
+ ruby-2.6.5-rails-6.0:
43
43
  docker:
44
- - image: circleci/ruby:2.5.6
44
+ - image: circleci/ruby:2.6.5
45
45
  environment:
46
46
  BUNDLE_GEMFILE: Gemfile.rails-6.0
47
47
  working_directory: "~/stitches"
@@ -57,13 +57,13 @@ jobs:
57
57
  fi
58
58
  - run:
59
59
  name: Notify Pager Duty
60
- command: bundle exec y-notify "#eng-platform-alerts"
60
+ command: bundle exec y-notify "#devex-alerts"
61
61
  when: on_fail
62
62
  - store_test_results:
63
63
  path: "/tmp/test-results"
64
- ruby-2.6.4-rails-5.2:
64
+ ruby-2.7.0-rails-5.2:
65
65
  docker:
66
- - image: circleci/ruby:2.6.4
66
+ - image: circleci/ruby:2.7.0
67
67
  environment:
68
68
  BUNDLE_GEMFILE: Gemfile.rails-5.2
69
69
  working_directory: "~/stitches"
@@ -79,13 +79,13 @@ jobs:
79
79
  fi
80
80
  - run:
81
81
  name: Notify Pager Duty
82
- command: bundle exec y-notify "#eng-platform-alerts"
82
+ command: bundle exec y-notify "#devex-alerts"
83
83
  when: on_fail
84
84
  - store_test_results:
85
85
  path: "/tmp/test-results"
86
- ruby-2.5.6-rails-5.2:
86
+ ruby-2.6.5-rails-5.2:
87
87
  docker:
88
- - image: circleci/ruby:2.5.6
88
+ - image: circleci/ruby:2.6.5
89
89
  environment:
90
90
  BUNDLE_GEMFILE: Gemfile.rails-5.2
91
91
  working_directory: "~/stitches"
@@ -101,7 +101,7 @@ jobs:
101
101
  fi
102
102
  - run:
103
103
  name: Notify Pager Duty
104
- command: bundle exec y-notify "#eng-platform-alerts"
104
+ command: bundle exec y-notify "#devex-alerts"
105
105
  when: on_fail
106
106
  - store_test_results:
107
107
  path: "/tmp/test-results"
@@ -112,31 +112,31 @@ workflows:
112
112
  - release:
113
113
  context: org-global
114
114
  requires:
115
- - ruby-2.6.4-rails-6.0
116
- - ruby-2.5.6-rails-6.0
117
- - ruby-2.6.4-rails-5.2
118
- - ruby-2.5.6-rails-5.2
115
+ - ruby-2.7.0-rails-6.0
116
+ - ruby-2.6.5-rails-6.0
117
+ - ruby-2.7.0-rails-5.2
118
+ - ruby-2.6.5-rails-5.2
119
119
  filters:
120
120
  tags:
121
121
  only: /^[0-9]+\.[0-9]+\.[0-9]+(\.?RC[-\.]?\d*)?$/
122
122
  branches:
123
123
  ignore: /.*/
124
- - ruby-2.6.4-rails-6.0:
124
+ - ruby-2.7.0-rails-6.0:
125
125
  context: org-global
126
126
  filters:
127
127
  tags:
128
128
  only: &1 /.*/
129
- - ruby-2.5.6-rails-6.0:
129
+ - ruby-2.6.5-rails-6.0:
130
130
  context: org-global
131
131
  filters:
132
132
  tags:
133
133
  only: *1
134
- - ruby-2.6.4-rails-5.2:
134
+ - ruby-2.7.0-rails-5.2:
135
135
  context: org-global
136
136
  filters:
137
137
  tags:
138
138
  only: *1
139
- - ruby-2.5.6-rails-5.2:
139
+ - ruby-2.6.5-rails-5.2:
140
140
  context: org-global
141
141
  filters:
142
142
  tags:
@@ -150,11 +150,11 @@ workflows:
150
150
  only:
151
151
  - master
152
152
  jobs:
153
- - ruby-2.6.4-rails-6.0:
153
+ - ruby-2.7.0-rails-6.0:
154
154
  context: org-global
155
- - ruby-2.5.6-rails-6.0:
155
+ - ruby-2.6.5-rails-6.0:
156
156
  context: org-global
157
- - ruby-2.6.4-rails-5.2:
157
+ - ruby-2.7.0-rails-5.2:
158
158
  context: org-global
159
- - ruby-2.5.6-rails-5.2:
159
+ - ruby-2.6.5-rails-5.2:
160
160
  context: org-global
@@ -8,4 +8,4 @@
8
8
  # This file uses the GitHub CODEOWNERS convention to assign PR reviewers:
9
9
  # https://help.github.com/articles/about-codeowners/
10
10
 
11
- * @brettfishman @bwebster
11
+ * @brettfishman @bwebster @stitchfix/devex
@@ -1 +1 @@
1
- 2.6.3
1
+ 2.7.0
@@ -1,7 +1,10 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.4.4
4
- - 2.5.1
3
+ - 2.6
4
+ - 2.7
5
5
  - ruby-head
6
6
  notifications:
7
7
  email: false
8
+ jobs:
9
+ allow_failures:
10
+ - rvm: ruby-head
@@ -20,11 +20,6 @@ module Stitches
20
20
  # ApiClient that it maps to.
21
21
  class ApiKey < Stitches::AllowlistMiddleware
22
22
 
23
- def initialize(app,options = {})
24
- super(app,options)
25
- @realm = rails_app_module
26
- end
27
-
28
23
  protected
29
24
 
30
25
  def do_call(env)
@@ -45,13 +40,13 @@ module Stitches
45
40
  env[@configuration.env_var_to_hold_api_client] = client
46
41
  @app.call(env)
47
42
  else
48
- UnauthorizedResponse.new("key invalid",@realm,@configuration.custom_http_auth_scheme)
43
+ unauthorized_response("key invalid")
49
44
  end
50
45
  else
51
- UnauthorizedResponse.new("bad authorization type",@realm,@configuration.custom_http_auth_scheme)
46
+ unauthorized_response("bad authorization type")
52
47
  end
53
48
  else
54
- UnauthorizedResponse.new("no authorization header",@realm,@configuration.custom_http_auth_scheme)
49
+ unauthorized_response("no authorization header")
55
50
  end
56
51
  end
57
52
 
@@ -68,10 +63,11 @@ module Stitches
68
63
  parent.to_s
69
64
  end
70
65
 
71
- class UnauthorizedResponse < Rack::Response
72
- def initialize(reason,realm,custom_http_auth_scheme)
73
- super("Unauthorized - #{reason}", 401, { "WWW-Authenticate" => "#{custom_http_auth_scheme} realm=#{realm}" })
74
- end
66
+ def unauthorized_response(reason)
67
+ status = 401
68
+ body = "Unauthorized - #{reason}"
69
+ header = { "WWW-Authenticate" => "#{@configuration.custom_http_auth_scheme} realm=#{rails_app_module}" }
70
+ Rack::Response.new(body, status, header).finish
75
71
  end
76
72
 
77
73
  end
@@ -16,16 +16,17 @@ module Stitches
16
16
  if accept =~ %r{application/json} && accept =~ %r{version=\d+}
17
17
  @app.call(env)
18
18
  else
19
- NotAcceptableResponse.new(accept)
19
+ not_acceptable_response(accept)
20
20
  end
21
21
  end
22
22
 
23
23
  private
24
24
 
25
- class NotAcceptableResponse < Rack::Response
26
- def initialize(accept_header)
27
- super("Not Acceptable - '#{accept_header}' didn't have the right mime type or version number. We only accept application/json with a version", 406)
28
- end
25
+ def not_acceptable_response(accept_header)
26
+ status = 406
27
+ body = "Not Acceptable - '#{accept_header}' didn't have the right mime type or version number. We only accept application/json with a version"
28
+ header = { "WWW-Authenticate" => accept_header }
29
+ Rack::Response.new(body, status, header).finish
29
30
  end
30
31
 
31
32
  end
@@ -1,3 +1,3 @@
1
1
  module Stitches
2
- VERSION = '3.8.1'
2
+ VERSION = "3.8.2"
3
3
  end
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "owners": [
3
3
  {
4
- "team": "platform"
4
+ "team": "devex"
5
5
  }
6
6
  ]
7
7
  }
@@ -34,16 +34,19 @@ describe Stitches::ApiKey do
34
34
 
35
35
  shared_examples "an unauthorized response" do
36
36
  it "returns a 401" do
37
- expect(@response.status).to eq(401)
37
+ status, _headers, _body = @response
38
+ expect(status).to eq(401)
38
39
  end
39
40
  it "sets the proper header" do
40
- expect(@response.headers["WWW-Authenticate"]).to eq("MyAwesomeInternalScheme realm=MyApp")
41
+ _status, headers, _body = @response
42
+ expect(headers["WWW-Authenticate"]).to eq("MyAwesomeInternalScheme realm=MyApp")
41
43
  end
42
44
  it "stops the call chain preventing anything from happening" do
43
45
  expect(app).not_to have_received(:call)
44
46
  end
45
47
  it "sends a reasonable message" do
46
- expect(@response.body).to eq([expected_body])
48
+ _status, _headers, body = @response
49
+ expect(body).to eq([expected_body])
47
50
  end
48
51
  end
49
52
 
@@ -166,7 +169,6 @@ describe Stitches::ApiKey do
166
169
  context "unauthorized responses" do
167
170
  before do
168
171
  @response = middleware.call(env)
169
- @response.finish
170
172
  end
171
173
  context "invalid key" do
172
174
  let(:env) {
@@ -11,13 +11,15 @@ describe Stitches::ValidMimeType do
11
11
 
12
12
  shared_examples "an unacceptable response" do
13
13
  it "returns a 406" do
14
- expect(@response.status).to eq(406)
14
+ status, _headers, _body = @response
15
+ expect(status).to eq(406)
15
16
  end
16
17
  it "stops the call chain preventing anything from happening" do
17
18
  expect(app).not_to have_received(:call)
18
19
  end
19
20
  it "sends a reasonable message" do
20
- expect(@response.body.first).to match(/didn't have the right mime type or version number. We only accept application\/json/)
21
+ _status, _headers, body = @response
22
+ expect(body.first).to match(/didn't have the right mime type or version number. We only accept application\/json/)
21
23
  end
22
24
  end
23
25
 
@@ -133,7 +135,6 @@ describe Stitches::ValidMimeType do
133
135
  context "unacceptable responses" do
134
136
  before do
135
137
  @response = middleware.call(env)
136
- @response.finish
137
138
  end
138
139
  context "no header" do
139
140
  let(:env) {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stitches
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.8.1
4
+ version: 3.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stitch Fix Engineering
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2019-09-10 00:00:00.000000000 Z
14
+ date: 2020-01-17 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rails
@@ -95,11 +95,12 @@ extensions: []
95
95
  extra_rdoc_files: []
96
96
  files:
97
97
  - ".circleci/config.yml"
98
+ - ".github/CODEOWNERS"
99
+ - ".github/PULL_REQUEST_TEMPLATE.md"
98
100
  - ".gitignore"
99
101
  - ".ruby-gemset"
100
102
  - ".ruby-version"
101
103
  - ".travis.yml"
102
- - CODEOWNERS
103
104
  - CODE_OF_CONDUCT.md
104
105
  - CONTRIBUTING.md
105
106
  - Gemfile
@@ -109,7 +110,6 @@ files:
109
110
  - Gemfile.rails-5.2
110
111
  - Gemfile.rails-6.0
111
112
  - LICENSE.txt
112
- - PULL_REQUEST_TEMPLATE.md
113
113
  - README.md
114
114
  - Rakefile
115
115
  - build-matrix.json