stitches 3.1.0 → 3.2.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
2
  SHA1:
3
- metadata.gz: 0e738a0238c3e9c1fa75e0ce2e2a68cebee5da4c
4
- data.tar.gz: cf38c953435d6038a35be3352921f3d26a52746f
3
+ metadata.gz: 24af3456bfbce2bea0930b87b486a22d5ff0018c
4
+ data.tar.gz: d5069bfe4189e10b001b281e551dfa7ec68b9f17
5
5
  SHA512:
6
- metadata.gz: 92b1ef8e3e29103b8d064b5b67d298c4caf785778762caa88c4834671c84b01525697a9f34fc0409d682580d5d1b667965141d7e4f7bca6b4e2b76d71a265ee0
7
- data.tar.gz: ad71cc03cae3b594f8a63a96a21d5162cafa69e787cdce9cabb1013613dda15bab1b65d81c49b8b04d998a4713d067671c7fffceca222f40d2f5986800258f32
6
+ metadata.gz: 0aba572158c721799fe513f012b1e83d23bee5969025510096e678135bc5e7462ae73acd668e8f9e41420a19cc9a1e9fcc8667ae5088039a8be5292b5950f361
7
+ data.tar.gz: c375dd0a56a17eb67f0c4efd26866ced81d7bcab37b5643b44b018a97e5e25eb0760616cb9a5a627dd446b4446119989dadade686287f54721e7ffce36014659
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.1.0
1
+ 2.1.5
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- stitches (3.1.0)
4
+ stitches (3.2.0)
5
5
  apitome
6
6
  pg
7
7
  rails
@@ -50,11 +50,11 @@ GEM
50
50
  kramdown
51
51
  railties
52
52
  rspec_api_documentation
53
- arel (6.0.0)
53
+ arel (6.0.3)
54
54
  builder (3.2.2)
55
55
  diff-lcs (1.2.5)
56
56
  erubis (2.7.0)
57
- globalid (0.3.5)
57
+ globalid (0.3.6)
58
58
  activesupport (>= 4.1.0)
59
59
  i18n (0.7.0)
60
60
  json (1.8.3)
@@ -65,7 +65,7 @@ GEM
65
65
  mime-types (>= 1.16, < 3)
66
66
  mime-types (2.6.1)
67
67
  mini_portile (0.6.2)
68
- minitest (5.7.0)
68
+ minitest (5.8.0)
69
69
  mustache (0.99.8)
70
70
  nokogiri (1.6.6.2)
71
71
  mini_portile (~> 0.6.0)
@@ -102,15 +102,15 @@ GEM
102
102
  rspec-core (~> 3.3.0)
103
103
  rspec-expectations (~> 3.3.0)
104
104
  rspec-mocks (~> 3.3.0)
105
- rspec-core (3.3.1)
105
+ rspec-core (3.3.2)
106
106
  rspec-support (~> 3.3.0)
107
- rspec-expectations (3.3.0)
107
+ rspec-expectations (3.3.1)
108
108
  diff-lcs (>= 1.2.0, < 2.0)
109
109
  rspec-support (~> 3.3.0)
110
- rspec-mocks (3.3.1)
110
+ rspec-mocks (3.3.2)
111
111
  diff-lcs (>= 1.2.0, < 2.0)
112
112
  rspec-support (~> 3.3.0)
113
- rspec-rails (3.3.2)
113
+ rspec-rails (3.3.3)
114
114
  actionpack (>= 3.0, < 4.3)
115
115
  activesupport (>= 3.0, < 4.3)
116
116
  railties (>= 3.0, < 4.3)
@@ -124,7 +124,7 @@ GEM
124
124
  json (~> 1.4, >= 1.4.6)
125
125
  mustache (~> 0.99, >= 0.99.4)
126
126
  rspec (>= 3.0.0)
127
- sprockets (3.2.0)
127
+ sprockets (3.3.0)
128
128
  rack (~> 1.0)
129
129
  sprockets-rails (2.3.2)
130
130
  actionpack (>= 3.0)
@@ -141,3 +141,6 @@ PLATFORMS
141
141
  DEPENDENCIES
142
142
  rake
143
143
  stitches!
144
+
145
+ BUNDLED WITH
146
+ 1.10.6
@@ -35,6 +35,7 @@ module Stitches
35
35
  client = ::ApiClient.where(key: key).first
36
36
  if client.present?
37
37
  env[@configuration.env_var_to_hold_api_client_primary_key] = client.id
38
+ env[@configuration.env_var_to_hold_api_client] = client
38
39
  @app.call(env)
39
40
  else
40
41
  UnauthorizedResponse.new("key invalid",@realm,@configuration.custom_http_auth_scheme)
@@ -56,4 +57,4 @@ module Stitches
56
57
  end
57
58
 
58
59
  end
59
- end
60
+ end
@@ -12,6 +12,7 @@ class Stitches::Configuration
12
12
  @whitelist_regexp = nil
13
13
  @custom_http_auth_scheme = UnsetString.new("custom_http_auth_scheme")
14
14
  @env_var_to_hold_api_client_primary_key = NonNullString.new("env_var_to_hold_api_client_primary_key","STITCHES_API_CLIENT_ID")
