my_api_client 1.0.0 → 1.2.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 +6 -6
- data/.rubocop.yml +4 -3
- data/.ruby-version +1 -0
- data/CHANGELOG.md +58 -0
- data/Gemfile.lock +66 -65
- data/README.jp.md +2 -2
- data/README.md +2 -2
- data/example/api_clients/my_error_api_client.rb +1 -1
- data/example/api_clients/my_header_api_client.rb +1 -1
- data/example/api_clients/my_pagination_api_client.rb +2 -2
- data/example/api_clients/my_rest_api_client.rb +10 -10
- data/example/api_clients/my_status_api_client.rb +1 -1
- data/gemfiles/rails_7.1.gemfile +15 -0
- data/gemfiles/rails_7.2.gemfile +15 -0
- data/lib/my_api_client/error_handling/generator.rb +1 -1
- data/lib/my_api_client/error_handling.rb +1 -1
- data/lib/my_api_client/errors/network_error.rb +1 -1
- data/lib/my_api_client/errors.rb +1 -1
- data/lib/my_api_client/exceptions.rb +12 -1
- data/lib/my_api_client/params/params.rb +1 -1
- data/lib/my_api_client/params/request.rb +8 -8
- data/lib/my_api_client/request/basic.rb +2 -2
- data/lib/my_api_client/request/executor.rb +1 -1
- data/lib/my_api_client/request/pagination.rb +1 -3
- data/lib/my_api_client/request.rb +5 -5
- data/lib/my_api_client/rspec/matcher_helper.rb +3 -3
- data/lib/my_api_client/rspec/matchers/request_to.rb +1 -1
- data/lib/my_api_client/version.rb +1 -1
- data/my_api/Gemfile +1 -1
- data/my_api/Gemfile.lock +55 -51
- data/my_api/app/controllers/error_controller.rb +1 -1
- data/my_api/app/controllers/pagination_controller.rb +1 -1
- data/my_api/app/controllers/rest_controller.rb +4 -4
- data/my_api/app/controllers/status_controller.rb +1 -1
- data/my_api/spec/controllers/error_controller_spec.rb +4 -4
- data/my_api/spec/controllers/status_controller_spec.rb +3 -3
- data/my_api_client.gemspec +2 -1
- data/rails_app/rails_6.1/Gemfile.lock +73 -71
- data/rails_app/rails_7.0/Gemfile.lock +78 -76
- data/rails_app/rails_7.1/.dockerignore +31 -0
- data/rails_app/rails_7.1/.rspec +1 -0
- data/rails_app/rails_7.1/Dockerfile +55 -0
- data/rails_app/rails_7.1/Gemfile +16 -0
- data/rails_app/rails_7.1/Gemfile.lock +241 -0
- data/rails_app/rails_7.1/README.md +24 -0
- data/rails_app/rails_7.1/Rakefile +8 -0
- data/rails_app/rails_7.1/app/controllers/application_controller.rb +4 -0
- data/rails_app/rails_7.1/app/controllers/concerns/.keep +0 -0
- data/rails_app/rails_7.1/app/models/application_record.rb +5 -0
- data/rails_app/rails_7.1/app/models/concerns/.keep +0 -0
- data/rails_app/rails_7.1/bin/bundle +122 -0
- data/rails_app/rails_7.1/bin/docker-entrypoint +8 -0
- data/rails_app/rails_7.1/bin/rails +6 -0
- data/rails_app/rails_7.1/bin/rake +6 -0
- data/rails_app/rails_7.1/bin/setup +35 -0
- data/rails_app/rails_7.1/config/application.rb +46 -0
- data/rails_app/rails_7.1/config/boot.rb +5 -0
- data/rails_app/rails_7.1/config/credentials.yml.enc +1 -0
- data/rails_app/rails_7.1/config/database.yml +25 -0
- data/rails_app/rails_7.1/config/environment.rb +7 -0
- data/rails_app/rails_7.1/config/environments/development.rb +58 -0
- data/rails_app/rails_7.1/config/environments/production.rb +74 -0
- data/rails_app/rails_7.1/config/environments/test.rb +56 -0
- data/rails_app/rails_7.1/config/initializers/cors.rb +17 -0
- data/rails_app/rails_7.1/config/initializers/filter_parameter_logging.rb +10 -0
- data/rails_app/rails_7.1/config/initializers/inflections.rb +17 -0
- data/rails_app/rails_7.1/config/locales/en.yml +31 -0
- data/rails_app/rails_7.1/config/puma.rb +46 -0
- data/rails_app/rails_7.1/config/routes.rb +12 -0
- data/rails_app/rails_7.1/config.ru +8 -0
- data/rails_app/rails_7.1/db/seeds.rb +10 -0
- data/rails_app/rails_7.1/lib/tasks/.keep +0 -0
- data/rails_app/rails_7.1/public/robots.txt +2 -0
- data/rails_app/rails_7.1/spec/rails_helper.rb +13 -0
- data/rails_app/rails_7.1/spec/spec_helper.rb +13 -0
- data/rails_app/rails_7.1/storage/.keep +0 -0
- data/rails_app/rails_7.1/tmp/.keep +0 -0
- data/rails_app/rails_7.1/tmp/pids/.keep +0 -0
- data/rails_app/rails_7.1/tmp/storage/.keep +0 -0
- data/rails_app/rails_7.1/vendor/.keep +0 -0
- data/rails_app/rails_7.2/.dockerignore +42 -0
- data/rails_app/rails_7.2/.github/dependabot.yml +12 -0
- data/rails_app/rails_7.2/.github/workflows/ci.yml +55 -0
- data/rails_app/rails_7.2/.rspec +1 -0
- data/rails_app/rails_7.2/Dockerfile +62 -0
- data/rails_app/rails_7.2/Gemfile +15 -0
- data/rails_app/rails_7.2/Gemfile.lock +240 -0
- data/rails_app/rails_7.2/README.md +24 -0
- data/rails_app/rails_7.2/Rakefile +8 -0
- data/rails_app/rails_7.2/app/controllers/application_controller.rb +4 -0
- data/rails_app/rails_7.2/app/controllers/concerns/.keep +0 -0
- data/rails_app/rails_7.2/app/models/application_record.rb +5 -0
- data/rails_app/rails_7.2/app/models/concerns/.keep +0 -0
- data/rails_app/rails_7.2/bin/brakeman +9 -0
- data/rails_app/rails_7.2/bin/bundle +122 -0
- data/rails_app/rails_7.2/bin/docker-entrypoint +13 -0
- data/rails_app/rails_7.2/bin/rails +6 -0
- data/rails_app/rails_7.2/bin/rake +6 -0
- data/rails_app/rails_7.2/bin/rubocop +10 -0
- data/rails_app/rails_7.2/bin/setup +39 -0
- data/rails_app/rails_7.2/config/application.rb +46 -0
- data/rails_app/rails_7.2/config/boot.rb +5 -0
- data/rails_app/rails_7.2/config/credentials.yml.enc +1 -0
- data/rails_app/rails_7.2/config/database.yml +32 -0
- data/rails_app/rails_7.2/config/environment.rb +7 -0
- data/rails_app/rails_7.2/config/environments/development.rb +59 -0
- data/rails_app/rails_7.2/config/environments/production.rb +77 -0
- data/rails_app/rails_7.2/config/environments/test.rb +53 -0
- data/rails_app/rails_7.2/config/initializers/cors.rb +18 -0
- data/rails_app/rails_7.2/config/initializers/filter_parameter_logging.rb +10 -0
- data/rails_app/rails_7.2/config/initializers/inflections.rb +18 -0
- data/rails_app/rails_7.2/config/locales/en.yml +31 -0
- data/rails_app/rails_7.2/config/puma.rb +36 -0
- data/rails_app/rails_7.2/config/routes.rb +12 -0
- data/rails_app/rails_7.2/config.ru +8 -0
- data/rails_app/rails_7.2/db/seeds.rb +11 -0
- data/rails_app/rails_7.2/lib/tasks/.keep +0 -0
- data/rails_app/rails_7.2/public/robots.txt +3 -0
- data/rails_app/rails_7.2/spec/rails_helper.rb +13 -0
- data/rails_app/rails_7.2/spec/spec_helper.rb +13 -0
- data/rails_app/rails_7.2/storage/.keep +0 -0
- data/rails_app/rails_7.2/tmp/.keep +0 -0
- data/rails_app/rails_7.2/tmp/pids/.keep +0 -0
- data/rails_app/rails_7.2/tmp/storage/.keep +0 -0
- data/rails_app/rails_7.2/vendor/.keep +0 -0
- metadata +107 -4
@@ -15,11 +15,11 @@ module MyApiClient
|
|
15
15
|
# @param pathname [String]
|
16
16
|
# Pathname of the request target URL.
|
17
17
|
# It's joined with the defined by `endpoint`.
|
18
|
-
# @param headers [Hash, nil]
|
18
|
+
# @param headers [Hash, Proc<Hash>, nil]
|
19
19
|
# Request headers.
|
20
20
|
# @param query [Hash, nil]
|
21
21
|
# Query string.
|
22
|
-
# @param body [Hash, nil]
|
22
|
+
# @param body [Hash, Proc<Hash>, nil]
|
23
23
|
# Request body.
|
24
24
|
# @return [Sawyer::Response]
|
25
25
|
# Response instance.
|
@@ -35,9 +35,9 @@ module MyApiClient
|
|
35
35
|
# HTTP method. e.g. `:get`, `:post`, `:put`, `:patch` and `:delete`.
|
36
36
|
# @param uri [URI]
|
37
37
|
# Request target URI including query strings.
|
38
|
-
# @param headers [Hash, nil]
|
38
|
+
# @param headers [Hash, Proc<Hash>, nil]
|
39
39
|
# Request headers.
|
40
|
-
# @param body [Hash, nil]
|
40
|
+
# @param body [Hash, Proc<Hash>, nil]
|
41
41
|
# Request body.
|
42
42
|
# @return [Sawyer::Response]
|
43
43
|
# Response instance.
|
@@ -46,7 +46,7 @@ module MyApiClient
|
|
46
46
|
instance: self,
|
47
47
|
request_params: Params::Request.new(http_method, uri, headers, body),
|
48
48
|
request_logger: Logger.new(logger, http_method, uri),
|
49
|
-
faraday_options:
|
49
|
+
faraday_options:
|
50
50
|
)
|
51
51
|
end
|
52
52
|
|
@@ -21,7 +21,7 @@ RSpec::Matchers.define :request_to do |expected_method, expected_url|
|
|
21
21
|
@actual =
|
22
22
|
{
|
23
23
|
request_line: request_line(method, @actual_schema_and_hostname + pathname),
|
24
|
-
body
|
24
|
+
body:,
|
25
25
|
headers: options[:headers],
|
26
26
|
}.compact
|
27
27
|
end.and_return(dummy_response)
|
data/my_api/Gemfile
CHANGED
@@ -7,7 +7,7 @@ gem 'jets', '~> 4.0.10'
|
|
7
7
|
gem 'dynomite'
|
8
8
|
|
9
9
|
# See: https://github.com/boltops-tools/jets/issues/523
|
10
|
-
gem 'nokogiri', '~> 1.
|
10
|
+
gem 'nokogiri', '~> 1.16.7'
|
11
11
|
|
12
12
|
# development and test groups are not bundled as part of the deployment
|
13
13
|
group :development, :test do
|
data/my_api/Gemfile.lock
CHANGED
@@ -1,41 +1,41 @@
|
|
1
1
|
GEM
|
2
2
|
remote: https://rubygems.org/
|
3
3
|
specs:
|
4
|
-
actionmailer (6.1.7.
|
5
|
-
actionpack (= 6.1.7.
|
6
|
-
actionview (= 6.1.7.
|
7
|
-
activejob (= 6.1.7.
|
8
|
-
activesupport (= 6.1.7.
|
4
|
+
actionmailer (6.1.7.8)
|
5
|
+
actionpack (= 6.1.7.8)
|
6
|
+
actionview (= 6.1.7.8)
|
7
|
+
activejob (= 6.1.7.8)
|
8
|
+
activesupport (= 6.1.7.8)
|
9
9
|
mail (~> 2.5, >= 2.5.4)
|
10
10
|
rails-dom-testing (~> 2.0)
|
11
|
-
actionpack (6.1.7.
|
12
|
-
actionview (= 6.1.7.
|
13
|
-
activesupport (= 6.1.7.
|
11
|
+
actionpack (6.1.7.8)
|
12
|
+
actionview (= 6.1.7.8)
|
13
|
+
activesupport (= 6.1.7.8)
|
14
14
|
rack (~> 2.0, >= 2.0.9)
|
15
15
|
rack-test (>= 0.6.3)
|
16
16
|
rails-dom-testing (~> 2.0)
|
17
17
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
18
|
-
actionview (6.1.7.
|
19
|
-
activesupport (= 6.1.7.
|
18
|
+
actionview (6.1.7.8)
|
19
|
+
activesupport (= 6.1.7.8)
|
20
20
|
builder (~> 3.1)
|
21
21
|
erubi (~> 1.4)
|
22
22
|
rails-dom-testing (~> 2.0)
|
23
23
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
24
|
-
activejob (6.1.7.
|
25
|
-
activesupport (= 6.1.7.
|
24
|
+
activejob (6.1.7.8)
|
25
|
+
activesupport (= 6.1.7.8)
|
26
26
|
globalid (>= 0.3.6)
|
27
|
-
activemodel (6.1.7.
|
28
|
-
activesupport (= 6.1.7.
|
29
|
-
activerecord (6.1.7.
|
30
|
-
activemodel (= 6.1.7.
|
31
|
-
activesupport (= 6.1.7.
|
32
|
-
activesupport (6.1.7.
|
27
|
+
activemodel (6.1.7.8)
|
28
|
+
activesupport (= 6.1.7.8)
|
29
|
+
activerecord (6.1.7.8)
|
30
|
+
activemodel (= 6.1.7.8)
|
31
|
+
activesupport (= 6.1.7.8)
|
32
|
+
activesupport (6.1.7.8)
|
33
33
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
34
34
|
i18n (>= 1.6, < 2)
|
35
35
|
minitest (>= 5.1)
|
36
36
|
tzinfo (~> 2.0)
|
37
37
|
zeitwerk (~> 2.3)
|
38
|
-
addressable (2.8.
|
38
|
+
addressable (2.8.6)
|
39
39
|
public_suffix (>= 2.0.2, < 6.0)
|
40
40
|
aws-eventstream (1.3.0)
|
41
41
|
aws-mfa-secure (0.4.4)
|
@@ -91,11 +91,11 @@ GEM
|
|
91
91
|
aws_config (0.1.1)
|
92
92
|
builder (3.2.4)
|
93
93
|
byebug (11.1.3)
|
94
|
-
capybara (3.
|
94
|
+
capybara (3.40.0)
|
95
95
|
addressable
|
96
96
|
matrix
|
97
97
|
mini_mime (>= 0.1.3)
|
98
|
-
nokogiri (~> 1.
|
98
|
+
nokogiri (~> 1.11)
|
99
99
|
rack (>= 1.6.0)
|
100
100
|
rack-test (>= 0.6.3)
|
101
101
|
regexp_parser (>= 1.5, < 3.0)
|
@@ -107,10 +107,11 @@ GEM
|
|
107
107
|
memoist
|
108
108
|
rainbow
|
109
109
|
cfn_response (0.2.0)
|
110
|
-
|
110
|
+
childprocess (5.0.0)
|
111
|
+
concurrent-ruby (1.3.1)
|
111
112
|
crass (1.0.6)
|
112
113
|
date (3.3.4)
|
113
|
-
diff-lcs (1.5.
|
114
|
+
diff-lcs (1.5.1)
|
114
115
|
dotenv (2.8.1)
|
115
116
|
dynomite (1.2.7)
|
116
117
|
activesupport
|
@@ -121,7 +122,7 @@ GEM
|
|
121
122
|
globalid (1.2.1)
|
122
123
|
activesupport (>= 6.1)
|
123
124
|
hashie (5.0.0)
|
124
|
-
i18n (1.14.
|
125
|
+
i18n (1.14.5)
|
125
126
|
concurrent-ruby (~> 1.0)
|
126
127
|
jets (4.0.10)
|
127
128
|
actionmailer (~> 6.1.0)
|
@@ -164,8 +165,9 @@ GEM
|
|
164
165
|
jmespath (1.6.2)
|
165
166
|
kramdown (2.4.0)
|
166
167
|
rexml
|
167
|
-
launchy (
|
168
|
+
launchy (3.0.1)
|
168
169
|
addressable (~> 2.8)
|
170
|
+
childprocess (~> 5.0)
|
169
171
|
loofah (2.22.0)
|
170
172
|
crass (~> 1.0.2)
|
171
173
|
nokogiri (>= 1.12.0)
|
@@ -178,8 +180,8 @@ GEM
|
|
178
180
|
memoist (0.16.2)
|
179
181
|
method_source (1.0.0)
|
180
182
|
mini_mime (1.1.5)
|
181
|
-
mini_portile2 (2.8.
|
182
|
-
minitest (5.
|
183
|
+
mini_portile2 (2.8.7)
|
184
|
+
minitest (5.23.1)
|
183
185
|
net-imap (0.4.7)
|
184
186
|
date
|
185
187
|
net-protocol
|
@@ -189,15 +191,15 @@ GEM
|
|
189
191
|
timeout
|
190
192
|
net-smtp (0.4.0)
|
191
193
|
net-protocol
|
192
|
-
nio4r (2.
|
193
|
-
nokogiri (1.
|
194
|
+
nio4r (2.7.0)
|
195
|
+
nokogiri (1.16.7)
|
194
196
|
mini_portile2 (~> 2.8.2)
|
195
197
|
racc (~> 1.4)
|
196
|
-
public_suffix (5.0.
|
197
|
-
puma (6.4.
|
198
|
+
public_suffix (5.0.5)
|
199
|
+
puma (6.4.2)
|
198
200
|
nio4r (~> 2.0)
|
199
|
-
racc (1.
|
200
|
-
rack (2.2.
|
201
|
+
racc (1.8.0)
|
202
|
+
rack (2.2.9)
|
201
203
|
rack-test (2.1.0)
|
202
204
|
rack (>= 1.3)
|
203
205
|
rails-dom-testing (2.2.0)
|
@@ -207,30 +209,31 @@ GEM
|
|
207
209
|
rails-html-sanitizer (1.6.0)
|
208
210
|
loofah (~> 2.21)
|
209
211
|
nokogiri (~> 1.14)
|
210
|
-
railties (6.1.7.
|
211
|
-
actionpack (= 6.1.7.
|
212
|
-
activesupport (= 6.1.7.
|
212
|
+
railties (6.1.7.8)
|
213
|
+
actionpack (= 6.1.7.8)
|
214
|
+
activesupport (= 6.1.7.8)
|
213
215
|
method_source
|
214
216
|
rake (>= 12.2)
|
215
217
|
thor (~> 1.0)
|
216
218
|
rainbow (3.1.1)
|
217
219
|
rake (13.1.0)
|
218
220
|
recursive-open-struct (1.1.3)
|
219
|
-
regexp_parser (2.
|
220
|
-
rexml (3.
|
221
|
-
|
222
|
-
|
223
|
-
rspec-
|
224
|
-
rspec-
|
225
|
-
|
226
|
-
|
227
|
-
|
221
|
+
regexp_parser (2.9.0)
|
222
|
+
rexml (3.3.6)
|
223
|
+
strscan
|
224
|
+
rspec (3.13.0)
|
225
|
+
rspec-core (~> 3.13.0)
|
226
|
+
rspec-expectations (~> 3.13.0)
|
227
|
+
rspec-mocks (~> 3.13.0)
|
228
|
+
rspec-core (3.13.0)
|
229
|
+
rspec-support (~> 3.13.0)
|
230
|
+
rspec-expectations (3.13.0)
|
228
231
|
diff-lcs (>= 1.2.0, < 2.0)
|
229
|
-
rspec-support (~> 3.
|
230
|
-
rspec-mocks (3.
|
232
|
+
rspec-support (~> 3.13.0)
|
233
|
+
rspec-mocks (3.13.0)
|
231
234
|
diff-lcs (>= 1.2.0, < 2.0)
|
232
|
-
rspec-support (~> 3.
|
233
|
-
rspec-support (3.
|
235
|
+
rspec-support (~> 3.13.0)
|
236
|
+
rspec-support (3.13.0)
|
234
237
|
rspec_junit_formatter (0.6.0)
|
235
238
|
rspec-core (>= 2, < 4, != 2.12.0)
|
236
239
|
serverlessgems (0.4.0)
|
@@ -239,6 +242,7 @@ GEM
|
|
239
242
|
zeitwerk
|
240
243
|
shotgun (0.9.2)
|
241
244
|
rack (>= 1.0)
|
245
|
+
strscan (3.1.0)
|
242
246
|
text-table (1.2.4)
|
243
247
|
thor (1.3.0)
|
244
248
|
timeout (0.4.1)
|
@@ -246,7 +250,7 @@ GEM
|
|
246
250
|
concurrent-ruby (~> 1.0)
|
247
251
|
xpath (3.2.0)
|
248
252
|
nokogiri (~> 1.8)
|
249
|
-
zeitwerk (2.6.
|
253
|
+
zeitwerk (2.6.15)
|
250
254
|
|
251
255
|
PLATFORMS
|
252
256
|
ruby
|
@@ -257,7 +261,7 @@ DEPENDENCIES
|
|
257
261
|
dynomite
|
258
262
|
jets (~> 4.0.10)
|
259
263
|
launchy
|
260
|
-
nokogiri (~> 1.
|
264
|
+
nokogiri (~> 1.16.7)
|
261
265
|
puma
|
262
266
|
rack
|
263
267
|
rspec
|
@@ -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 = "?#{{ page:
|
53
|
+
query_strings = "?#{{ page: }.to_query}"
|
54
54
|
uri = File.join(ENV.fetch('JETS_HOST', nil), ENV.fetch('JETS_STAGE', nil), pagination_path)
|
55
55
|
uri.sub!('http://', 'https://')
|
56
56
|
URI.join(uri, query_strings)
|
@@ -10,7 +10,7 @@ class RestController < ApplicationController
|
|
10
10
|
|
11
11
|
# GET rest/:id
|
12
12
|
def show
|
13
|
-
render status: :ok, json: find_post(id:
|
13
|
+
render status: :ok, json: find_post(id:)
|
14
14
|
end
|
15
15
|
|
16
16
|
# POST rest
|
@@ -22,7 +22,7 @@ class RestController < ApplicationController
|
|
22
22
|
# POST/PUT/PATCH rest/:id
|
23
23
|
def update
|
24
24
|
render status: :ok,
|
25
|
-
json: update_post(id
|
25
|
+
json: update_post(id:, title: params[:title])
|
26
26
|
end
|
27
27
|
|
28
28
|
# DELETE rest/:id
|
@@ -49,11 +49,11 @@ class RestController < ApplicationController
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def create_post(title:)
|
52
|
-
{ id: 4, title:
|
52
|
+
{ id: 4, title: }
|
53
53
|
end
|
54
54
|
|
55
55
|
def update_post(id:, title:)
|
56
|
-
find_post(id:
|
56
|
+
find_post(id:).tap do |post|
|
57
57
|
post[:title] = title
|
58
58
|
end
|
59
59
|
end
|
@@ -8,14 +8,14 @@ describe ErrorController do
|
|
8
8
|
let(:expected_response) do
|
9
9
|
{
|
10
10
|
error: {
|
11
|
-
code
|
11
|
+
code:,
|
12
12
|
message: 'You requested error code: 10',
|
13
13
|
},
|
14
14
|
}.to_json
|
15
15
|
end
|
16
16
|
|
17
17
|
it 'returns 400 Bad request with error code 10' do
|
18
|
-
get
|
18
|
+
get('/error/:code', code:)
|
19
19
|
expect(response.status).to eq 400
|
20
20
|
expect(response.body).to eq expected_response
|
21
21
|
end
|
@@ -27,14 +27,14 @@ describe ErrorController do
|
|
27
27
|
let(:expected_response) do
|
28
28
|
{
|
29
29
|
error: {
|
30
|
-
code
|
30
|
+
code:,
|
31
31
|
message: 'You requested error code: 20',
|
32
32
|
},
|
33
33
|
}.to_json
|
34
34
|
end
|
35
35
|
|
36
36
|
it 'returns 400 Bad request with error code 20' do
|
37
|
-
get
|
37
|
+
get('/error/:code', code:)
|
38
38
|
expect(response.status).to eq 400
|
39
39
|
expect(response.body).to eq expected_response
|
40
40
|
end
|
@@ -10,7 +10,7 @@ describe StatusController do
|
|
10
10
|
end
|
11
11
|
|
12
12
|
it 'returns 200 OK' do
|
13
|
-
get
|
13
|
+
get('/status/:status', status:)
|
14
14
|
expect(response.status).to eq status
|
15
15
|
expect(response.body).to eq expected_response
|
16
16
|
end
|
@@ -24,7 +24,7 @@ describe StatusController do
|
|
24
24
|
end
|
25
25
|
|
26
26
|
it 'returns 400 Bad request' do
|
27
|
-
get
|
27
|
+
get('/status/:status', status:)
|
28
28
|
expect(response.status).to eq status
|
29
29
|
expect(response.body).to eq expected_response
|
30
30
|
end
|
@@ -38,7 +38,7 @@ describe StatusController do
|
|
38
38
|
end
|
39
39
|
|
40
40
|
it 'returns 500 Internal server error' do
|
41
|
-
get
|
41
|
+
get('/status/:status', status:)
|
42
42
|
expect(response.status).to eq status
|
43
43
|
expect(response.body).to eq expected_response
|
44
44
|
end
|
data/my_api_client.gemspec
CHANGED
@@ -22,7 +22,7 @@ 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 = '>= 3.
|
25
|
+
spec.required_ruby_version = '>= 3.1.0'
|
26
26
|
|
27
27
|
spec.add_dependency 'activesupport', '>= 6.1.0'
|
28
28
|
spec.add_dependency 'faraday', '>= 0.17.1'
|
@@ -38,6 +38,7 @@ Gem::Specification.new do |spec|
|
|
38
38
|
spec.add_development_dependency 'rubocop-performance'
|
39
39
|
spec.add_development_dependency 'rubocop-rake'
|
40
40
|
spec.add_development_dependency 'rubocop-rspec'
|
41
|
+
spec.add_development_dependency 'rubocop-rspec_rails'
|
41
42
|
spec.add_development_dependency 'simplecov', '0.22.0'
|
42
43
|
spec.add_development_dependency 'webmock'
|
43
44
|
spec.add_development_dependency 'yard'
|
@@ -2,7 +2,7 @@ PATH
|
|
2
2
|
remote: ../..
|
3
3
|
specs:
|
4
4
|
my_api_client (0.24.0)
|
5
|
-
activesupport (>= 6.
|
5
|
+
activesupport (>= 6.1.0)
|
6
6
|
faraday (>= 0.17.1)
|
7
7
|
jsonpath
|
8
8
|
sawyer (>= 0.8.2)
|
@@ -10,60 +10,60 @@ PATH
|
|
10
10
|
GEM
|
11
11
|
remote: https://rubygems.org/
|
12
12
|
specs:
|
13
|
-
actioncable (6.1.
|
14
|
-
actionpack (= 6.1.
|
15
|
-
activesupport (= 6.1.
|
13
|
+
actioncable (6.1.7.8)
|
14
|
+
actionpack (= 6.1.7.8)
|
15
|
+
activesupport (= 6.1.7.8)
|
16
16
|
nio4r (~> 2.0)
|
17
17
|
websocket-driver (>= 0.6.1)
|
18
|
-
actionmailbox (6.1.
|
19
|
-
actionpack (= 6.1.
|
20
|
-
activejob (= 6.1.
|
21
|
-
activerecord (= 6.1.
|
22
|
-
activestorage (= 6.1.
|
23
|
-
activesupport (= 6.1.
|
18
|
+
actionmailbox (6.1.7.8)
|
19
|
+
actionpack (= 6.1.7.8)
|
20
|
+
activejob (= 6.1.7.8)
|
21
|
+
activerecord (= 6.1.7.8)
|
22
|
+
activestorage (= 6.1.7.8)
|
23
|
+
activesupport (= 6.1.7.8)
|
24
24
|
mail (>= 2.7.1)
|
25
|
-
actionmailer (6.1.
|
26
|
-
actionpack (= 6.1.
|
27
|
-
actionview (= 6.1.
|
28
|
-
activejob (= 6.1.
|
29
|
-
activesupport (= 6.1.
|
25
|
+
actionmailer (6.1.7.8)
|
26
|
+
actionpack (= 6.1.7.8)
|
27
|
+
actionview (= 6.1.7.8)
|
28
|
+
activejob (= 6.1.7.8)
|
29
|
+
activesupport (= 6.1.7.8)
|
30
30
|
mail (~> 2.5, >= 2.5.4)
|
31
31
|
rails-dom-testing (~> 2.0)
|
32
|
-
actionpack (6.1.
|
33
|
-
actionview (= 6.1.
|
34
|
-
activesupport (= 6.1.
|
32
|
+
actionpack (6.1.7.8)
|
33
|
+
actionview (= 6.1.7.8)
|
34
|
+
activesupport (= 6.1.7.8)
|
35
35
|
rack (~> 2.0, >= 2.0.9)
|
36
36
|
rack-test (>= 0.6.3)
|
37
37
|
rails-dom-testing (~> 2.0)
|
38
38
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
39
|
-
actiontext (6.1.
|
40
|
-
actionpack (= 6.1.
|
41
|
-
activerecord (= 6.1.
|
42
|
-
activestorage (= 6.1.
|
43
|
-
activesupport (= 6.1.
|
39
|
+
actiontext (6.1.7.8)
|
40
|
+
actionpack (= 6.1.7.8)
|
41
|
+
activerecord (= 6.1.7.8)
|
42
|
+
activestorage (= 6.1.7.8)
|
43
|
+
activesupport (= 6.1.7.8)
|
44
44
|
nokogiri (>= 1.8.5)
|
45
|
-
actionview (6.1.
|
46
|
-
activesupport (= 6.1.
|
45
|
+
actionview (6.1.7.8)
|
46
|
+
activesupport (= 6.1.7.8)
|
47
47
|
builder (~> 3.1)
|
48
48
|
erubi (~> 1.4)
|
49
49
|
rails-dom-testing (~> 2.0)
|
50
50
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
51
|
-
activejob (6.1.
|
52
|
-
activesupport (= 6.1.
|
51
|
+
activejob (6.1.7.8)
|
52
|
+
activesupport (= 6.1.7.8)
|
53
53
|
globalid (>= 0.3.6)
|
54
|
-
activemodel (6.1.
|
55
|
-
activesupport (= 6.1.
|
56
|
-
activerecord (6.1.
|
57
|
-
activemodel (= 6.1.
|
58
|
-
activesupport (= 6.1.
|
59
|
-
activestorage (6.1.
|
60
|
-
actionpack (= 6.1.
|
61
|
-
activejob (= 6.1.
|
62
|
-
activerecord (= 6.1.
|
63
|
-
activesupport (= 6.1.
|
54
|
+
activemodel (6.1.7.8)
|
55
|
+
activesupport (= 6.1.7.8)
|
56
|
+
activerecord (6.1.7.8)
|
57
|
+
activemodel (= 6.1.7.8)
|
58
|
+
activesupport (= 6.1.7.8)
|
59
|
+
activestorage (6.1.7.8)
|
60
|
+
actionpack (= 6.1.7.8)
|
61
|
+
activejob (= 6.1.7.8)
|
62
|
+
activerecord (= 6.1.7.8)
|
63
|
+
activesupport (= 6.1.7.8)
|
64
64
|
marcel (~> 1.0)
|
65
65
|
mini_mime (>= 1.1.0)
|
66
|
-
activesupport (6.1.
|
66
|
+
activesupport (6.1.7.8)
|
67
67
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
68
68
|
i18n (>= 1.6, < 2)
|
69
69
|
minitest (>= 5.1)
|
@@ -73,10 +73,10 @@ GEM
|
|
73
73
|
public_suffix (>= 2.0.2, < 6.0)
|
74
74
|
builder (3.2.4)
|
75
75
|
byebug (11.1.3)
|
76
|
-
concurrent-ruby (1.1
|
76
|
+
concurrent-ruby (1.3.1)
|
77
77
|
crass (1.0.6)
|
78
78
|
diff-lcs (1.4.4)
|
79
|
-
erubi (1.
|
79
|
+
erubi (1.12.0)
|
80
80
|
faraday (2.7.4)
|
81
81
|
faraday-net_http (>= 2.0, < 3.1)
|
82
82
|
ruby2_keywords (>= 0.0.4)
|
@@ -84,56 +84,58 @@ GEM
|
|
84
84
|
ffi (1.14.2)
|
85
85
|
globalid (1.0.1)
|
86
86
|
activesupport (>= 5.0)
|
87
|
-
i18n (1.
|
87
|
+
i18n (1.14.5)
|
88
88
|
concurrent-ruby (~> 1.0)
|
89
89
|
jsonpath (1.1.2)
|
90
90
|
multi_json
|
91
91
|
listen (3.3.3)
|
92
92
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
93
93
|
rb-inotify (~> 0.9, >= 0.9.10)
|
94
|
-
loofah (2.
|
94
|
+
loofah (2.22.0)
|
95
95
|
crass (~> 1.0.2)
|
96
|
-
nokogiri (>= 1.
|
96
|
+
nokogiri (>= 1.12.0)
|
97
97
|
mail (2.7.1)
|
98
98
|
mini_mime (>= 0.1.1)
|
99
99
|
marcel (1.0.2)
|
100
100
|
method_source (1.0.0)
|
101
101
|
mini_mime (1.1.2)
|
102
|
-
mini_portile2 (2.8.
|
103
|
-
minitest (5.
|
102
|
+
mini_portile2 (2.8.7)
|
103
|
+
minitest (5.23.1)
|
104
104
|
multi_json (1.15.0)
|
105
105
|
nio4r (2.5.8)
|
106
|
-
nokogiri (1.
|
107
|
-
mini_portile2 (~> 2.8.
|
106
|
+
nokogiri (1.16.5)
|
107
|
+
mini_portile2 (~> 2.8.2)
|
108
108
|
racc (~> 1.4)
|
109
109
|
public_suffix (5.0.1)
|
110
|
-
racc (1.
|
111
|
-
rack (2.2.
|
110
|
+
racc (1.8.0)
|
111
|
+
rack (2.2.8.1)
|
112
112
|
rack-test (1.1.0)
|
113
113
|
rack (>= 1.0, < 3)
|
114
|
-
rails (6.1.
|
115
|
-
actioncable (= 6.1.
|
116
|
-
actionmailbox (= 6.1.
|
117
|
-
actionmailer (= 6.1.
|
118
|
-
actionpack (= 6.1.
|
119
|
-
actiontext (= 6.1.
|
120
|
-
actionview (= 6.1.
|
121
|
-
activejob (= 6.1.
|
122
|
-
activemodel (= 6.1.
|
123
|
-
activerecord (= 6.1.
|
124
|
-
activestorage (= 6.1.
|
125
|
-
activesupport (= 6.1.
|
114
|
+
rails (6.1.7.8)
|
115
|
+
actioncable (= 6.1.7.8)
|
116
|
+
actionmailbox (= 6.1.7.8)
|
117
|
+
actionmailer (= 6.1.7.8)
|
118
|
+
actionpack (= 6.1.7.8)
|
119
|
+
actiontext (= 6.1.7.8)
|
120
|
+
actionview (= 6.1.7.8)
|
121
|
+
activejob (= 6.1.7.8)
|
122
|
+
activemodel (= 6.1.7.8)
|
123
|
+
activerecord (= 6.1.7.8)
|
124
|
+
activestorage (= 6.1.7.8)
|
125
|
+
activesupport (= 6.1.7.8)
|
126
126
|
bundler (>= 1.15.0)
|
127
|
-
railties (= 6.1.
|
127
|
+
railties (= 6.1.7.8)
|
128
128
|
sprockets-rails (>= 2.0.0)
|
129
|
-
rails-dom-testing (2.0
|
130
|
-
activesupport (>=
|
129
|
+
rails-dom-testing (2.2.0)
|
130
|
+
activesupport (>= 5.0.0)
|
131
|
+
minitest
|
131
132
|
nokogiri (>= 1.6)
|
132
|
-
rails-html-sanitizer (1.
|
133
|
-
loofah (~> 2.
|
134
|
-
|
135
|
-
|
136
|
-
|
133
|
+
rails-html-sanitizer (1.6.0)
|
134
|
+
loofah (~> 2.21)
|
135
|
+
nokogiri (~> 1.14)
|
136
|
+
railties (6.1.7.8)
|
137
|
+
actionpack (= 6.1.7.8)
|
138
|
+
activesupport (= 6.1.7.8)
|
137
139
|
method_source
|
138
140
|
rake (>= 12.2)
|
139
141
|
thor (~> 1.0)
|
@@ -171,12 +173,12 @@ GEM
|
|
171
173
|
sprockets (>= 3.0.0)
|
172
174
|
sqlite3 (1.4.2)
|
173
175
|
thor (1.2.1)
|
174
|
-
tzinfo (2.0.
|
176
|
+
tzinfo (2.0.6)
|
175
177
|
concurrent-ruby (~> 1.0)
|
176
178
|
websocket-driver (0.7.5)
|
177
179
|
websocket-extensions (>= 0.1.0)
|
178
180
|
websocket-extensions (0.1.5)
|
179
|
-
zeitwerk (2.6.
|
181
|
+
zeitwerk (2.6.15)
|
180
182
|
|
181
183
|
PLATFORMS
|
182
184
|
ruby
|