my_api_client 0.18.0 → 0.22.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +50 -120
- data/.gem_comet.yml +13 -2
- data/.github/dependabot.yml +32 -0
- data/.rubocop.yml +1 -1
- data/.rubocop_todo.yml +1 -15
- data/CHANGELOG.md +73 -86
- data/Gemfile +2 -0
- data/Gemfile.lock +75 -57
- data/README.jp.md +79 -15
- data/README.md +392 -8
- data/gemfiles/rails_5.0.gemfile +1 -0
- data/gemfiles/rails_5.1.gemfile +1 -0
- data/gemfiles/rails_5.2.gemfile +1 -0
- data/gemfiles/rails_6.0.gemfile +1 -0
- data/gemfiles/rails_6.1.gemfile +15 -0
- data/gemfiles/rails_7.0.gemfile +15 -0
- data/lib/generators/rails/templates/api_client.rb.erb +3 -5
- data/lib/generators/rspec/templates/api_client_spec.rb.erb +0 -8
- data/lib/my_api_client/base.rb +2 -9
- data/lib/my_api_client/integrations/bugsnag.rb +1 -1
- data/lib/my_api_client/request.rb +1 -1
- data/lib/my_api_client/rspec/matchers/be_handled_as_an_error.rb +3 -3
- data/lib/my_api_client/rspec/matchers/request_to.rb +1 -1
- data/lib/my_api_client/rspec/stub.rb +40 -15
- data/lib/my_api_client/version.rb +1 -1
- data/my_api/.ruby-version +1 -1
- data/my_api/Gemfile +3 -0
- data/my_api/Gemfile.lock +108 -99
- data/my_api/app/controllers/pagination_controller.rb +2 -2
- data/my_api/public/index.html +2 -2
- data/my_api/spec/spec_helper.rb +1 -1
- data/my_api_client.gemspec +6 -3
- data/rails_app/rails_5.2/Gemfile.lock +73 -64
- data/rails_app/rails_5.2/config/environments/production.rb +1 -1
- data/rails_app/rails_6.0/Gemfile.lock +95 -79
- data/rails_app/rails_6.0/config/environments/production.rb +1 -1
- data/rails_app/rails_6.1/.gitattributes +8 -0
- data/rails_app/rails_6.1/.gitignore +28 -0
- data/rails_app/rails_6.1/.rspec +3 -0
- data/rails_app/rails_6.1/Gemfile +17 -0
- data/rails_app/rails_6.1/Gemfile.lock +203 -0
- data/rails_app/rails_6.1/README.md +24 -0
- data/rails_app/rails_6.1/Rakefile +8 -0
- data/rails_app/rails_6.1/app/controllers/application_controller.rb +4 -0
- data/rails_app/rails_6.1/app/controllers/concerns/.keep +0 -0
- data/rails_app/rails_6.1/app/javascript/.keep +0 -0
- data/rails_app/rails_6.1/app/models/application_record.rb +5 -0
- data/rails_app/rails_6.1/app/models/concerns/.keep +0 -0
- data/rails_app/rails_6.1/bin/bundle +122 -0
- data/rails_app/rails_6.1/bin/rails +6 -0
- data/rails_app/rails_6.1/bin/rake +6 -0
- data/rails_app/rails_6.1/bin/setup +35 -0
- data/rails_app/rails_6.1/config/application.rb +42 -0
- data/rails_app/rails_6.1/config/boot.rb +5 -0
- data/rails_app/rails_6.1/config/credentials.yml.enc +1 -0
- data/rails_app/rails_6.1/config/database.yml +25 -0
- data/rails_app/rails_6.1/config/environment.rb +7 -0
- data/rails_app/rails_6.1/config/environments/development.rb +59 -0
- data/rails_app/rails_6.1/config/environments/production.rb +97 -0
- data/rails_app/rails_6.1/config/environments/test.rb +51 -0
- data/rails_app/rails_6.1/config/initializers/application_controller_renderer.rb +9 -0
- data/rails_app/rails_6.1/config/initializers/backtrace_silencers.rb +10 -0
- data/rails_app/rails_6.1/config/initializers/cors.rb +17 -0
- data/rails_app/rails_6.1/config/initializers/filter_parameter_logging.rb +8 -0
- data/rails_app/rails_6.1/config/initializers/inflections.rb +17 -0
- data/rails_app/rails_6.1/config/initializers/mime_types.rb +5 -0
- data/rails_app/rails_6.1/config/initializers/wrap_parameters.rb +16 -0
- data/rails_app/rails_6.1/config/locales/en.yml +33 -0
- data/rails_app/rails_6.1/config/routes.rb +5 -0
- data/rails_app/rails_6.1/config.ru +8 -0
- data/rails_app/rails_6.1/db/seeds.rb +8 -0
- data/rails_app/rails_6.1/lib/tasks/.keep +0 -0
- data/rails_app/rails_6.1/public/robots.txt +1 -0
- data/rails_app/rails_6.1/spec/rails_helper.rb +14 -0
- data/rails_app/rails_6.1/spec/spec_helper.rb +13 -0
- data/rails_app/rails_6.1/tmp/.keep +0 -0
- data/rails_app/rails_6.1/tmp/pids/.keep +0 -0
- data/rails_app/rails_6.1/vendor/.keep +0 -0
- data/rails_app/rails_7.0/Gemfile +13 -0
- data/rails_app/rails_7.0/Gemfile.lock +147 -0
- data/rails_app/rails_7.0/README.md +24 -0
- data/rails_app/rails_7.0/Rakefile +8 -0
- data/rails_app/rails_7.0/app/controllers/application_controller.rb +4 -0
- data/rails_app/rails_7.0/app/models/application_record.rb +5 -0
- data/rails_app/rails_7.0/bin/bundle +122 -0
- data/rails_app/rails_7.0/bin/rails +6 -0
- data/rails_app/rails_7.0/bin/rake +6 -0
- data/rails_app/rails_7.0/bin/setup +35 -0
- data/rails_app/rails_7.0/config/application.rb +41 -0
- data/rails_app/rails_7.0/config/boot.rb +5 -0
- data/rails_app/rails_7.0/config/credentials.yml.enc +1 -0
- data/rails_app/rails_7.0/config/database.yml +25 -0
- data/rails_app/rails_7.0/config/environment.rb +7 -0
- data/rails_app/rails_7.0/config/environments/development.rb +58 -0
- data/rails_app/rails_7.0/config/environments/production.rb +70 -0
- data/rails_app/rails_7.0/config/environments/test.rb +52 -0
- data/rails_app/rails_7.0/config/initializers/cors.rb +17 -0
- data/rails_app/rails_7.0/config/initializers/filter_parameter_logging.rb +8 -0
- data/rails_app/rails_7.0/config/initializers/inflections.rb +17 -0
- data/rails_app/rails_7.0/config/locales/en.yml +33 -0
- data/rails_app/rails_7.0/config/routes.rb +8 -0
- data/rails_app/rails_7.0/config.ru +8 -0
- data/rails_app/rails_7.0/db/seeds.rb +8 -0
- data/rails_app/rails_7.0/public/robots.txt +1 -0
- data/rails_app/rails_7.0/spec/rails_helper.rb +14 -0
- data/rails_app/rails_7.0/spec/spec_helper.rb +13 -0
- metadata +83 -11
- data/.dependabot/config.yml +0 -34
- data/.rubocop_challenge.yml +0 -5
@@ -18,13 +18,17 @@ module MyApiClient
|
|
18
18
|
# @example
|
19
19
|
# stub_api_client_all(
|
20
20
|
# ExampleApiClient,
|
21
|
+
# get_users: { # Returns an arbitrary pageable response
|
22
|
+
# pageable: [ { id: 1 }, { id: 2 }] # for `#pageable_get`.
|
23
|
+
# },
|
21
24
|
# get_user: { response: { id: 1 } }, # Returns an arbitrary response.
|
22
25
|
# post_users: { id: 1 }, # You can ommit `response` keyword.
|
23
26
|
# patch_user: ->(params) { { id: params[:id] } }, # Returns calculated result as response.
|
24
27
|
# put_user: { raise: MyApiClient::ClientError } # Raises an arbitrary error.
|
25
28
|
# delete_user: {
|
26
29
|
# raise: MyApiClient::ClientError,
|
27
|
-
# response: { errors: [{ code: 10 }] }, # You can stub response
|
30
|
+
# response: { errors: [{ code: 10 }] }, # You can stub response and statu code
|
31
|
+
# status_code: 429, # with an arbitrary error.
|
28
32
|
# }
|
29
33
|
# )
|
30
34
|
# response = ExampleApiClient.new.get_user(id: 123)
|
@@ -46,13 +50,17 @@ module MyApiClient
|
|
46
50
|
# @example
|
47
51
|
# api_client = stub_api_client(
|
48
52
|
# ExampleApiClient,
|
53
|
+
# get_users: { # Returns an arbitrary pageable response
|
54
|
+
# pageable: [ { id: 1 }, { id: 2 }] # for `#pageable_get`.
|
55
|
+
# },
|
49
56
|
# get_user: { response: { id: 1 } }, # Returns an arbitrary response.
|
50
57
|
# post_users: { id: 1 }, # You can ommit `response` keyword.
|
51
58
|
# patch_user: ->(params) { { id: params[:id] } }, # Returns calculated result as response.
|
52
59
|
# put_user: { raise: MyApiClient::ClientError } # Raises an arbitrary error.
|
53
60
|
# delete_user: {
|
54
61
|
# raise: MyApiClient::ClientError,
|
55
|
-
# response: { errors: [{ code: 10 }] }, # You can stub response
|
62
|
+
# response: { errors: [{ code: 10 }] }, # You can stub response and status code
|
63
|
+
# status_code: 403, # with exception.
|
56
64
|
# }
|
57
65
|
# )
|
58
66
|
# response = api_client.get_user(id: 123)
|
@@ -67,25 +75,40 @@ module MyApiClient
|
|
67
75
|
|
68
76
|
private
|
69
77
|
|
70
|
-
# rubocop:disable Metrics/AbcSize
|
71
78
|
def stubbing(instance, action, options)
|
79
|
+
allow(instance).to receive(action) do |*request|
|
80
|
+
generate_stubbed_response(options, *request)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
def generate_stubbed_response(options, *request) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
72
85
|
case options
|
73
86
|
when Proc
|
74
|
-
|
87
|
+
stub_as_resource(options.call(*request))
|
75
88
|
when Hash
|
76
|
-
if options[:raise]
|
77
|
-
|
78
|
-
allow(instance).to receive(action).and_raise(exception)
|
89
|
+
if options[:raise] # rubocop:disable Style/GuardClause
|
90
|
+
raise process_raise_option(options[:raise], options[:response], options[:status_code])
|
79
91
|
elsif options[:response]
|
80
|
-
|
92
|
+
stub_as_resource(options[:response])
|
93
|
+
elsif options[:pageable].is_a?(Enumerable)
|
94
|
+
stub_as_pageable_resource(options[:pageable].each, *request)
|
81
95
|
else
|
82
|
-
|
96
|
+
stub_as_resource(options)
|
83
97
|
end
|
84
98
|
else
|
85
|
-
|
99
|
+
stub_as_resource(options)
|
86
100
|
end
|
87
101
|
end
|
88
|
-
|
102
|
+
|
103
|
+
def stub_as_pageable_resource(pager, *request)
|
104
|
+
Enumerator.new do |y|
|
105
|
+
loop do
|
106
|
+
y << generate_stubbed_response(pager.next, *request)
|
107
|
+
rescue StopIteration
|
108
|
+
break
|
109
|
+
end
|
110
|
+
end.lazy
|
111
|
+
end
|
89
112
|
|
90
113
|
# Provides a shorthand for `raise` option.
|
91
114
|
# `MyApiClient::Error` requires `MyApiClient::Params::Params` instance on
|
@@ -93,12 +116,14 @@ module MyApiClient
|
|
93
116
|
# If given a error instance, it will return raw value without processing.
|
94
117
|
#
|
95
118
|
# @param exception [Clsas, MyApiClient::Error] Processing target.
|
119
|
+
# @param response [Hash] describe_response_here
|
120
|
+
# @param status_code [Integer] describe_status_code_here
|
96
121
|
# @return [MyApiClient::Error] Processed exception.
|
97
122
|
# @raise [RuntimeError] Unsupported error class was set.
|
98
|
-
def process_raise_option(exception, response
|
123
|
+
def process_raise_option(exception, response, status_code)
|
99
124
|
case exception
|
100
125
|
when Class
|
101
|
-
params = MyApiClient::Params::Params.new(nil, stub_as_response(response))
|
126
|
+
params = MyApiClient::Params::Params.new(nil, stub_as_response(response, status_code))
|
102
127
|
if exception == MyApiClient::NetworkError
|
103
128
|
exception.new(params, Net::OpenTimeout.new)
|
104
129
|
else
|
@@ -113,10 +138,10 @@ module MyApiClient
|
|
113
138
|
end
|
114
139
|
end
|
115
140
|
|
116
|
-
def stub_as_response(params)
|
141
|
+
def stub_as_response(params, status_code)
|
117
142
|
instance_double(
|
118
143
|
Sawyer::Response,
|
119
|
-
status: 400,
|
144
|
+
status: status_code.presence || 400,
|
120
145
|
headers: {},
|
121
146
|
data: stub_as_resource(params),
|
122
147
|
timing: 0.123
|
data/my_api/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.7.2
|
data/my_api/Gemfile
CHANGED
@@ -6,6 +6,9 @@ gem 'jets'
|
|
6
6
|
|
7
7
|
gem 'dynomite'
|
8
8
|
|
9
|
+
# See: https://github.com/boltops-tools/jets/issues/523
|
10
|
+
gem 'nokogiri', '~> 1.12.5'
|
11
|
+
|
9
12
|
# development and test groups are not bundled as part of the deployment
|
10
13
|
group :development, :test do
|
11
14
|
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
|
data/my_api/Gemfile.lock
CHANGED
@@ -1,43 +1,44 @@
|
|
1
1
|
GEM
|
2
2
|
remote: https://rubygems.org/
|
3
3
|
specs:
|
4
|
-
actionmailer (6.
|
5
|
-
actionpack (= 6.
|
6
|
-
actionview (= 6.
|
7
|
-
activejob (= 6.
|
4
|
+
actionmailer (6.1.4.3)
|
5
|
+
actionpack (= 6.1.4.3)
|
6
|
+
actionview (= 6.1.4.3)
|
7
|
+
activejob (= 6.1.4.3)
|
8
|
+
activesupport (= 6.1.4.3)
|
8
9
|
mail (~> 2.5, >= 2.5.4)
|
9
10
|
rails-dom-testing (~> 2.0)
|
10
|
-
actionpack (6.
|
11
|
-
actionview (= 6.
|
12
|
-
activesupport (= 6.
|
13
|
-
rack (~> 2.0, >= 2.0.
|
11
|
+
actionpack (6.1.4.3)
|
12
|
+
actionview (= 6.1.4.3)
|
13
|
+
activesupport (= 6.1.4.3)
|
14
|
+
rack (~> 2.0, >= 2.0.9)
|
14
15
|
rack-test (>= 0.6.3)
|
15
16
|
rails-dom-testing (~> 2.0)
|
16
17
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
17
|
-
actionview (6.
|
18
|
-
activesupport (= 6.
|
18
|
+
actionview (6.1.4.3)
|
19
|
+
activesupport (= 6.1.4.3)
|
19
20
|
builder (~> 3.1)
|
20
21
|
erubi (~> 1.4)
|
21
22
|
rails-dom-testing (~> 2.0)
|
22
23
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
23
|
-
activejob (6.
|
24
|
-
activesupport (= 6.
|
24
|
+
activejob (6.1.4.3)
|
25
|
+
activesupport (= 6.1.4.3)
|
25
26
|
globalid (>= 0.3.6)
|
26
|
-
activemodel (6.
|
27
|
-
activesupport (= 6.
|
28
|
-
activerecord (6.
|
29
|
-
activemodel (= 6.
|
30
|
-
activesupport (= 6.
|
31
|
-
activesupport (6.
|
27
|
+
activemodel (6.1.4.3)
|
28
|
+
activesupport (= 6.1.4.3)
|
29
|
+
activerecord (6.1.4.3)
|
30
|
+
activemodel (= 6.1.4.3)
|
31
|
+
activesupport (= 6.1.4.3)
|
32
|
+
activesupport (6.1.4.3)
|
32
33
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
33
|
-
i18n (>=
|
34
|
-
minitest (
|
35
|
-
tzinfo (~>
|
36
|
-
zeitwerk (~> 2.
|
37
|
-
addressable (2.
|
34
|
+
i18n (>= 1.6, < 2)
|
35
|
+
minitest (>= 5.1)
|
36
|
+
tzinfo (~> 2.0)
|
37
|
+
zeitwerk (~> 2.3)
|
38
|
+
addressable (2.8.0)
|
38
39
|
public_suffix (>= 2.0.2, < 5.0)
|
39
|
-
aws-eventstream (1.
|
40
|
-
aws-mfa-secure (0.4.
|
40
|
+
aws-eventstream (1.2.0)
|
41
|
+
aws-mfa-secure (0.4.3)
|
41
42
|
activesupport
|
42
43
|
aws-sdk-core
|
43
44
|
aws_config
|
@@ -45,65 +46,68 @@ GEM
|
|
45
46
|
rainbow
|
46
47
|
thor
|
47
48
|
zeitwerk
|
48
|
-
aws-partitions (1.
|
49
|
-
aws-sdk-apigateway (1.
|
50
|
-
aws-sdk-core (~> 3, >= 3.
|
49
|
+
aws-partitions (1.541.0)
|
50
|
+
aws-sdk-apigateway (1.71.0)
|
51
|
+
aws-sdk-core (~> 3, >= 3.122.0)
|
51
52
|
aws-sigv4 (~> 1.1)
|
52
|
-
aws-sdk-cloudformation (1.
|
53
|
-
aws-sdk-core (~> 3, >= 3.
|
53
|
+
aws-sdk-cloudformation (1.63.0)
|
54
|
+
aws-sdk-core (~> 3, >= 3.122.0)
|
54
55
|
aws-sigv4 (~> 1.1)
|
55
|
-
aws-sdk-cloudwatchlogs (1.
|
56
|
-
aws-sdk-core (~> 3, >= 3.
|
56
|
+
aws-sdk-cloudwatchlogs (1.49.0)
|
57
|
+
aws-sdk-core (~> 3, >= 3.122.0)
|
57
58
|
aws-sigv4 (~> 1.1)
|
58
|
-
aws-sdk-core (3.
|
59
|
+
aws-sdk-core (3.124.0)
|
59
60
|
aws-eventstream (~> 1, >= 1.0.2)
|
60
|
-
aws-partitions (~> 1, >= 1.
|
61
|
+
aws-partitions (~> 1, >= 1.525.0)
|
61
62
|
aws-sigv4 (~> 1.1)
|
62
63
|
jmespath (~> 1.0)
|
63
|
-
aws-sdk-dynamodb (1.
|
64
|
-
aws-sdk-core (~> 3, >= 3.
|
64
|
+
aws-sdk-dynamodb (1.69.0)
|
65
|
+
aws-sdk-core (~> 3, >= 3.122.0)
|
65
66
|
aws-sigv4 (~> 1.1)
|
66
|
-
aws-sdk-kinesis (1.
|
67
|
-
aws-sdk-core (~> 3, >= 3.
|
67
|
+
aws-sdk-kinesis (1.38.0)
|
68
|
+
aws-sdk-core (~> 3, >= 3.122.0)
|
68
69
|
aws-sigv4 (~> 1.1)
|
69
|
-
aws-sdk-kms (1.
|
70
|
-
aws-sdk-core (~> 3, >= 3.
|
70
|
+
aws-sdk-kms (1.52.0)
|
71
|
+
aws-sdk-core (~> 3, >= 3.122.0)
|
71
72
|
aws-sigv4 (~> 1.1)
|
72
|
-
aws-sdk-lambda (1.
|
73
|
-
aws-sdk-core (~> 3, >= 3.
|
73
|
+
aws-sdk-lambda (1.76.0)
|
74
|
+
aws-sdk-core (~> 3, >= 3.122.0)
|
74
75
|
aws-sigv4 (~> 1.1)
|
75
|
-
aws-sdk-s3 (1.
|
76
|
-
aws-sdk-core (~> 3, >= 3.
|
76
|
+
aws-sdk-s3 (1.109.0)
|
77
|
+
aws-sdk-core (~> 3, >= 3.122.0)
|
77
78
|
aws-sdk-kms (~> 1)
|
79
|
+
aws-sigv4 (~> 1.4)
|
80
|
+
aws-sdk-sns (1.49.0)
|
81
|
+
aws-sdk-core (~> 3, >= 3.122.0)
|
78
82
|
aws-sigv4 (~> 1.1)
|
79
|
-
aws-sdk-
|
80
|
-
aws-sdk-core (~> 3, >= 3.
|
83
|
+
aws-sdk-sqs (1.48.0)
|
84
|
+
aws-sdk-core (~> 3, >= 3.122.0)
|
81
85
|
aws-sigv4 (~> 1.1)
|
82
|
-
aws-sdk-
|
83
|
-
aws-sdk-core (~> 3, >= 3.
|
86
|
+
aws-sdk-ssm (1.126.0)
|
87
|
+
aws-sdk-core (~> 3, >= 3.122.0)
|
84
88
|
aws-sigv4 (~> 1.1)
|
85
|
-
aws-
|
86
|
-
aws-sdk-core (~> 3, >= 3.99.0)
|
87
|
-
aws-sigv4 (~> 1.1)
|
88
|
-
aws-sigv4 (1.2.2)
|
89
|
+
aws-sigv4 (1.4.0)
|
89
90
|
aws-eventstream (~> 1, >= 1.0.2)
|
90
91
|
aws_config (0.1.0)
|
91
92
|
builder (3.2.4)
|
92
93
|
byebug (11.1.3)
|
93
|
-
capybara (3.
|
94
|
+
capybara (3.36.0)
|
94
95
|
addressable
|
96
|
+
matrix
|
95
97
|
mini_mime (>= 0.1.3)
|
96
98
|
nokogiri (~> 1.8)
|
97
99
|
rack (>= 1.6.0)
|
98
100
|
rack-test (>= 0.6.3)
|
99
|
-
regexp_parser (
|
101
|
+
regexp_parser (>= 1.5, < 3.0)
|
100
102
|
xpath (~> 3.2)
|
103
|
+
cfn-status (0.4.3)
|
104
|
+
aws-sdk-cloudformation
|
101
105
|
cfn_camelizer (0.4.9)
|
102
106
|
activesupport
|
103
107
|
memoist
|
104
108
|
rainbow
|
105
|
-
|
106
|
-
concurrent-ruby (1.1.
|
109
|
+
cfn_response (0.2.0)
|
110
|
+
concurrent-ruby (1.1.9)
|
107
111
|
crass (1.0.6)
|
108
112
|
diff-lcs (1.4.4)
|
109
113
|
dotenv (2.7.6)
|
@@ -111,19 +115,19 @@ GEM
|
|
111
115
|
activesupport
|
112
116
|
aws-sdk-dynamodb
|
113
117
|
rainbow
|
114
|
-
erubi (1.
|
118
|
+
erubi (1.10.0)
|
115
119
|
gems (1.2.0)
|
116
|
-
globalid (0.
|
117
|
-
activesupport (>=
|
118
|
-
hashie (
|
119
|
-
i18n (1.8.
|
120
|
+
globalid (1.0.0)
|
121
|
+
activesupport (>= 5.0)
|
122
|
+
hashie (5.0.0)
|
123
|
+
i18n (1.8.11)
|
120
124
|
concurrent-ruby (~> 1.0)
|
121
|
-
jets (
|
122
|
-
actionmailer (~> 6.
|
123
|
-
actionpack (~> 6.
|
124
|
-
actionview (~> 6.
|
125
|
-
activerecord (~> 6.
|
126
|
-
activesupport (~> 6.
|
125
|
+
jets (3.0.23)
|
126
|
+
actionmailer (~> 6.1.0)
|
127
|
+
actionpack (~> 6.1.0)
|
128
|
+
actionview (~> 6.1.0)
|
129
|
+
activerecord (~> 6.1.0)
|
130
|
+
activesupport (~> 6.1.0)
|
127
131
|
aws-mfa-secure (~> 0.4.0)
|
128
132
|
aws-sdk-apigateway
|
129
133
|
aws-sdk-cloudformation
|
@@ -135,69 +139,70 @@ GEM
|
|
135
139
|
aws-sdk-sns
|
136
140
|
aws-sdk-sqs
|
137
141
|
aws-sdk-ssm
|
142
|
+
cfn-status
|
138
143
|
cfn_camelizer (~> 0.4.6)
|
139
|
-
|
144
|
+
cfn_response
|
140
145
|
dotenv
|
141
146
|
gems
|
142
147
|
hashie
|
143
|
-
jets-gems
|
144
148
|
jets-html-sanitizer
|
145
149
|
kramdown
|
146
150
|
memoist
|
147
|
-
|
151
|
+
mini_mime
|
148
152
|
rack
|
149
|
-
railties (~> 6.
|
153
|
+
railties (~> 6.1.0)
|
150
154
|
rainbow
|
151
155
|
recursive-open-struct
|
156
|
+
serverlessgems (~> 0.1.4)
|
152
157
|
shotgun
|
153
158
|
text-table
|
154
159
|
thor
|
155
|
-
zeitwerk
|
156
|
-
jets-gems (0.2.2)
|
157
|
-
gems
|
160
|
+
zeitwerk (~> 2.4.0)
|
158
161
|
jets-html-sanitizer (1.0.4)
|
159
162
|
loofah (~> 2.2, >= 2.2.2)
|
160
163
|
jmespath (1.4.0)
|
161
|
-
kramdown (2.3.
|
164
|
+
kramdown (2.3.1)
|
162
165
|
rexml
|
163
166
|
launchy (2.5.0)
|
164
167
|
addressable (~> 2.7)
|
165
|
-
loofah (2.
|
168
|
+
loofah (2.13.0)
|
166
169
|
crass (~> 1.0.2)
|
167
170
|
nokogiri (>= 1.5.9)
|
168
171
|
mail (2.7.1)
|
169
172
|
mini_mime (>= 0.1.1)
|
173
|
+
matrix (0.4.2)
|
170
174
|
memoist (0.16.2)
|
171
175
|
method_source (1.0.0)
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
176
|
+
mini_mime (1.1.2)
|
177
|
+
mini_portile2 (2.6.1)
|
178
|
+
minitest (5.14.4)
|
179
|
+
nio4r (2.5.8)
|
180
|
+
nokogiri (1.12.5)
|
181
|
+
mini_portile2 (~> 2.6.1)
|
182
|
+
racc (~> 1.4)
|
179
183
|
public_suffix (4.0.6)
|
180
|
-
puma (5.
|
184
|
+
puma (5.5.2)
|
181
185
|
nio4r (~> 2.0)
|
186
|
+
racc (1.6.0)
|
182
187
|
rack (2.2.3)
|
183
188
|
rack-test (1.1.0)
|
184
189
|
rack (>= 1.0, < 3)
|
185
190
|
rails-dom-testing (2.0.3)
|
186
191
|
activesupport (>= 4.2.0)
|
187
192
|
nokogiri (>= 1.6)
|
188
|
-
rails-html-sanitizer (1.
|
193
|
+
rails-html-sanitizer (1.4.2)
|
189
194
|
loofah (~> 2.3)
|
190
|
-
railties (6.
|
191
|
-
actionpack (= 6.
|
192
|
-
activesupport (= 6.
|
195
|
+
railties (6.1.4.3)
|
196
|
+
actionpack (= 6.1.4.3)
|
197
|
+
activesupport (= 6.1.4.3)
|
193
198
|
method_source
|
194
|
-
rake (>= 0.
|
195
|
-
thor (
|
199
|
+
rake (>= 0.13)
|
200
|
+
thor (~> 1.0)
|
196
201
|
rainbow (3.0.0)
|
197
|
-
rake (13.0.
|
198
|
-
recursive-open-struct (1.1.
|
199
|
-
regexp_parser (1.
|
200
|
-
rexml (3.2.
|
202
|
+
rake (13.0.6)
|
203
|
+
recursive-open-struct (1.1.3)
|
204
|
+
regexp_parser (2.1.1)
|
205
|
+
rexml (3.2.5)
|
201
206
|
rspec (3.10.0)
|
202
207
|
rspec-core (~> 3.10.0)
|
203
208
|
rspec-expectations (~> 3.10.0)
|
@@ -213,16 +218,19 @@ GEM
|
|
213
218
|
rspec-support (3.10.0)
|
214
219
|
rspec_junit_formatter (0.4.1)
|
215
220
|
rspec-core (>= 2, < 4, != 2.12.0)
|
221
|
+
serverlessgems (0.1.6)
|
222
|
+
gems
|
223
|
+
memoist
|
224
|
+
zeitwerk
|
216
225
|
shotgun (0.9.2)
|
217
226
|
rack (>= 1.0)
|
218
227
|
text-table (1.2.4)
|
219
|
-
thor (1.0
|
220
|
-
|
221
|
-
|
222
|
-
thread_safe (~> 0.1)
|
228
|
+
thor (1.1.0)
|
229
|
+
tzinfo (2.0.4)
|
230
|
+
concurrent-ruby (~> 1.0)
|
223
231
|
xpath (3.2.0)
|
224
232
|
nokogiri (~> 1.8)
|
225
|
-
zeitwerk (2.4.
|
233
|
+
zeitwerk (2.4.2)
|
226
234
|
|
227
235
|
PLATFORMS
|
228
236
|
ruby
|
@@ -233,6 +241,7 @@ DEPENDENCIES
|
|
233
241
|
dynomite
|
234
242
|
jets
|
235
243
|
launchy
|
244
|
+
nokogiri (~> 1.12.5)
|
236
245
|
puma
|
237
246
|
rack
|
238
247
|
rspec
|
@@ -4,7 +4,7 @@
|
|
4
4
|
class PaginationController < ApplicationController
|
5
5
|
# GET pagination
|
6
6
|
def index
|
7
|
-
case params[:page]
|
7
|
+
case params[:page]&.to_s
|
8
8
|
when '1', nil
|
9
9
|
render status: :ok, json: first_page
|
10
10
|
when '2'
|
@@ -50,7 +50,7 @@ class PaginationController < ApplicationController
|
|
50
50
|
# but it should be `https://xxxxx.execute-api.ap-northeast-1.amazonaws.com/dev/pagination`.
|
51
51
|
# So this is workaround.
|
52
52
|
def page_link(page)
|
53
|
-
query_strings =
|
53
|
+
query_strings = "?#{{ page: page }.to_query}"
|
54
54
|
uri = File.join(ENV['JETS_HOST'], ENV['JETS_STAGE'], pagination_path)
|
55
55
|
uri.sub!('http://', 'https://')
|
56
56
|
URI.join(uri, query_strings)
|
data/my_api/public/index.html
CHANGED
@@ -83,8 +83,8 @@
|
|
83
83
|
<p>Also check out the <a href="http://rubyonjets.com/reference">Jets CLI reference</a>.</p>
|
84
84
|
</div>
|
85
85
|
<p class="version">
|
86
|
-
<strong>Jets version:</strong>
|
87
|
-
<strong>Ruby version:</strong> 2.
|
86
|
+
<strong>Jets version:</strong> 3.0.11<br />
|
87
|
+
<strong>Ruby version:</strong> 2.7.2
|
88
88
|
</p>
|
89
89
|
</div>
|
90
90
|
</body>
|
data/my_api/spec/spec_helper.rb
CHANGED
data/my_api_client.gemspec
CHANGED
@@ -22,9 +22,9 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
23
|
spec.require_paths = ['lib']
|
24
24
|
|
25
|
-
spec.required_ruby_version = '>= 2.
|
25
|
+
spec.required_ruby_version = '>= 2.6.0'
|
26
26
|
|
27
|
-
spec.add_dependency 'activesupport', '>= 5.
|
27
|
+
spec.add_dependency 'activesupport', '>= 5.2.0'
|
28
28
|
spec.add_dependency 'faraday', '>= 0.17.1'
|
29
29
|
spec.add_dependency 'jsonpath'
|
30
30
|
spec.add_dependency 'sawyer', '>= 0.8.2'
|
@@ -37,7 +37,10 @@ Gem::Specification.new do |spec|
|
|
37
37
|
spec.add_development_dependency 'rubocop'
|
38
38
|
spec.add_development_dependency 'rubocop-performance'
|
39
39
|
spec.add_development_dependency 'rubocop-rspec'
|
40
|
-
spec.add_development_dependency 'simplecov', '0.
|
40
|
+
spec.add_development_dependency 'simplecov', '0.21.2'
|
41
41
|
spec.add_development_dependency 'webmock'
|
42
42
|
spec.add_development_dependency 'yard'
|
43
|
+
spec.metadata = {
|
44
|
+
'rubygems_mfa_required' => 'true',
|
45
|
+
}
|
43
46
|
end
|