15
+ @env_var_to_hold_api_client= NonNullString.new("env_var_to_hold_api_client","STITCHES_API_CLIENT")
15
16
  end
16
17
 
17
18
  # A RegExp that whitelists URLS around the mime type and api key requirements.
@@ -45,6 +46,14 @@ class Stitches::Configuration
45
46
  @env_var_to_hold_api_client_primary_key = NonNullString.new("env_var_to_hold_api_client_primary_key",new_env_var_to_hold_api_client_primary_key)
46
47
  end
47
48
 
49
+ def env_var_to_hold_api_client
50
+ @env_var_to_hold_api_client.to_s
51
+ end
52
+
53
+ def env_var_to_hold_api_client=(new_env_var_to_hold_api_client)
54
+ @env_var_to_hold_api_client= NonNullString.new("env_var_to_hold_api_client",new_env_var_to_hold_api_client)
55
+ end
56
+
48
57
  private
49
58
 
50
59
  class NonNullString
@@ -13,7 +13,9 @@ class Api::ApiController < ActionController::Base
13
13
  protected
14
14
 
15
15
  def api_client
16
- @api_client ||= ::ApiClient.find(request.env[Stitches.configuration.env_var_to_hold_api_client_primary_key])
16
+ @api_client ||= request.env[Stitches.configuration.env_var_to_hold_api_client]
17
+ # Use this if you want to look up the ApiClient instead of using the one placed into the env
18
+ # @api_client ||= ApiClient.find(request.env[Stitches.configuration.env_var_to_hold_api_client_primary_key])
17
19
  end
18
20
 
19
21
  end
@@ -43,7 +43,7 @@ private
43
43
  if api_client_key.kind_of?(Array)
44
44
  headers["Authorization"] = api_client_key.join(" ")
45
45
  else
46
- headers["Authorization"] = "CustomKeyAuth key=#{api_client_key}"
46
+ headers["Authorization"] = "#{Stitches.configuration.custom_http_auth_scheme} key=#{api_client_key}"
47
47
  end
48
48
  end
49
49
  end
@@ -1,3 +1,3 @@
1
1
  module Stitches
2
- VERSION = '3.1.0'
3
- end
2
+ VERSION = '3.2.0'
3
+ end
data/spec/api_key_spec.rb CHANGED
@@ -154,6 +154,10 @@ describe Stitches::ApiKey do
154
154
  it "sets the api_client's ID in the environment" do
155
155
  expect(env[Stitches.configuration.env_var_to_hold_api_client_primary_key]).to eq(api_clients.first.id)
156
156
  end
157
+
158
+ it "sets the api_client itself in the environment" do
159
+ expect(env[Stitches.configuration.env_var_to_hold_api_client]).to eq(api_clients.first)
160
+ end
157
161
  end
158
162
 
159
163
  context "unauthorized responses" do
data/stitches.gemspec CHANGED
@@ -6,8 +6,8 @@ Gem::Specification.new do |s|
6
6
  s.name = "stitches"
7
7
  s.version = Stitches::VERSION
8
8
  s.platform = Gem::Platform::RUBY
9
- s.authors = ['Dave Copeland']
10
- s.email = ['dave@stitchfix.com', 'opensource@stitchfix.com']
9
+ s.authors = ["Stitch Fix Engineering","Andrew Peterson","Dave Copeland","Jonathan Dean"]
10
+ s.email = ["opensource@stitchfix.com","andy@ndpsoftware.com","davetron5000@gmail.com","jon@jonathandean.com"]
11
11
  s.homepage = "https://github.com/stitchfix/stitches"
12
12
  s.summary = "You'll be in stitches at how easy it is to create a service at Stitch Fix"
13
13
  s.description = "You'll be in stitches at how easy it is to create a service at Stitch Fix"
metadata CHANGED
@@ -1,14 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stitches
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 3.2.0
5
5
  platform: ruby
6
6
  authors:
7
+ - Stitch Fix Engineering
8
+ - Andrew Peterson
7
9
  - Dave Copeland
10
+ - Jonathan Dean
8
11
  autorequire:
9
12
  bindir: bin
10
13
  cert_chain: []
11
- date: 2015-07-13 00:00:00.000000000 Z
14
+ date: 2015-08-13 00:00:00.000000000 Z
12
15
  dependencies:
13
16
  - !ruby/object:Gem::Dependency
14
17
  name: rails
@@ -97,8 +100,10 @@ dependencies:
97
100
  description: You'll be in stitches at how easy it is to create a service at Stitch
98
101
  Fix
99
102
  email:
100
- - dave@stitchfix.com
101
103
  - opensource@stitchfix.com
104
+ - andy@ndpsoftware.com
105
+ - davetron5000@gmail.com
106
+ - jon@jonathandean.com
102
107
  executables: []
103
108
  extensions: []
104
109
  extra_rdoc_files: []
@@ -170,7 +175,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
170
175
  version: '0'
171
176
  requirements: []
172
177
  rubyforge_project:
173
- rubygems_version: 2.2.0
178
+ rubygems_version: 2.4.3
174
179
  signing_key:
175
180
  specification_version: 4
176
181
  summary: You'll be in stitches at how easy it is to create a service at Stitch Fix