stitches 3.2.3 → 3.3.0
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 +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +3 -5
- data/Gemfile.lock +95 -87
- data/README.md +14 -0
- data/lib/stitches/add_enabled_to_api_clients_generator.rb +19 -0
- data/lib/stitches/api_key.rb +8 -1
- data/lib/stitches/generator_files/db/migrate/add_enabled_to_api_clients.rb +7 -0
- data/lib/stitches/generator_files/db/migrate/create_api_clients.rb +2 -1
- data/lib/stitches/version.rb +1 -1
- data/lib/stitches_norailtie.rb +1 -0
- data/spec/api_key_spec.rb +4 -1
- metadata +5 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9e87e719f34bc52ddf14d46560ca160b073648c8
|
|
4
|
+
data.tar.gz: 5919ab13f6949c37fb1be76f93883176d5a49a49
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 123e883d8a697b656ce8c75c6a1b7fd270bfc7eba4df3b091fe12cfa17dda35f32c15b15e09a981d17bdc1564b19a265f3f01d746825b9bac80f56ba27dd54a4
|
|
7
|
+
data.tar.gz: 8ed0e45e556b957750cf7c6eb3cb93a608909576a22e52fcd1f440be5ebeea5d19017cc40696ff9fdc3dc20067f01f4b5f8b9a23e1155df6f00ec669e4759267
|
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.3.
|
|
1
|
+
2.3.1
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
stitches (3.
|
|
4
|
+
stitches (3.3.0)
|
|
5
5
|
apitome
|
|
6
6
|
pg
|
|
7
7
|
rails
|
|
@@ -11,124 +11,129 @@ PATH
|
|
|
11
11
|
GEM
|
|
12
12
|
remote: https://www.rubygems.org/
|
|
13
13
|
specs:
|
|
14
|
-
|
|
15
|
-
actionpack (=
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
actioncable (5.0.0.1)
|
|
15
|
+
actionpack (= 5.0.0.1)
|
|
16
|
+
nio4r (~> 1.2)
|
|
17
|
+
websocket-driver (~> 0.6.1)
|
|
18
|
+
actionmailer (5.0.0.1)
|
|
19
|
+
actionpack (= 5.0.0.1)
|
|
20
|
+
actionview (= 5.0.0.1)
|
|
21
|
+
activejob (= 5.0.0.1)
|
|
18
22
|
mail (~> 2.5, >= 2.5.4)
|
|
19
|
-
rails-dom-testing (~>
|
|
20
|
-
actionpack (
|
|
21
|
-
actionview (=
|
|
22
|
-
activesupport (=
|
|
23
|
-
rack (~>
|
|
24
|
-
rack-test (~> 0.6.
|
|
25
|
-
rails-dom-testing (~>
|
|
23
|
+
rails-dom-testing (~> 2.0)
|
|
24
|
+
actionpack (5.0.0.1)
|
|
25
|
+
actionview (= 5.0.0.1)
|
|
26
|
+
activesupport (= 5.0.0.1)
|
|
27
|
+
rack (~> 2.0)
|
|
28
|
+
rack-test (~> 0.6.3)
|
|
29
|
+
rails-dom-testing (~> 2.0)
|
|
26
30
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
|
27
|
-
actionview (
|
|
28
|
-
activesupport (=
|
|
31
|
+
actionview (5.0.0.1)
|
|
32
|
+
activesupport (= 5.0.0.1)
|
|
29
33
|
builder (~> 3.1)
|
|
30
34
|
erubis (~> 2.7.0)
|
|
31
|
-
rails-dom-testing (~>
|
|
35
|
+
rails-dom-testing (~> 2.0)
|
|
32
36
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
|
33
|
-
activejob (
|
|
34
|
-
activesupport (=
|
|
35
|
-
globalid (>= 0.3.
|
|
36
|
-
activemodel (
|
|
37
|
-
activesupport (=
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
37
|
+
activejob (5.0.0.1)
|
|
38
|
+
activesupport (= 5.0.0.1)
|
|
39
|
+
globalid (>= 0.3.6)
|
|
40
|
+
activemodel (5.0.0.1)
|
|
41
|
+
activesupport (= 5.0.0.1)
|
|
42
|
+
activerecord (5.0.0.1)
|
|
43
|
+
activemodel (= 5.0.0.1)
|
|
44
|
+
activesupport (= 5.0.0.1)
|
|
45
|
+
arel (~> 7.0)
|
|
46
|
+
activesupport (5.0.0.1)
|
|
47
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
44
48
|
i18n (~> 0.7)
|
|
45
|
-
json (~> 1.7, >= 1.7.7)
|
|
46
49
|
minitest (~> 5.1)
|
|
47
|
-
thread_safe (~> 0.3, >= 0.3.4)
|
|
48
50
|
tzinfo (~> 1.1)
|
|
49
51
|
apitome (0.1.0)
|
|
50
52
|
kramdown
|
|
51
53
|
railties
|
|
52
54
|
rspec_api_documentation
|
|
53
|
-
arel (
|
|
55
|
+
arel (7.1.1)
|
|
54
56
|
builder (3.2.2)
|
|
55
|
-
concurrent-ruby (1.0.
|
|
57
|
+
concurrent-ruby (1.0.2)
|
|
56
58
|
diff-lcs (1.2.5)
|
|
57
59
|
erubis (2.7.0)
|
|
58
|
-
globalid (0.3.
|
|
60
|
+
globalid (0.3.7)
|
|
59
61
|
activesupport (>= 4.1.0)
|
|
60
62
|
i18n (0.7.0)
|
|
61
|
-
|
|
62
|
-
kramdown (1.10.0)
|
|
63
|
+
kramdown (1.12.0)
|
|
63
64
|
loofah (2.0.3)
|
|
64
65
|
nokogiri (>= 1.5.9)
|
|
65
|
-
mail (2.6.
|
|
66
|
-
mime-types (>= 1.16, <
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
66
|
+
mail (2.6.4)
|
|
67
|
+
mime-types (>= 1.16, < 4)
|
|
68
|
+
method_source (0.8.2)
|
|
69
|
+
mime-types (3.1)
|
|
70
|
+
mime-types-data (~> 3.2015)
|
|
71
|
+
mime-types-data (3.2016.0521)
|
|
72
|
+
mini_portile2 (2.1.0)
|
|
73
|
+
minitest (5.9.0)
|
|
74
|
+
mustache (1.0.3)
|
|
75
|
+
nio4r (1.2.1)
|
|
76
|
+
nokogiri (1.6.8)
|
|
77
|
+
mini_portile2 (~> 2.1.0)
|
|
78
|
+
pkg-config (~> 1.1.7)
|
|
73
79
|
pg (0.18.4)
|
|
74
|
-
|
|
80
|
+
pkg-config (1.1.7)
|
|
81
|
+
rack (2.0.1)
|
|
75
82
|
rack-test (0.6.3)
|
|
76
83
|
rack (>= 1.0)
|
|
77
|
-
rails (
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
84
|
+
rails (5.0.0.1)
|
|
85
|
+
actioncable (= 5.0.0.1)
|
|
86
|
+
actionmailer (= 5.0.0.1)
|
|
87
|
+
actionpack (= 5.0.0.1)
|
|
88
|
+
actionview (= 5.0.0.1)
|
|
89
|
+
activejob (= 5.0.0.1)
|
|
90
|
+
activemodel (= 5.0.0.1)
|
|
91
|
+
activerecord (= 5.0.0.1)
|
|
92
|
+
activesupport (= 5.0.0.1)
|
|
85
93
|
bundler (>= 1.3.0, < 2.0)
|
|
86
|
-
railties (=
|
|
87
|
-
sprockets-rails
|
|
88
|
-
rails-
|
|
89
|
-
activesupport (>= 4.2.0.
|
|
90
|
-
rails-dom-testing (1.0.7)
|
|
91
|
-
activesupport (>= 4.2.0.beta, < 5.0)
|
|
94
|
+
railties (= 5.0.0.1)
|
|
95
|
+
sprockets-rails (>= 2.0.0)
|
|
96
|
+
rails-dom-testing (2.0.1)
|
|
97
|
+
activesupport (>= 4.2.0, < 6.0)
|
|
92
98
|
nokogiri (~> 1.6.0)
|
|
93
|
-
rails-deprecated_sanitizer (>= 1.0.1)
|
|
94
99
|
rails-html-sanitizer (1.0.3)
|
|
95
100
|
loofah (~> 2.0)
|
|
96
|
-
railties (
|
|
97
|
-
actionpack (=
|
|
98
|
-
activesupport (=
|
|
101
|
+
railties (5.0.0.1)
|
|
102
|
+
actionpack (= 5.0.0.1)
|
|
103
|
+
activesupport (= 5.0.0.1)
|
|
104
|
+
method_source
|
|
99
105
|
rake (>= 0.8.7)
|
|
100
106
|
thor (>= 0.18.1, < 2.0)
|
|
101
|
-
rake (
|
|
102
|
-
rspec (3.
|
|
103
|
-
rspec-core (~> 3.
|
|
104
|
-
rspec-expectations (~> 3.
|
|
105
|
-
rspec-mocks (~> 3.
|
|
106
|
-
rspec-core (3.
|
|
107
|
-
rspec-support (~> 3.
|
|
108
|
-
rspec-expectations (3.
|
|
107
|
+
rake (11.2.2)
|
|
108
|
+
rspec (3.5.0)
|
|
109
|
+
rspec-core (~> 3.5.0)
|
|
110
|
+
rspec-expectations (~> 3.5.0)
|
|
111
|
+
rspec-mocks (~> 3.5.0)
|
|
112
|
+
rspec-core (3.5.2)
|
|
113
|
+
rspec-support (~> 3.5.0)
|
|
114
|
+
rspec-expectations (3.5.0)
|
|
109
115
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
110
|
-
rspec-support (~> 3.
|
|
111
|
-
rspec-mocks (3.
|
|
116
|
+
rspec-support (~> 3.5.0)
|
|
117
|
+
rspec-mocks (3.5.0)
|
|
112
118
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
113
|
-
rspec-support (~> 3.
|
|
114
|
-
rspec-rails (3.
|
|
115
|
-
actionpack (>= 3.0
|
|
116
|
-
activesupport (>= 3.0
|
|
117
|
-
railties (>= 3.0
|
|
118
|
-
rspec-core (~> 3.
|
|
119
|
-
rspec-expectations (~> 3.
|
|
120
|
-
rspec-mocks (~> 3.
|
|
121
|
-
rspec-support (~> 3.
|
|
122
|
-
rspec-support (3.
|
|
123
|
-
rspec_api_documentation (4.
|
|
119
|
+
rspec-support (~> 3.5.0)
|
|
120
|
+
rspec-rails (3.5.2)
|
|
121
|
+
actionpack (>= 3.0)
|
|
122
|
+
activesupport (>= 3.0)
|
|
123
|
+
railties (>= 3.0)
|
|
124
|
+
rspec-core (~> 3.5.0)
|
|
125
|
+
rspec-expectations (~> 3.5.0)
|
|
126
|
+
rspec-mocks (~> 3.5.0)
|
|
127
|
+
rspec-support (~> 3.5.0)
|
|
128
|
+
rspec-support (3.5.0)
|
|
129
|
+
rspec_api_documentation (4.8.0)
|
|
124
130
|
activesupport (>= 3.0.0)
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
sprockets (3.5.2)
|
|
131
|
+
mustache (~> 1.0, >= 0.99.4)
|
|
132
|
+
rspec (~> 3.0, >= 3.0.0)
|
|
133
|
+
sprockets (3.7.0)
|
|
129
134
|
concurrent-ruby (~> 1.0)
|
|
130
135
|
rack (> 1, < 3)
|
|
131
|
-
sprockets-rails (3.0
|
|
136
|
+
sprockets-rails (3.2.0)
|
|
132
137
|
actionpack (>= 4.0)
|
|
133
138
|
activesupport (>= 4.0)
|
|
134
139
|
sprockets (>= 3.0.0)
|
|
@@ -136,6 +141,9 @@ GEM
|
|
|
136
141
|
thread_safe (0.3.5)
|
|
137
142
|
tzinfo (1.2.2)
|
|
138
143
|
thread_safe (~> 0.1)
|
|
144
|
+
websocket-driver (0.6.4)
|
|
145
|
+
websocket-extensions (>= 0.1.0)
|
|
146
|
+
websocket-extensions (0.1.2)
|
|
139
147
|
|
|
140
148
|
PLATFORMS
|
|
141
149
|
ruby
|
|
@@ -145,4 +153,4 @@ DEPENDENCIES
|
|
|
145
153
|
stitches!
|
|
146
154
|
|
|
147
155
|
BUNDLED WITH
|
|
148
|
-
1.
|
|
156
|
+
1.13.6
|
data/README.md
CHANGED
|
@@ -41,6 +41,20 @@ Run database migrations (do `rake db:create` first if you haven't yet set up a d
|
|
|
41
41
|
rake db:migrate
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
+
### Upgrading from older verison of Stitches
|
|
45
|
+
|
|
46
|
+
If you have used stitches before the `enabled` field was added to `ApiClients`, you need to add that field to your database. You can do this by running
|
|
47
|
+
the included generator:
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
rails g stitches:add_enabled_to_api_clients
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
And then:
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
rake db:migrate
|
|
57
|
+
```
|
|
44
58
|
|
|
45
59
|
## Test the install
|
|
46
60
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
require 'rails/generators'
|
|
2
|
+
|
|
3
|
+
module Stitches
|
|
4
|
+
class AddEnabledToApiClientsGenerator < Rails::Generators::Base
|
|
5
|
+
include Rails::Generators::Migration
|
|
6
|
+
|
|
7
|
+
source_root(File.expand_path(File.join(File.dirname(__FILE__),"generator_files")))
|
|
8
|
+
|
|
9
|
+
def self.next_migration_number(path)
|
|
10
|
+
Time.now.utc.strftime("%Y%m%d%H%M%S")
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
desc "Upgrade your api_clients table so it uses the `enabled` field"
|
|
14
|
+
def update_api_clients_table
|
|
15
|
+
migration_template "db/migrate/add_enabled_to_api_clients.rb", "db/migrate/add_enabled_to_api_clients.rb"
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
end
|
|
19
|
+
end
|
data/lib/stitches/api_key.rb
CHANGED
|
@@ -32,7 +32,14 @@ module Stitches
|
|
|
32
32
|
if authorization
|
|
33
33
|
if authorization =~ /#{@configuration.custom_http_auth_scheme}\s+key=(.*)\s*$/
|
|
34
34
|
key = $1
|
|
35
|
-
|
|
35
|
+
|
|
36
|
+
if ApiClient.column_names.include?("enabled")
|
|
37
|
+
client = ApiClient.where(key: key, enabled: true).first
|
|
38
|
+
else
|
|
39
|
+
ActiveSupport::Deprecation.warn('api_keys is missing "enabled" column. Run "rails g stitches:add_enabled_to_api_clients"')
|
|
40
|
+
client = ApiClient.where(key: key).first
|
|
41
|
+
end
|
|
42
|
+
|
|
36
43
|
if client.present?
|
|
37
44
|
env[@configuration.env_var_to_hold_api_client_primary_key] = client.id
|
|
38
45
|
env[@configuration.env_var_to_hold_api_client] = client
|
|
@@ -3,9 +3,10 @@ class CreateApiClients < ActiveRecord::Migration
|
|
|
3
3
|
create_table :api_clients do |t|
|
|
4
4
|
t.string :name, null: false
|
|
5
5
|
t.column :key, "uuid default uuid_generate_v4()", null: false
|
|
6
|
+
t.column :enabled, :bool, null: false, default: true
|
|
6
7
|
t.column :created_at, "timestamp with time zone default now()", null: false
|
|
7
8
|
end
|
|
8
|
-
add_index :api_clients, [:name]
|
|
9
|
+
add_index :api_clients, [:name]
|
|
9
10
|
add_index :api_clients, [:key], unique: true
|
|
10
11
|
end
|
|
11
12
|
end
|
data/lib/stitches/version.rb
CHANGED
data/lib/stitches_norailtie.rb
CHANGED
|
@@ -12,6 +12,7 @@ require 'stitches/render_timestamps_in_iso8601_in_json'
|
|
|
12
12
|
require 'stitches/error'
|
|
13
13
|
require 'stitches/errors'
|
|
14
14
|
require 'stitches/api_generator'
|
|
15
|
+
require 'stitches/add_enabled_to_api_clients_generator'
|
|
15
16
|
require 'stitches/api_version_constraint'
|
|
16
17
|
require 'stitches/api_key'
|
|
17
18
|
require 'stitches/valid_mime_type'
|
data/spec/api_key_spec.rb
CHANGED
|
@@ -7,6 +7,9 @@ end
|
|
|
7
7
|
|
|
8
8
|
unless defined? ApiClient
|
|
9
9
|
class ApiClient
|
|
10
|
+
def self.column_names
|
|
11
|
+
["enabled"]
|
|
12
|
+
end
|
|
10
13
|
end
|
|
11
14
|
end
|
|
12
15
|
|
|
@@ -17,7 +20,7 @@ describe Stitches::ApiKey do
|
|
|
17
20
|
double(ApiClient, id: 42)
|
|
18
21
|
]
|
|
19
22
|
}
|
|
20
|
-
|
|
23
|
+
|
|
21
24
|
before do
|
|
22
25
|
Stitches.configuration.reset_to_defaults!
|
|
23
26
|
Stitches.configuration.custom_http_auth_scheme = 'MyAwesomeInternalScheme'
|
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.
|
|
4
|
+
version: 3.3.0
|
|
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:
|
|
14
|
+
date: 2017-01-10 00:00:00.000000000 Z
|
|
15
15
|
dependencies:
|
|
16
16
|
- !ruby/object:Gem::Dependency
|
|
17
17
|
name: rails
|
|
@@ -120,6 +120,7 @@ files:
|
|
|
120
120
|
- README.md
|
|
121
121
|
- Rakefile
|
|
122
122
|
- lib/stitches.rb
|
|
123
|
+
- lib/stitches/add_enabled_to_api_clients_generator.rb
|
|
123
124
|
- lib/stitches/api_generator.rb
|
|
124
125
|
- lib/stitches/api_key.rb
|
|
125
126
|
- lib/stitches/api_version_constraint.rb
|
|
@@ -134,6 +135,7 @@ files:
|
|
|
134
135
|
- lib/stitches/generator_files/app/controllers/api/v2/pings_controller.rb
|
|
135
136
|
- lib/stitches/generator_files/app/models/api_client.rb
|
|
136
137
|
- lib/stitches/generator_files/config/initializers/stitches.rb
|
|
138
|
+
- lib/stitches/generator_files/db/migrate/add_enabled_to_api_clients.rb
|
|
137
139
|
- lib/stitches/generator_files/db/migrate/create_api_clients.rb
|
|
138
140
|
- lib/stitches/generator_files/db/migrate/enable_uuid_ossp_extension.rb
|
|
139
141
|
- lib/stitches/generator_files/lib/tasks/generate_api_key.rake
|
|
@@ -179,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
179
181
|
version: '0'
|
|
180
182
|
requirements: []
|
|
181
183
|
rubyforge_project:
|
|
182
|
-
rubygems_version: 2.
|
|
184
|
+
rubygems_version: 2.5.1
|
|
183
185
|
signing_key:
|
|
184
186
|
specification_version: 4
|
|
185
187
|
summary: You'll be in stitches at how easy it is to create a service at Stitch Fix
|