stitches 4.2.1 → 5.0.0.RC1

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.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +175 -209
  3. data/.env.example +1 -0
  4. data/.github/CODEOWNERS +1 -1
  5. data/.github/workflows/scheduled_cci.yml +14 -0
  6. data/.gitignore +3 -0
  7. data/.ruby-version +1 -1
  8. data/README.md +18 -9
  9. data/lib/stitches/api_generator.rb +2 -24
  10. data/lib/stitches/api_key.rb +2 -0
  11. data/lib/stitches/api_migration_generator.rb +23 -0
  12. data/lib/stitches/configuration.rb +2 -1
  13. data/lib/stitches/generator_files/config/initializers/stitches.rb +4 -0
  14. data/lib/stitches/generator_files/spec/acceptance/ping_v1_spec.rb +4 -2
  15. data/lib/stitches/generator_files/spec/features/api_spec.rb.erb +3 -0
  16. data/lib/stitches/railtie.rb +0 -1
  17. data/lib/stitches/spec/test_headers.rb +1 -1
  18. data/lib/stitches/version.rb +1 -1
  19. data/lib/stitches_norailtie.rb +1 -0
  20. data/owners.json +1 -1
  21. data/spec/api_key_middleware_spec.rb +257 -225
  22. data/spec/configuration_spec.rb +4 -0
  23. data/spec/fake_app/.ruby-version +1 -1
  24. data/spec/fake_app/Gemfile +5 -6
  25. data/spec/fake_app/config/application.rb +1 -3
  26. data/spec/fake_app/config/database.yml +9 -10
  27. data/spec/fake_app/config/initializers/assets.rb +0 -3
  28. data/spec/integration/add_to_rails_app_spec.rb +3 -6
  29. data/spec/rails_helper.rb +4 -2
  30. data/stitches.gemspec +2 -1
  31. metadata +23 -19
  32. data/Gemfile.rails-4.2 +0 -8
  33. data/Gemfile.rails-5.0 +0 -8
  34. data/Gemfile.rails-5.1 +0 -7
  35. data/Gemfile.rails-5.2 +0 -7
  36. data/Gemfile.rails-6.0 +0 -7
  37. data/Gemfile.rails-6.1 +0 -7
  38. data/build-matrix.json +0 -4
  39. data/spec/fake_app/db/development.sqlite3 +0 -0
  40. data/spec/fake_app/db/test.sqlite3 +0 -0
  41. data/spec/fake_app/doc/api.md +0 -4
@@ -11,7 +11,8 @@ resource "Ping (V1)" do
11
11
  response_field :status, "The status of the ping", scope: "ping", "Type" => "String"
12
12
  example "ping the server to validate your client's happy path" do
13
13
 
14
- header "Authorization", "CustomKeyAuth key=#{api_client.key}"
14
+ # Only needed if you're using API Key authentication
15
+ # header "Authorization", "CustomKeyAuth key=#{api_client.key}"
15
16
  do_request
16
17
 
17
18
  result = JSON.parse(response_body)
@@ -33,7 +34,8 @@ resource "Ping (V1)" do
33
34
 
34
35
  example "ping the server to validate your client's error handling" do
35
36
 
36
- header "Authorization", "CustomKeyAuth key=#{api_client.key}"
37
+ # Only needed if you're using API Key authentication
38
+ # header "Authorization", "CustomKeyAuth key=#{api_client.key}"
37
39
  do_request
38
40
 
39
41
  result = JSON.parse(response_body)
@@ -48,6 +48,8 @@ feature "general API stuff" do
48
48
  expect(response).to have_api_error(code: "test", message: "OH NOES!")
49
49
  end
50
50
 
51
+ <%# Remove always false if statement to enable API Key authentication %>
52
+ <% if false %>
51
53
  scenario "no auth header given" do
52
54
  headers = TestHeaders.new(api_client: nil)
53
55
  <% if ::Rails::VERSION::MAJOR >= 5 -%>
@@ -80,6 +82,7 @@ feature "general API stuff" do
80
82
 
81
83
  expect(response).to have_auth_error
82
84
  end
85
+ <% end %>
83
86
 
84
87
  scenario "no version" do
85
88
  headers = TestHeaders.new(version: nil)
@@ -6,6 +6,5 @@ module Stitches
6
6
  class Railtie < Rails::Railtie
7
7
  config.app_middleware.use Stitches::ApiKey
8
8
  config.app_middleware.use Stitches::ValidMimeType
9
-
10
9
  end
11
10
  end
@@ -6,7 +6,7 @@ class TestHeaders
6
6
  "Accept" => full_mimetype,
7
7
  "Content-Type" => full_mimetype,
8
8
  }.tap { |headers|
9
- set_authorization_header(headers,options)
9
+ set_authorization_header(headers,options) unless Stitches.configuration.disable_api_key_support
10
10
  }
11
11
  end
12
12
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stitches
4
- VERSION = '4.2.1'
4
+ VERSION = '5.0.0.RC1'
5
5
  end
@@ -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/api_migration_generator'
15
16
  require 'stitches/add_deprecation_generator'
16
17
  require 'stitches/add_enabled_to_api_clients_generator'
17
18
  require 'stitches/add_disabled_at_to_api_clients_generator'
data/owners.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "owners": [
3
3
  {
4
- "team": "eng-runtime"
4
+ "team": "dev-platform"
5
5
  }
6
6
  ]
7
7
  }