my_api_client 0.14.0 → 0.18.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/.circleci/config.yml +99 -53
- data/.dependabot/config.yml +19 -1
- data/.rubocop.yml +5 -1
- data/.rubocop_challenge.yml +5 -0
- data/.rubocop_todo.yml +53 -1
- data/CHANGELOG.md +192 -0
- data/Gemfile +0 -3
- data/Gemfile.lock +60 -56
- data/README.jp.md +159 -24
- data/bin/console +4 -0
- data/example/api_clients/application_api_client.rb +2 -10
- data/example/api_clients/my_pagination_api_client.rb +18 -0
- data/example/api_clients/my_rest_api_client.rb +9 -3
- data/lib/generators/rails/USAGE +1 -1
- data/lib/generators/rails/api_client_generator.rb +6 -0
- data/lib/generators/rails/templates/api_client.rb.erb +1 -1
- data/lib/generators/rails/templates/application_api_client.rb.erb +0 -11
- data/lib/generators/rspec/USAGE +1 -1
- data/lib/generators/rspec/api_client_generator.rb +6 -0
- data/lib/generators/rspec/templates/api_client_spec.rb.erb +23 -16
- data/lib/my_api_client.rb +7 -0
- data/lib/my_api_client/base.rb +4 -2
- data/lib/my_api_client/default_error_handlers.rb +64 -0
- data/lib/my_api_client/error_handling.rb +6 -6
- data/lib/my_api_client/error_handling/generator.rb +23 -7
- data/lib/my_api_client/errors.rb +1 -53
- data/lib/my_api_client/errors/api_limit_error.rb +6 -0
- data/lib/my_api_client/errors/client_error.rb +93 -0
- data/lib/my_api_client/errors/network_error.rb +43 -0
- data/lib/my_api_client/errors/server_error.rb +42 -0
- data/lib/my_api_client/params/params.rb +1 -3
- data/lib/my_api_client/request.rb +29 -34
- data/lib/my_api_client/request/basic.rb +32 -0
- data/lib/my_api_client/request/executor.rb +1 -1
- data/lib/my_api_client/request/pagination.rb +39 -0
- data/lib/my_api_client/version.rb +1 -1
- data/my_api/.ruby-version +1 -1
- data/my_api/Gemfile.lock +86 -86
- data/my_api/README.md +6 -0
- data/my_api/app/controllers/pagination_controller.rb +58 -0
- data/my_api/config/routes.rb +1 -0
- data/my_api/spec/controllers/pagination_controller_spec.rb +73 -0
- data/my_api/spec/controllers/rest_controller_spec.rb +23 -5
- data/my_api/spec/spec_helper.rb +5 -0
- data/my_api_client.gemspec +2 -2
- data/rails_app/rails_5.2/.rspec +3 -0
- data/rails_app/rails_5.2/Gemfile +17 -0
- data/rails_app/rails_5.2/Gemfile.lock +171 -0
- data/rails_app/rails_5.2/README.md +24 -0
- data/rails_app/rails_5.2/Rakefile +8 -0
- data/rails_app/rails_5.2/app/controllers/application_controller.rb +4 -0
- data/rails_app/rails_5.2/app/jobs/application_job.rb +4 -0
- data/rails_app/rails_5.2/bin/bundle +5 -0
- data/rails_app/rails_5.2/bin/rails +6 -0
- data/rails_app/rails_5.2/bin/rake +6 -0
- data/rails_app/rails_5.2/bin/setup +27 -0
- data/rails_app/rails_5.2/bin/update +27 -0
- data/rails_app/rails_5.2/config.ru +7 -0
- data/rails_app/rails_5.2/config/application.rb +37 -0
- data/rails_app/rails_5.2/config/boot.rb +6 -0
- data/rails_app/rails_5.2/config/credentials.yml.enc +1 -0
- data/rails_app/rails_5.2/config/environment.rb +7 -0
- data/rails_app/rails_5.2/config/environments/development.rb +41 -0
- data/rails_app/rails_5.2/config/environments/production.rb +70 -0
- data/rails_app/rails_5.2/config/environments/test.rb +38 -0
- data/rails_app/rails_5.2/config/initializers/application_controller_renderer.rb +9 -0
- data/rails_app/rails_5.2/config/initializers/backtrace_silencers.rb +8 -0
- data/rails_app/rails_5.2/config/initializers/cors.rb +17 -0
- data/rails_app/rails_5.2/config/initializers/filter_parameter_logging.rb +6 -0
- data/rails_app/rails_5.2/config/initializers/inflections.rb +17 -0
- data/rails_app/rails_5.2/config/initializers/mime_types.rb +5 -0
- data/rails_app/rails_5.2/config/initializers/wrap_parameters.rb +11 -0
- data/rails_app/rails_5.2/config/locales/en.yml +33 -0
- data/rails_app/rails_5.2/config/routes.rb +5 -0
- data/rails_app/rails_5.2/config/spring.rb +8 -0
- data/rails_app/rails_5.2/public/robots.txt +1 -0
- data/rails_app/rails_5.2/spec/rails_helper.rb +14 -0
- data/rails_app/rails_5.2/spec/spec_helper.rb +13 -0
- data/rails_app/rails_6.0/.rspec +3 -0
- data/rails_app/rails_6.0/Gemfile +17 -0
- data/rails_app/rails_6.0/Gemfile.lock +186 -0
- data/rails_app/rails_6.0/README.md +24 -0
- data/rails_app/rails_6.0/Rakefile +8 -0
- data/rails_app/rails_6.0/app/controllers/application_controller.rb +4 -0
- data/rails_app/rails_6.0/app/jobs/application_job.rb +9 -0
- data/rails_app/rails_6.0/bin/rails +6 -0
- data/rails_app/rails_6.0/bin/rake +6 -0
- data/rails_app/rails_6.0/bin/setup +27 -0
- data/rails_app/rails_6.0/config.ru +7 -0
- data/rails_app/rails_6.0/config/application.rb +39 -0
- data/rails_app/rails_6.0/config/boot.rb +6 -0
- data/rails_app/rails_6.0/config/credentials.yml.enc +1 -0
- data/rails_app/rails_6.0/config/environment.rb +7 -0
- data/rails_app/rails_6.0/config/environments/development.rb +39 -0
- data/rails_app/rails_6.0/config/environments/production.rb +90 -0
- data/rails_app/rails_6.0/config/environments/test.rb +41 -0
- data/rails_app/rails_6.0/config/initializers/application_controller_renderer.rb +9 -0
- data/rails_app/rails_6.0/config/initializers/backtrace_silencers.rb +8 -0
- data/rails_app/rails_6.0/config/initializers/cors.rb +17 -0
- data/rails_app/rails_6.0/config/initializers/filter_parameter_logging.rb +6 -0
- data/rails_app/rails_6.0/config/initializers/inflections.rb +17 -0
- data/rails_app/rails_6.0/config/initializers/mime_types.rb +5 -0
- data/rails_app/rails_6.0/config/initializers/wrap_parameters.rb +11 -0
- data/rails_app/rails_6.0/config/locales/en.yml +33 -0
- data/rails_app/rails_6.0/config/routes.rb +5 -0
- data/rails_app/rails_6.0/config/spring.rb +8 -0
- data/rails_app/rails_6.0/public/robots.txt +1 -0
- data/rails_app/rails_6.0/spec/rails_helper.rb +14 -0
- data/rails_app/rails_6.0/spec/spec_helper.rb +13 -0
- metadata +81 -8
- data/gemfiles/rails_4.2.gemfile +0 -15
- data/renovate.json +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a08284da4d04e40f4e93ae233cb942100a239fafb71c52d733dd443603d7acb
|
4
|
+
data.tar.gz: c33b08cf18b3e3105f57ca01961e421b8f17776dbfa8117f29d4f2a91e26d65f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63799656ee7019c7ff4034c458ef8a8734db81771c514e4d922b4e159b97c30cd51a5833c2378a9ac95a4d2dfb2e516630724a7456f2f72e9935dedd24a8b44c
|
7
|
+
data.tar.gz: a1159d6f2233f1675573235caabe07c5571059092770573e662569e96fd2d0e60221f43f0af7e15151f8f130aade132e1567948b14680cee947df8cc7f3758a2
|
data/.circleci/config.yml
CHANGED
@@ -12,12 +12,12 @@ references:
|
|
12
12
|
- &ruby_version
|
13
13
|
ruby_version:
|
14
14
|
type: enum
|
15
|
-
enum: ['2.
|
15
|
+
enum: ['2.5', '2.6', '2.7']
|
16
16
|
default: '2.7'
|
17
17
|
- &rails_version
|
18
18
|
rails_version:
|
19
19
|
type: enum
|
20
|
-
enum: ['
|
20
|
+
enum: ['5.0', '5.1', '5.2', '6.0']
|
21
21
|
default: '6.0'
|
22
22
|
- &bundler_options
|
23
23
|
bundler_options:
|
@@ -25,18 +25,25 @@ references:
|
|
25
25
|
default: ''
|
26
26
|
|
27
27
|
executors:
|
28
|
-
|
28
|
+
api_executor:
|
29
29
|
parameters:
|
30
30
|
<<: *ruby_version
|
31
31
|
docker:
|
32
|
-
- image: circleci/ruby:<< parameters.ruby_version
|
32
|
+
- image: circleci/ruby:<< parameters.ruby_version >>
|
33
33
|
working_directory: ~/repo/my_api
|
34
|
-
|
34
|
+
gem_executor:
|
35
35
|
parameters:
|
36
36
|
<<: *ruby_version
|
37
37
|
docker:
|
38
|
-
- image: circleci/ruby:<< parameters.ruby_version
|
38
|
+
- image: circleci/ruby:<< parameters.ruby_version >>
|
39
39
|
working_directory: ~/repo
|
40
|
+
rails_executor:
|
41
|
+
parameters:
|
42
|
+
<<: *ruby_version
|
43
|
+
<<: *rails_version
|
44
|
+
docker:
|
45
|
+
- image: circleci/ruby:<< parameters.ruby_version >>
|
46
|
+
working_directory: ~/repo/rails_app/rails_<< parameters.rails_version >>
|
40
47
|
|
41
48
|
commands:
|
42
49
|
modify_active_support_version:
|
@@ -144,18 +151,18 @@ commands:
|
|
144
151
|
path: ~/repo
|
145
152
|
- run:
|
146
153
|
name: Install Bundler 2.x
|
147
|
-
command: gem install bundler
|
154
|
+
command: gem install bundler -v '~> 2.0'
|
148
155
|
- ruby-orbs/bundle-install:
|
149
156
|
cache_key_prefix: v1-dependencies-<< parameters.ruby_version >>
|
150
157
|
bundle_extra_args: << parameters.bundler_options >>
|
151
158
|
restore_bundled_with: false
|
152
159
|
test_and_deploy_for_api:
|
153
|
-
description:
|
160
|
+
description: Test and build the API
|
154
161
|
steps:
|
155
162
|
- run_rspec_for_api
|
156
163
|
- deploy_api_server
|
157
164
|
test_and_build_for_gem:
|
158
|
-
description:
|
165
|
+
description: Test and build the RubyGem
|
159
166
|
parameters:
|
160
167
|
<<: *rails_version
|
161
168
|
steps:
|
@@ -163,13 +170,44 @@ commands:
|
|
163
170
|
rails_version: << parameters.rails_version >>
|
164
171
|
- run_rspec_for_gem
|
165
172
|
- rake_build
|
173
|
+
verify_api_client_generator:
|
174
|
+
description: Verify the API client generator
|
175
|
+
parameters:
|
176
|
+
<<: *rails_version
|
177
|
+
steps:
|
178
|
+
- run:
|
179
|
+
name: Generate new API client files
|
180
|
+
command: |
|
181
|
+
bin/rails g api_client path/to/resource \
|
182
|
+
get:path/to/resource \
|
183
|
+
post:path/to/resource \
|
184
|
+
--endpoint https://example.com/myapi
|
185
|
+
- run:
|
186
|
+
name: Check the API client files exists
|
187
|
+
command: |
|
188
|
+
test -e "app/api_clients/application_api_client.rb" & \
|
189
|
+
test -e "app/api_clients/path/to/resource_api_client.rb" & \
|
190
|
+
test -e "spec/api_clients/path/to/resource_api_client_spec.rb"
|
191
|
+
- run:
|
192
|
+
name: Run rspec with the generated spec file
|
193
|
+
command: bundle exec rspec -f d spec/api_clients/path/to
|
166
194
|
|
167
195
|
jobs:
|
196
|
+
test_api:
|
197
|
+
parameters:
|
198
|
+
<<: *ruby_version
|
199
|
+
executor:
|
200
|
+
name: api_executor
|
201
|
+
ruby_version: << parameters.ruby_version >>
|
202
|
+
steps:
|
203
|
+
- setup:
|
204
|
+
ruby_version: << parameters.ruby_version >>
|
205
|
+
- run_rspec_for_api
|
168
206
|
deploy_api:
|
169
207
|
parameters:
|
170
208
|
<<: *ruby_version
|
171
209
|
executor:
|
172
|
-
name:
|
210
|
+
name: api_executor
|
173
211
|
ruby_version: << parameters.ruby_version >>
|
174
212
|
steps:
|
175
213
|
- setup:
|
@@ -181,7 +219,7 @@ jobs:
|
|
181
219
|
<<: *rails_version
|
182
220
|
<<: *bundler_options
|
183
221
|
executor:
|
184
|
-
name:
|
222
|
+
name: gem_executor
|
185
223
|
ruby_version: << parameters.ruby_version >>
|
186
224
|
steps:
|
187
225
|
- setup:
|
@@ -189,33 +227,46 @@ jobs:
|
|
189
227
|
bundler_options: << parameters.bundler_options >>
|
190
228
|
- test_and_build_for_gem:
|
191
229
|
rails_version: << parameters.rails_version >>
|
230
|
+
verify_generator:
|
231
|
+
parameters:
|
232
|
+
<<: *ruby_version
|
233
|
+
<<: *rails_version
|
234
|
+
executor:
|
235
|
+
name: rails_executor
|
236
|
+
ruby_version: << parameters.ruby_version >>
|
237
|
+
rails_version: << parameters.rails_version >>
|
238
|
+
steps:
|
239
|
+
- setup:
|
240
|
+
ruby_version: << parameters.ruby_version >>
|
241
|
+
- verify_api_client_generator:
|
242
|
+
rails_version: << parameters.rails_version >>
|
192
243
|
upload-coverage:
|
193
|
-
executor:
|
244
|
+
executor: gem_executor
|
194
245
|
steps:
|
195
246
|
- attach_workspace:
|
196
247
|
at: ~/repo
|
197
248
|
- code-climate/install
|
198
249
|
- code-climate/sum-coverage:
|
199
250
|
input: codeclimate.*.json
|
200
|
-
parts:
|
251
|
+
parts: 13
|
201
252
|
- code-climate/upload-coverage
|
202
253
|
rubocop:
|
203
|
-
executor:
|
254
|
+
executor: gem_executor
|
204
255
|
steps:
|
205
256
|
- setup
|
206
257
|
- rubocop
|
207
258
|
yardoc:
|
208
|
-
executor:
|
259
|
+
executor: gem_executor
|
209
260
|
steps:
|
210
261
|
- setup
|
211
262
|
- yardoc
|
212
263
|
rubocop_challenge:
|
213
|
-
executor:
|
264
|
+
executor: gem_executor
|
214
265
|
steps:
|
215
266
|
- checkout
|
216
267
|
- rubocop_challenge
|
217
268
|
release:
|
218
|
-
executor:
|
269
|
+
executor: gem_executor
|
219
270
|
steps:
|
220
271
|
- setup
|
221
272
|
- release
|
@@ -225,26 +276,6 @@ workflows:
|
|
225
276
|
|
226
277
|
commit:
|
227
278
|
jobs:
|
228
|
-
- build_gem:
|
229
|
-
name: build_on_ruby_2.4_and_rails_4.2
|
230
|
-
ruby_version: '2.4'
|
231
|
-
rails_version: '4.2'
|
232
|
-
- build_gem:
|
233
|
-
name: build_on_ruby_2.4_and_rails_5.0
|
234
|
-
ruby_version: '2.4'
|
235
|
-
rails_version: '5.0'
|
236
|
-
- build_gem:
|
237
|
-
name: build_on_ruby_2.4_and_rails_5.1
|
238
|
-
ruby_version: '2.4'
|
239
|
-
rails_version: '5.1'
|
240
|
-
- build_gem:
|
241
|
-
name: build_on_ruby_2.4_and_rails_5.2
|
242
|
-
ruby_version: '2.4'
|
243
|
-
rails_version: '5.2'
|
244
|
-
- build_gem:
|
245
|
-
name: build_on_ruby_2.5_and_rails_4.2
|
246
|
-
ruby_version: '2.5'
|
247
|
-
rails_version: '4.2'
|
248
279
|
- build_gem:
|
249
280
|
name: build_on_ruby_2.5_and_rails_5.0
|
250
281
|
ruby_version: '2.5'
|
@@ -261,10 +292,6 @@ workflows:
|
|
261
292
|
name: build_on_ruby_2.5_and_rails_6.0
|
262
293
|
ruby_version: '2.5'
|
263
294
|
rails_version: '6.0'
|
264
|
-
- build_gem:
|
265
|
-
name: build_on_ruby_2.6_and_rails_4.2
|
266
|
-
ruby_version: '2.6'
|
267
|
-
rails_version: '4.2'
|
268
295
|
- build_gem:
|
269
296
|
name: build_on_ruby_2.6_and_rails_5.0
|
270
297
|
ruby_version: '2.6'
|
@@ -303,20 +330,39 @@ workflows:
|
|
303
330
|
ruby_version: '2.7'
|
304
331
|
rails_version: '6.0'
|
305
332
|
bundler_options: '--without integrations'
|
333
|
+
- verify_generator:
|
334
|
+
name: verify_generator_on_ruby_2.5_and_rails_5.2
|
335
|
+
ruby_version: '2.5'
|
336
|
+
rails_version: '5.2'
|
337
|
+
- verify_generator:
|
338
|
+
name: verify_generator_on_ruby_2.5_and_rails_6.0
|
339
|
+
ruby_version: '2.5'
|
340
|
+
rails_version: '6.0'
|
341
|
+
- verify_generator:
|
342
|
+
name: verify_generator_on_ruby_2.6_and_rails_5.2
|
343
|
+
ruby_version: '2.6'
|
344
|
+
rails_version: '5.2'
|
345
|
+
- verify_generator:
|
346
|
+
name: verify_generator_on_ruby_2.6_and_rails_6.0
|
347
|
+
ruby_version: '2.6'
|
348
|
+
rails_version: '6.0'
|
349
|
+
- verify_generator:
|
350
|
+
name: verify_generator_on_ruby_2.7_and_rails_5.2
|
351
|
+
ruby_version: '2.7'
|
352
|
+
rails_version: '5.2'
|
353
|
+
- verify_generator:
|
354
|
+
name: verify_generator_on_ruby_2.7_and_rails_6.0
|
355
|
+
ruby_version: '2.7'
|
356
|
+
rails_version: '6.0'
|
357
|
+
- test_api
|
306
358
|
- rubocop
|
307
359
|
- yardoc
|
308
360
|
- upload-coverage:
|
309
361
|
requires:
|
310
|
-
- build_on_ruby_2.4_and_rails_4.2
|
311
|
-
- build_on_ruby_2.4_and_rails_5.0
|
312
|
-
- build_on_ruby_2.4_and_rails_5.1
|
313
|
-
- build_on_ruby_2.4_and_rails_5.2
|
314
|
-
- build_on_ruby_2.5_and_rails_4.2
|
315
362
|
- build_on_ruby_2.5_and_rails_5.0
|
316
363
|
- build_on_ruby_2.5_and_rails_5.1
|
317
364
|
- build_on_ruby_2.5_and_rails_5.2
|
318
365
|
- build_on_ruby_2.5_and_rails_6.0
|
319
|
-
- build_on_ruby_2.6_and_rails_4.2
|
320
366
|
- build_on_ruby_2.6_and_rails_5.0
|
321
367
|
- build_on_ruby_2.6_and_rails_5.1
|
322
368
|
- build_on_ruby_2.6_and_rails_5.2
|
@@ -329,16 +375,10 @@ workflows:
|
|
329
375
|
- release:
|
330
376
|
context: RubyGems API Key
|
331
377
|
requires:
|
332
|
-
- build_on_ruby_2.4_and_rails_4.2
|
333
|
-
- build_on_ruby_2.4_and_rails_5.0
|
334
|
-
- build_on_ruby_2.4_and_rails_5.1
|
335
|
-
- build_on_ruby_2.4_and_rails_5.2
|
336
|
-
- build_on_ruby_2.5_and_rails_4.2
|
337
378
|
- build_on_ruby_2.5_and_rails_5.0
|
338
379
|
- build_on_ruby_2.5_and_rails_5.1
|
339
380
|
- build_on_ruby_2.5_and_rails_5.2
|
340
381
|
- build_on_ruby_2.5_and_rails_6.0
|
341
|
-
- build_on_ruby_2.6_and_rails_4.2
|
342
382
|
- build_on_ruby_2.6_and_rails_5.0
|
343
383
|
- build_on_ruby_2.6_and_rails_5.1
|
344
384
|
- build_on_ruby_2.6_and_rails_5.2
|
@@ -348,6 +388,12 @@ workflows:
|
|
348
388
|
- build_on_ruby_2.7_and_rails_5.2
|
349
389
|
- build_on_ruby_2.7_and_rails_6.0_with_integrations
|
350
390
|
- build_on_ruby_2.7_and_rails_6.0_without_integrations
|
391
|
+
- verify_generator_on_ruby_2.5_and_rails_5.2
|
392
|
+
- verify_generator_on_ruby_2.5_and_rails_6.0
|
393
|
+
- verify_generator_on_ruby_2.6_and_rails_5.2
|
394
|
+
- verify_generator_on_ruby_2.6_and_rails_6.0
|
395
|
+
- verify_generator_on_ruby_2.7_and_rails_5.2
|
396
|
+
- verify_generator_on_ruby_2.7_and_rails_6.0
|
351
397
|
- rubocop
|
352
398
|
filters:
|
353
399
|
branches:
|
data/.dependabot/config.yml
CHANGED
@@ -2,9 +2,27 @@ version: 1
|
|
2
2
|
update_configs:
|
3
3
|
- package_manager: "ruby:bundler"
|
4
4
|
directory: "/"
|
5
|
-
update_schedule: "
|
5
|
+
update_schedule: "live"
|
6
6
|
default_reviewers:
|
7
7
|
- "ryz310"
|
8
|
+
default_assignees:
|
9
|
+
- "ryz310"
|
10
|
+
default_labels:
|
11
|
+
- "dependabot"
|
12
|
+
automerged_updates:
|
13
|
+
- match:
|
14
|
+
dependency_type: "development"
|
15
|
+
update_type: "all"
|
16
|
+
- match:
|
17
|
+
dependency_type: "production"
|
18
|
+
update_type: "semver:patch"
|
19
|
+
- package_manager: "ruby:bundler"
|
20
|
+
directory: "/my_api"
|
21
|
+
update_schedule: "live"
|
22
|
+
default_reviewers:
|
23
|
+
- "ryz310"
|
24
|
+
default_assignees:
|
25
|
+
- "ryz310"
|
8
26
|
default_labels:
|
9
27
|
- "dependabot"
|
10
28
|
automerged_updates:
|
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
CHANGED
@@ -1,7 +1,59 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on 2020-02
|
3
|
+
# on 2020-12-02 23:30:30 UTC using RuboCop version 1.5.1.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 5
|
10
|
+
# Configuration parameters: AllowComments, AllowEmptyLambdas.
|
11
|
+
Lint/EmptyBlock:
|
12
|
+
Exclude:
|
13
|
+
- 'lib/my_api_client/rspec/matchers/be_handled_as_an_error.rb'
|
14
|
+
- 'spec/support/complete_about.rb'
|
15
|
+
- 'spec/support/complete_within.rb'
|
16
|
+
|
17
|
+
# Offense count: 5
|
18
|
+
Lint/MissingSuper:
|
19
|
+
Exclude:
|
20
|
+
- 'lib/my_api_client/error_handling/generator.rb'
|
21
|
+
- 'lib/my_api_client/error_handling/retry_option_processor.rb'
|
22
|
+
- 'lib/my_api_client/integrations/bugsnag.rb'
|
23
|
+
- 'lib/my_api_client/request/executor.rb'
|
24
|
+
- 'lib/my_api_client/sleeper.rb'
|
25
|
+
|
26
|
+
# Offense count: 6
|
27
|
+
# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers.
|
28
|
+
# SupportedStyles: snake_case, normalcase, non_integer
|
29
|
+
# AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339
|
30
|
+
Naming/VariableNumber:
|
31
|
+
Exclude:
|
32
|
+
- 'spec/lib/my_api_client/error_handling_spec.rb'
|
33
|
+
- 'spec/lib/my_api_client/request/executor_spec.rb'
|
34
|
+
|
35
|
+
# Offense count: 60
|
36
|
+
# Configuration parameters: AllowSubject.
|
37
|
+
RSpec/MultipleMemoizedHelpers:
|
38
|
+
Max: 15
|
39
|
+
|
40
|
+
# Offense count: 3
|
41
|
+
Style/DocumentDynamicEvalDefinition:
|
42
|
+
Exclude:
|
43
|
+
- 'lib/my_api_client/config.rb'
|
44
|
+
- 'lib/my_api_client/request/basic.rb'
|
45
|
+
- 'lib/my_api_client/request/logger.rb'
|
46
|
+
|
47
|
+
# Offense count: 1
|
48
|
+
# Cop supports --auto-correct.
|
49
|
+
Style/HashTransformValues:
|
50
|
+
Exclude:
|
51
|
+
- 'lib/my_api_client/integrations/bugsnag.rb'
|
52
|
+
|
53
|
+
# Offense count: 3
|
54
|
+
# Cop supports --auto-correct.
|
55
|
+
Style/StringConcatenation:
|
56
|
+
Exclude:
|
57
|
+
- 'lib/my_api_client/request.rb'
|
58
|
+
- 'lib/my_api_client/rspec/matchers/request_to.rb'
|
59
|
+
- 'my_api/app/controllers/pagination_controller.rb'
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,197 @@
|
|
1
1
|
# Change log
|
2
2
|
|
3
|
+
## v0.18.0 (Dec 04, 2020)
|
4
|
+
|
5
|
+
### Feature
|
6
|
+
|
7
|
+
* [#381](https://github.com/ryz310/my_api_client/pull/381) Add endpoint option to the generator ([@ryz310](https://github.com/ryz310))
|
8
|
+
|
9
|
+
### Breaking Change
|
10
|
+
|
11
|
+
* [#365](https://github.com/ryz310/my_api_client/pull/365) End of support for ruby 2.4 and rails 4.2 ([@ryz310](https://github.com/ryz310))
|
12
|
+
|
13
|
+
### Rubocop Challenge
|
14
|
+
|
15
|
+
* [#383](https://github.com/ryz310/my_api_client/pull/383) Re-generate .rubocop_todo.yml with RuboCop v1.5.1 ([@ryz310](https://github.com/ryz310))
|
16
|
+
|
17
|
+
### Dependabot
|
18
|
+
|
19
|
+
* [#338](https://github.com/ryz310/my_api_client/pull/338) ryz310/dependabot/bundler/faraday-1.1.0 ([@ryz310](https://github.com/ryz310))
|
20
|
+
* [#344](https://github.com/ryz310/my_api_client/pull/344) ryz310/dependabot/bundler/bugsnag-6.18.0 ([@ryz310](https://github.com/ryz310))
|
21
|
+
* [#345](https://github.com/ryz310/my_api_client/pull/345) ryz310/dependabot/bundler/rspec-3.10.0 ([@ryz310](https://github.com/ryz310))
|
22
|
+
* [#356](https://github.com/ryz310/my_api_client/pull/356) ryz310/dependabot/bundler/webmock-3.10.0 ([@ryz310](https://github.com/ryz310))
|
23
|
+
* [#369](https://github.com/ryz310/my_api_client/pull/369) ryz310/dependabot/bundler/jsonpath-1.0.6 ([@ryz310](https://github.com/ryz310))
|
24
|
+
* [#376](https://github.com/ryz310/my_api_client/pull/376) ryz310/dependabot/bundler/rubocop-performance-1.9.1 ([@ryz310](https://github.com/ryz310))
|
25
|
+
* [#380](https://github.com/ryz310/my_api_client/pull/380) ryz310/dependabot/bundler/rubocop-rspec-2.0.1 ([@ryz310](https://github.com/ryz310))
|
26
|
+
* [#382](https://github.com/ryz310/my_api_client/pull/382) ryz310/dependabot/bundler/rubocop-1.5.1 ([@ryz310](https://github.com/ryz310))
|
27
|
+
|
28
|
+
## v0.17.0 (Sep 20, 2020)
|
29
|
+
|
30
|
+
### Feature
|
31
|
+
|
32
|
+
* [#303](https://github.com/ryz310/my_api_client/pull/303) Change the duration format to milliseconds ([@ryz310](https://github.com/ryz310))
|
33
|
+
* [#308](https://github.com/ryz310/my_api_client/pull/308) Add testing for api client generators ([@ryz310](https://github.com/ryz310))
|
34
|
+
|
35
|
+
### Rubocop Challenge
|
36
|
+
|
37
|
+
* [#311](https://github.com/ryz310/my_api_client/pull/311) Style/GlobalStdStream-20200906233350 ([@ryz310](https://github.com/ryz310))
|
38
|
+
* [#312](https://github.com/ryz310/my_api_client/pull/312) Style/StringConcatenation-20200907233020 ([@ryz310](https://github.com/ryz310))
|
39
|
+
* [#313](https://github.com/ryz310/my_api_client/pull/313) Style/HashTransformValues-20200908233016 ([@ryz310](https://github.com/ryz310))
|
40
|
+
* [#316](https://github.com/ryz310/my_api_client/pull/316) Layout/EmptyLinesAroundAttributeAccessor-20200909233021 ([@ryz310](https://github.com/ryz310))
|
41
|
+
* [#320](https://github.com/ryz310/my_api_client/pull/320) Re-generate .rubocop_todo.yml with RuboCop v0.91.0 ([@ryz310](https://github.com/ryz310))
|
42
|
+
|
43
|
+
### Dependabot
|
44
|
+
|
45
|
+
* [#299](https://github.com/ryz310/my_api_client/pull/299) ryz310/dependabot/bundler/bugsnag-6.17.0 ([@ryz310](https://github.com/ryz310))
|
46
|
+
* [#310](https://github.com/ryz310/my_api_client/pull/310) ryz310/dependabot/bundler/rubocop-performance-1.8.0 ([@ryz310](https://github.com/ryz310))
|
47
|
+
* [#314](https://github.com/ryz310/my_api_client/pull/314) ryz310/dependabot/bundler/activesupport-5.2.4.4 ([@ryz310](https://github.com/ryz310))
|
48
|
+
* [#315](https://github.com/ryz310/my_api_client/pull/315) ryz310/dependabot/bundler/my_api/actionview-6.0.3.3 ([@ryz310](https://github.com/ryz310))
|
49
|
+
* [#318](https://github.com/ryz310/my_api_client/pull/318) ryz310/dependabot/bundler/webmock-3.9.1 ([@ryz310](https://github.com/ryz310))
|
50
|
+
* [#319](https://github.com/ryz310/my_api_client/pull/319) ryz310/dependabot/bundler/rubocop-0.91.0 ([@ryz310](https://github.com/ryz310))
|
51
|
+
* [#321](https://github.com/ryz310/my_api_client/pull/321) ryz310/dependabot/bundler/my_api/puma-5.0.0 ([@ryz310](https://github.com/ryz310))
|
52
|
+
|
53
|
+
## v0.16.1 (Aug 27, 2020)
|
54
|
+
|
55
|
+
### Feature
|
56
|
+
|
57
|
+
* [#296](https://github.com/ryz310/my_api_client/pull/296) Support HTTP PUT method ([@ryz310](https://github.com/ryz310))
|
58
|
+
|
59
|
+
### Rubocop Challenge
|
60
|
+
|
61
|
+
* [#256](https://github.com/ryz310/my_api_client/pull/256) Performance/StartWith-20200523233027 ([@ryz310](https://github.com/ryz310))
|
62
|
+
* [#268](https://github.com/ryz310/my_api_client/pull/268) Lint/RedundantCopDisableDirective-20200622233019 ([@ryz310](https://github.com/ryz310))
|
63
|
+
* [#289](https://github.com/ryz310/my_api_client/pull/289) Re-generate .rubocop_todo.yml with RuboCop v0.89.1 ([@ryz310](https://github.com/ryz310))
|
64
|
+
* [#293](https://github.com/ryz310/my_api_client/pull/293) RSpec/LeadingSubject-20200817233022 ([@ryz310](https://github.com/ryz310))
|
65
|
+
|
66
|
+
### Dependabot
|
67
|
+
|
68
|
+
* [#232](https://github.com/ryz310/my_api_client/pull/232) ryz310/dependabot/bundler/faraday-1.0.1 ([@ryz310](https://github.com/ryz310))
|
69
|
+
* [#241](https://github.com/ryz310/my_api_client/pull/241) ryz310/dependabot/bundler/my_api/byebug-11.1.3 ([@ryz310](https://github.com/ryz310))
|
70
|
+
* [#243](https://github.com/ryz310/my_api_client/pull/243) ryz310/dependabot/bundler/yard-0.9.25 ([@ryz310](https://github.com/ryz310))
|
71
|
+
* [#248](https://github.com/ryz310/my_api_client/pull/248) ryz310/dependabot/bundler/activesupport-5.2.4.3 ([@ryz310](https://github.com/ryz310))
|
72
|
+
* [#251](https://github.com/ryz310/my_api_client/pull/251) ryz310/dependabot/bundler/my_api/puma-4.3.5 ([@ryz310](https://github.com/ryz310))
|
73
|
+
* [#257](https://github.com/ryz310/my_api_client/pull/257) ryz310/dependabot/bundler/my_api/dynomite-1.2.6 ([@ryz310](https://github.com/ryz310))
|
74
|
+
* [#264](https://github.com/ryz310/my_api_client/pull/264) ryz310/dependabot/bundler/my_api/rack-2.2.3 ([@ryz310](https://github.com/ryz310))
|
75
|
+
* [#265](https://github.com/ryz310/my_api_client/pull/265) ryz310/dependabot/bundler/my_api/actionpack-6.0.3.2 ([@ryz310](https://github.com/ryz310))
|
76
|
+
* [#266](https://github.com/ryz310/my_api_client/pull/266) ryz310/dependabot/bundler/my_api/capybara-3.33.0 ([@ryz310](https://github.com/ryz310))
|
77
|
+
* [#281](https://github.com/ryz310/my_api_client/pull/281) ryz310/dependabot/bundler/rubocop-performance-1.7.1 ([@ryz310](https://github.com/ryz310))
|
78
|
+
* [#287](https://github.com/ryz310/my_api_client/pull/287) ryz310/dependabot/bundler/my_api/kramdown-2.3.0 ([@ryz310](https://github.com/ryz310))
|
79
|
+
* [#290](https://github.com/ryz310/my_api_client/pull/290) ryz310/dependabot/bundler/bugsnag-6.16.0 ([@ryz310](https://github.com/ryz310))
|
80
|
+
* [#294](https://github.com/ryz310/my_api_client/pull/294) ryz310/dependabot/bundler/my_api/jets-2.3.17 ([@ryz310](https://github.com/ryz310))
|
81
|
+
* [#295](https://github.com/ryz310/my_api_client/pull/295) ryz310/dependabot/bundler/rubocop-rspec-1.43.2 ([@ryz310](https://github.com/ryz310))
|
82
|
+
|
83
|
+
### Misc
|
84
|
+
|
85
|
+
* [#271](https://github.com/ryz310/my_api_client/pull/271) Minor fixes ([@ryz310](https://github.com/ryz310))
|
86
|
+
|
87
|
+
## v0.16.0 (Mar 29, 2020)
|
88
|
+
|
89
|
+
### Breaking Change
|
90
|
+
|
91
|
+
#### [#225](https://github.com/ryz310/my_api_client/pull/225) Raise an exception whenever an error is detected ([@ryz310](https://github.com/ryz310))
|
92
|
+
|
93
|
+
Until now, using `with` or `block` in `error_handling` did not automatically raise an exception, but will now always raise an exception when an error is detected.
|
94
|
+
You can specify raising error class with `raise` option.
|
95
|
+
|
96
|
+
**Before**
|
97
|
+
|
98
|
+
```rb
|
99
|
+
error_handling json: { '$.errors.code': 10..19 }, with: :my_error_handling
|
100
|
+
|
101
|
+
def my_error_handling
|
102
|
+
# Executes this method when an error is detected.
|
103
|
+
# No exception is raised. You can raise an error if necessary.
|
104
|
+
end
|
105
|
+
```
|
106
|
+
```rb
|
107
|
+
error_handling status_code: 500..599 do |_params, logger|
|
108
|
+
# Executes this block when an error is detected.
|
109
|
+
# No exception is raised. You can raise an error if necessary.
|
110
|
+
end
|
111
|
+
```
|
112
|
+
|
113
|
+
**After**
|
114
|
+
|
115
|
+
```rb
|
116
|
+
error_handling json: { '$.errors.code': 10..19 }, with: :my_error_handling
|
117
|
+
|
118
|
+
def my_error_handling
|
119
|
+
# Executes this method when an error is detected.
|
120
|
+
# And then raise `MyApiClient::Error`.
|
121
|
+
end
|
122
|
+
```
|
123
|
+
```rb
|
124
|
+
error_handling status_code: 500..599 do |params, logger|
|
125
|
+
# Executes this block when an error is detected.
|
126
|
+
# And then raise `MyApiClient::Error`.
|
127
|
+
end
|
128
|
+
```
|
129
|
+
|
130
|
+
#### [#226](https://github.com/ryz310/my_api_client/pull/226) Default error handlers ([@ryz310](https://github.com/ryz310))
|
131
|
+
|
132
|
+
Until now, you needed define all `error_handling` or `retry_on` yourself. But will now some `error_handling` and `retry_on` are prepared as default.
|
133
|
+
|
134
|
+
You can check default `error_handling` or `retry_on` here.
|
135
|
+
|
136
|
+
See: https://github.com/ryz310/my_api_client/blob/master/lib/my_api_client/default_error_handlers.rb
|
137
|
+
|
138
|
+
### Dependabot
|
139
|
+
|
140
|
+
* [#227](https://github.com/ryz310/my_api_client/pull/227) ryz310/dependabot/bundler/pry-byebug-3.9.0 ([@ryz310](https://github.com/ryz310))
|
141
|
+
* [#228](https://github.com/ryz310/my_api_client/pull/228) ryz310/dependabot/bundler/my_api/jets-2.3.15 ([@ryz310](https://github.com/ryz310))
|
142
|
+
|
143
|
+
### Misc
|
144
|
+
|
145
|
+
* [#229](https://github.com/ryz310/my_api_client/pull/229) Edit dependabot configuration ([@ryz310](https://github.com/ryz310))
|
146
|
+
|
147
|
+
## v0.15.0 (Mar 21, 2020)
|
148
|
+
|
149
|
+
### Feature
|
150
|
+
|
151
|
+
* [#220](https://github.com/ryz310/my_api_client/pull/220) Pageable HTTP request ([@ryz310](https://github.com/ryz310))
|
152
|
+
* Add `#pageable_get` method (alias: `#pget`)
|
153
|
+
* For example:
|
154
|
+
* API client definition
|
155
|
+
```ruby
|
156
|
+
class MyPaginationApiClient < ApplicationApiClient
|
157
|
+
endpoint 'https://example.com/v1'
|
158
|
+
|
159
|
+
# GET pagination?page=1
|
160
|
+
def pagination
|
161
|
+
pageable_get 'pagination', paging: '$.links.next', headers: headers, query: { page: 1 }
|
162
|
+
end
|
163
|
+
|
164
|
+
private
|
165
|
+
|
166
|
+
def headers
|
167
|
+
{ 'Content-Type': 'application/json;charset=UTF-8' }
|
168
|
+
end
|
169
|
+
end
|
170
|
+
```
|
171
|
+
* The pagination API response
|
172
|
+
```json
|
173
|
+
{
|
174
|
+
"links": {
|
175
|
+
"next": "https://example.com/pagination?page=3",
|
176
|
+
"previous": "https://example.com/pagination?page=1",
|
177
|
+
},
|
178
|
+
"page": 2
|
179
|
+
}
|
180
|
+
```
|
181
|
+
* Usage
|
182
|
+
```ruby
|
183
|
+
api_clinet = MyPaginationApiClient.new
|
184
|
+
api_clinet.pagination.each do |response|
|
185
|
+
# Do something.
|
186
|
+
end
|
187
|
+
|
188
|
+
p = api_clinet.pagination
|
189
|
+
p.next # => 1st page result
|
190
|
+
p.next # => 2nd page result
|
191
|
+
p.next # => 3rd page result
|
192
|
+
```
|
193
|
+
* [#223](https://github.com/ryz310/my_api_client/pull/223) Use Enumerator::Lazy instead of Enumerator ([@ryz310](https://github.com/ryz310))
|
194
|
+
|
3
195
|
## v0.14.0 (Mar 14, 2020)
|
4
196
|
|
5
197
|
### Feature
|