my_api_client 0.13.0 → 0.16.1
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 +102 -36
- data/.dependabot/config.yml +34 -0
- data/.envrc.skeleton +1 -0
- data/.rubocop.yml +8 -10
- data/.rubocop_challenge.yml +3 -0
- data/.rubocop_todo.yml +5 -10
- data/CHANGELOG.md +229 -0
- data/Gemfile.lock +48 -43
- data/README.jp.md +98 -23
- data/bin/console +4 -0
- data/example/api_clients/application_api_client.rb +13 -0
- data/example/api_clients/my_error_api_client.rb +34 -0
- data/example/api_clients/my_errors.rb +27 -0
- data/example/api_clients/my_pagination_api_client.rb +18 -0
- data/example/api_clients/my_rest_api_client.rb +48 -0
- data/example/api_clients/my_status_api_client.rb +22 -0
- data/lib/generators/rails/templates/application_api_client.rb.erb +0 -11
- data/lib/my_api_client.rb +10 -2
- data/lib/my_api_client/base.rb +2 -18
- data/lib/my_api_client/config.rb +0 -29
- data/lib/my_api_client/default_error_handlers.rb +64 -0
- data/lib/my_api_client/error_handling.rb +13 -23
- data/lib/my_api_client/error_handling/generator.rb +30 -10
- data/lib/my_api_client/error_handling/{process_retry_option.rb → retry_option_processor.rb} +1 -1
- data/lib/my_api_client/errors.rb +0 -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/request.rb +7 -10
- data/lib/my_api_client/request.rb +48 -70
- data/lib/my_api_client/request/basic.rb +32 -0
- data/lib/my_api_client/request/executor.rb +89 -0
- data/lib/my_api_client/request/logger.rb +37 -0
- data/lib/my_api_client/request/pagination.rb +39 -0
- data/lib/my_api_client/rspec/matcher_helper.rb +2 -2
- data/lib/my_api_client/rspec/matchers/be_handled_as_an_error.rb +2 -0
- data/lib/my_api_client/rspec/matchers/request_to.rb +3 -4
- data/lib/my_api_client/version.rb +1 -1
- data/my_api/.envrc.skeleton +3 -0
- data/my_api/.gitignore +14 -0
- data/my_api/.jetskeep +1 -0
- data/my_api/.rspec +3 -0
- data/my_api/.ruby-version +1 -0
- data/my_api/Gemfile +23 -0
- data/my_api/Gemfile.lock +243 -0
- data/my_api/Procfile +7 -0
- data/my_api/README.md +54 -0
- data/my_api/Rakefile +4 -0
- data/my_api/app/controllers/application_controller.rb +5 -0
- data/my_api/app/controllers/error_controller.rb +21 -0
- data/my_api/app/controllers/pagination_controller.rb +58 -0
- data/my_api/app/controllers/rest_controller.rb +60 -0
- data/my_api/app/controllers/status_controller.rb +11 -0
- data/my_api/app/helpers/application_helper.rb +5 -0
- data/my_api/app/jobs/application_job.rb +7 -0
- data/my_api/app/models/application_item.rb +5 -0
- data/my_api/config.ru +7 -0
- data/my_api/config/application.rb +73 -0
- data/my_api/config/dynamodb.yml +22 -0
- data/my_api/config/environments/development.rb +9 -0
- data/my_api/config/environments/production.rb +11 -0
- data/my_api/config/environments/test.rb +9 -0
- data/my_api/config/routes.rb +17 -0
- data/my_api/db/.gitkeep +0 -0
- data/my_api/public/404.html +67 -0
- data/my_api/public/422.html +67 -0
- data/my_api/public/500.html +66 -0
- data/my_api/public/favicon.ico +0 -0
- data/my_api/public/index.html +91 -0
- data/my_api/spec/controllers/error_controller_spec.rb +43 -0
- data/my_api/spec/controllers/pagination_controller_spec.rb +73 -0
- data/my_api/spec/controllers/rest_controller_spec.rb +99 -0
- data/my_api/spec/controllers/status_controller_spec.rb +47 -0
- data/my_api/spec/fixtures/payloads/posts-index.json +51 -0
- data/my_api/spec/fixtures/payloads/posts-show.json +53 -0
- data/my_api/spec/spec_helper.rb +31 -0
- data/my_api_client.gemspec +1 -1
- metadata +62 -9
- data/lib/my_api_client/logger.rb +0 -36
- data/renovate.json +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1eb52f8cf1220f7a0db30d5a6f83a8ef880315d6f23f878103ea234812c4071e
|
4
|
+
data.tar.gz: d6176d4ea51df4d2486be4150055b05b60ded0d674c937c61bc46dc9df79f0a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4bfcd9f62258c714797b9234959f53b2c84c2bc7c651d8ea6b4ba8ce2a6750c8528c8cd33ee842f090c01414c65028d0e8c412a2ec3e425b9382984f632cda37
|
7
|
+
data.tar.gz: 6f48b2d64393db7ca69da8e68236c095f5bf94fd424e87cd805cb264a09e616782816d7b83308b512d6e45a3f500b6c85f1a2f93e2ef6b96cb2a23d486909561
|
data/.circleci/config.yml
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
version: 2.1
|
6
6
|
|
7
7
|
orbs:
|
8
|
-
ruby-orbs: sue445/ruby-orbs@1.
|
8
|
+
ruby-orbs: sue445/ruby-orbs@1.6.0
|
9
9
|
code-climate: rvla/code-climate@0.0.2
|
10
10
|
|
11
11
|
references:
|
@@ -25,7 +25,13 @@ references:
|
|
25
25
|
default: ''
|
26
26
|
|
27
27
|
executors:
|
28
|
-
|
28
|
+
executor_for_api:
|
29
|
+
parameters:
|
30
|
+
<<: *ruby_version
|
31
|
+
docker:
|
32
|
+
- image: circleci/ruby:<< parameters.ruby_version >>-node-browsers
|
33
|
+
working_directory: ~/repo/my_api
|
34
|
+
executor_for_gem:
|
29
35
|
parameters:
|
30
36
|
<<: *ruby_version
|
31
37
|
docker:
|
@@ -41,8 +47,28 @@ commands:
|
|
41
47
|
- run: |
|
42
48
|
cp gemfiles/rails_<< parameters.rails_version >>.gemfile Gemfile
|
43
49
|
bundle update activesupport
|
44
|
-
|
45
|
-
description: Run RSpec
|
50
|
+
run_rspec_for_api:
|
51
|
+
description: Run RSpec for the API
|
52
|
+
steps:
|
53
|
+
- run:
|
54
|
+
name: Execute RSpec
|
55
|
+
command: |
|
56
|
+
bundle exec rspec --format documentation \
|
57
|
+
--color \
|
58
|
+
--format RspecJunitFormatter
|
59
|
+
deploy_api_server:
|
60
|
+
description: Deploy the API server on the AWS
|
61
|
+
steps:
|
62
|
+
- run:
|
63
|
+
name: Install RSync
|
64
|
+
command: sudo apt-get install -y rsync
|
65
|
+
- run:
|
66
|
+
# This command is not currently work. It could't reference uploaded gem file.
|
67
|
+
# You can execute `$ bundle exec jets deploy` on your local.
|
68
|
+
name: Deploy the API server with jets
|
69
|
+
command: JETS_AGREE=yes bundle exec jets deploy
|
70
|
+
run_rspec_for_gem:
|
71
|
+
description: Run RSpec for the gem
|
46
72
|
steps:
|
47
73
|
- code-climate/install
|
48
74
|
- run:
|
@@ -114,40 +140,67 @@ commands:
|
|
114
140
|
<<: *ruby_version
|
115
141
|
<<: *bundler_options
|
116
142
|
steps:
|
117
|
-
- checkout
|
143
|
+
- checkout:
|
144
|
+
path: ~/repo
|
118
145
|
- run:
|
119
146
|
name: Install Bundler 2.x
|
120
147
|
command: gem install bundler:2.1.2
|
121
148
|
- ruby-orbs/bundle-install:
|
122
149
|
cache_key_prefix: v1-dependencies-<< parameters.ruby_version >>
|
123
150
|
bundle_extra_args: << parameters.bundler_options >>
|
124
|
-
|
151
|
+
restore_bundled_with: false
|
152
|
+
test_and_deploy_for_api:
|
153
|
+
description: Build the API
|
154
|
+
steps:
|
155
|
+
- run_rspec_for_api
|
156
|
+
- deploy_api_server
|
157
|
+
test_and_build_for_gem:
|
125
158
|
description: Build the RubyGem
|
126
159
|
parameters:
|
127
160
|
<<: *rails_version
|
128
161
|
steps:
|
129
162
|
- modify_active_support_version:
|
130
163
|
rails_version: << parameters.rails_version >>
|
131
|
-
-
|
164
|
+
- run_rspec_for_gem
|
132
165
|
- rake_build
|
133
166
|
|
134
167
|
jobs:
|
135
|
-
|
168
|
+
test_api:
|
169
|
+
parameters:
|
170
|
+
<<: *ruby_version
|
171
|
+
executor:
|
172
|
+
name: executor_for_api
|
173
|
+
ruby_version: << parameters.ruby_version >>
|
174
|
+
steps:
|
175
|
+
- setup:
|
176
|
+
ruby_version: << parameters.ruby_version >>
|
177
|
+
- run_rspec_for_api
|
178
|
+
deploy_api:
|
179
|
+
parameters:
|
180
|
+
<<: *ruby_version
|
181
|
+
executor:
|
182
|
+
name: executor_for_api
|
183
|
+
ruby_version: << parameters.ruby_version >>
|
184
|
+
steps:
|
185
|
+
- setup:
|
186
|
+
ruby_version: << parameters.ruby_version >>
|
187
|
+
- test_and_deploy_for_api
|
188
|
+
build_gem:
|
136
189
|
parameters:
|
137
190
|
<<: *ruby_version
|
138
191
|
<<: *rails_version
|
139
192
|
<<: *bundler_options
|
140
193
|
executor:
|
141
|
-
name:
|
194
|
+
name: executor_for_gem
|
142
195
|
ruby_version: << parameters.ruby_version >>
|
143
196
|
steps:
|
144
197
|
- setup:
|
145
198
|
ruby_version: << parameters.ruby_version >>
|
146
199
|
bundler_options: << parameters.bundler_options >>
|
147
|
-
-
|
200
|
+
- test_and_build_for_gem:
|
148
201
|
rails_version: << parameters.rails_version >>
|
149
202
|
upload-coverage:
|
150
|
-
executor:
|
203
|
+
executor: executor_for_gem
|
151
204
|
steps:
|
152
205
|
- attach_workspace:
|
153
206
|
at: ~/repo
|
@@ -157,22 +210,22 @@ jobs:
|
|
157
210
|
parts: 19
|
158
211
|
- code-climate/upload-coverage
|
159
212
|
rubocop:
|
160
|
-
executor:
|
213
|
+
executor: executor_for_gem
|
161
214
|
steps:
|
162
215
|
- setup
|
163
216
|
- rubocop
|
164
217
|
yardoc:
|
165
|
-
executor:
|
218
|
+
executor: executor_for_gem
|
166
219
|
steps:
|
167
220
|
- setup
|
168
221
|
- yardoc
|
169
222
|
rubocop_challenge:
|
170
|
-
executor:
|
223
|
+
executor: executor_for_gem
|
171
224
|
steps:
|
172
225
|
- checkout
|
173
226
|
- rubocop_challenge
|
174
227
|
release:
|
175
|
-
executor:
|
228
|
+
executor: executor_for_gem
|
176
229
|
steps:
|
177
230
|
- setup
|
178
231
|
- release
|
@@ -182,84 +235,85 @@ workflows:
|
|
182
235
|
|
183
236
|
commit:
|
184
237
|
jobs:
|
185
|
-
-
|
238
|
+
- build_gem:
|
186
239
|
name: build_on_ruby_2.4_and_rails_4.2
|
187
240
|
ruby_version: '2.4'
|
188
241
|
rails_version: '4.2'
|
189
|
-
-
|
242
|
+
- build_gem:
|
190
243
|
name: build_on_ruby_2.4_and_rails_5.0
|
191
244
|
ruby_version: '2.4'
|
192
245
|
rails_version: '5.0'
|
193
|
-
-
|
246
|
+
- build_gem:
|
194
247
|
name: build_on_ruby_2.4_and_rails_5.1
|
195
248
|
ruby_version: '2.4'
|
196
249
|
rails_version: '5.1'
|
197
|
-
-
|
250
|
+
- build_gem:
|
198
251
|
name: build_on_ruby_2.4_and_rails_5.2
|
199
252
|
ruby_version: '2.4'
|
200
253
|
rails_version: '5.2'
|
201
|
-
-
|
254
|
+
- build_gem:
|
202
255
|
name: build_on_ruby_2.5_and_rails_4.2
|
203
256
|
ruby_version: '2.5'
|
204
257
|
rails_version: '4.2'
|
205
|
-
-
|
258
|
+
- build_gem:
|
206
259
|
name: build_on_ruby_2.5_and_rails_5.0
|
207
260
|
ruby_version: '2.5'
|
208
261
|
rails_version: '5.0'
|
209
|
-
-
|
262
|
+
- build_gem:
|
210
263
|
name: build_on_ruby_2.5_and_rails_5.1
|
211
264
|
ruby_version: '2.5'
|
212
265
|
rails_version: '5.1'
|
213
|
-
-
|
266
|
+
- build_gem:
|
214
267
|
name: build_on_ruby_2.5_and_rails_5.2
|
215
268
|
ruby_version: '2.5'
|
216
269
|
rails_version: '5.2'
|
217
|
-
-
|
270
|
+
- build_gem:
|
218
271
|
name: build_on_ruby_2.5_and_rails_6.0
|
219
272
|
ruby_version: '2.5'
|
220
273
|
rails_version: '6.0'
|
221
|
-
-
|
274
|
+
- build_gem:
|
222
275
|
name: build_on_ruby_2.6_and_rails_4.2
|
223
276
|
ruby_version: '2.6'
|
224
277
|
rails_version: '4.2'
|
225
|
-
-
|
278
|
+
- build_gem:
|
226
279
|
name: build_on_ruby_2.6_and_rails_5.0
|
227
280
|
ruby_version: '2.6'
|
228
281
|
rails_version: '5.0'
|
229
|
-
-
|
282
|
+
- build_gem:
|
230
283
|
name: build_on_ruby_2.6_and_rails_5.1
|
231
284
|
ruby_version: '2.6'
|
232
285
|
rails_version: '5.1'
|
233
|
-
-
|
286
|
+
- build_gem:
|
234
287
|
name: build_on_ruby_2.6_and_rails_5.2
|
235
288
|
ruby_version: '2.6'
|
236
289
|
rails_version: '5.2'
|
237
|
-
-
|
290
|
+
- build_gem:
|
238
291
|
name: build_on_ruby_2.6_and_rails_6.0
|
239
292
|
ruby_version: '2.6'
|
240
293
|
rails_version: '6.0'
|
241
|
-
-
|
294
|
+
- build_gem:
|
242
295
|
name: build_on_ruby_2.7_and_rails_5.0
|
243
296
|
ruby_version: '2.7'
|
244
297
|
rails_version: '5.0'
|
245
|
-
-
|
298
|
+
- build_gem:
|
246
299
|
name: build_on_ruby_2.7_and_rails_5.1
|
247
300
|
ruby_version: '2.7'
|
248
301
|
rails_version: '5.1'
|
249
|
-
-
|
302
|
+
- build_gem:
|
250
303
|
name: build_on_ruby_2.7_and_rails_5.2
|
251
304
|
ruby_version: '2.7'
|
252
305
|
rails_version: '5.2'
|
253
|
-
-
|
306
|
+
- build_gem:
|
254
307
|
name: build_on_ruby_2.7_and_rails_6.0_with_integrations
|
255
308
|
ruby_version: '2.7'
|
256
309
|
rails_version: '6.0'
|
257
310
|
bundler_options: '--with integrations'
|
258
|
-
-
|
311
|
+
- build_gem:
|
259
312
|
name: build_on_ruby_2.7_and_rails_6.0_without_integrations
|
260
313
|
ruby_version: '2.7'
|
261
314
|
rails_version: '6.0'
|
262
315
|
bundler_options: '--without integrations'
|
316
|
+
- test_api
|
263
317
|
- rubocop
|
264
318
|
- yardoc
|
265
319
|
- upload-coverage:
|
@@ -317,11 +371,23 @@ workflows:
|
|
317
371
|
cron: "30 23 * * *" # 8:30am every day (JST)
|
318
372
|
filters:
|
319
373
|
branches:
|
320
|
-
only:
|
321
|
-
- master
|
374
|
+
only: [master]
|
322
375
|
jobs:
|
323
376
|
- rubocop_challenge
|
324
377
|
|
378
|
+
# deploy_api_server:
|
379
|
+
# triggers:
|
380
|
+
# - schedule:
|
381
|
+
# cron: "0 12 * * *" # 3:00am every day (JST)
|
382
|
+
# filters:
|
383
|
+
# branches:
|
384
|
+
# only: [master]
|
385
|
+
# jobs:
|
386
|
+
# - deploy_api:
|
387
|
+
# ruby_version: '2.5'
|
388
|
+
# - build_gem:
|
389
|
+
# requires: [deploy_api]
|
390
|
+
|
325
391
|
experimental:
|
326
392
|
notify:
|
327
393
|
branches:
|
@@ -0,0 +1,34 @@
|
|
1
|
+
version: 1
|
2
|
+
update_configs:
|
3
|
+
- package_manager: "ruby:bundler"
|
4
|
+
directory: "/"
|
5
|
+
update_schedule: "live"
|
6
|
+
default_reviewers:
|
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"
|
26
|
+
default_labels:
|
27
|
+
- "dependabot"
|
28
|
+
automerged_updates:
|
29
|
+
- match:
|
30
|
+
dependency_type: "development"
|
31
|
+
update_type: "all"
|
32
|
+
- match:
|
33
|
+
dependency_type: "production"
|
34
|
+
update_type: "semver:patch"
|
data/.envrc.skeleton
CHANGED
data/.rubocop.yml
CHANGED
@@ -7,28 +7,25 @@ inherit_from: .rubocop_todo.yml
|
|
7
7
|
AllCops:
|
8
8
|
TargetRubyVersion: 2.4
|
9
9
|
|
10
|
-
|
11
|
-
Max:
|
10
|
+
Layout/LineLength:
|
11
|
+
Max: 100
|
12
|
+
Exclude:
|
13
|
+
- my_api/config/application.rb
|
12
14
|
|
13
15
|
Metrics/BlockLength:
|
14
|
-
Max: 50
|
15
16
|
Exclude:
|
16
17
|
- 'my_api_client.gemspec'
|
17
18
|
- 'lib/my_api_client/rspec/matchers/**/*'
|
18
19
|
- 'spec/**/*'
|
20
|
+
- 'my_api/spec/**/*'
|
19
21
|
|
20
22
|
Metrics/MethodLength:
|
21
23
|
Max: 15
|
22
24
|
|
23
|
-
Metrics/LineLength:
|
24
|
-
Max: 100
|
25
|
-
|
26
25
|
Naming/AccessorMethodName:
|
27
|
-
Enabled: false
|
28
|
-
|
29
|
-
Style/ClassAndModuleChildren:
|
30
26
|
Exclude:
|
31
|
-
-
|
27
|
+
- example/api_clients/**/*
|
28
|
+
- spec/lib/my_api_client/rspec/matchers/be_handled_as_an_error_spec.rb
|
32
29
|
|
33
30
|
Style/TrailingCommaInArrayLiteral:
|
34
31
|
EnforcedStyleForMultiline: comma
|
@@ -38,6 +35,7 @@ Style/TrailingCommaInHashLiteral:
|
|
38
35
|
|
39
36
|
RSpec/DescribeClass:
|
40
37
|
Exclude:
|
38
|
+
- 'spec/integrations/api_clients/**/*'
|
41
39
|
- 'spec/lib/my_api_client/rspec/matchers/**/*'
|
42
40
|
|
43
41
|
RSpec/ExampleLength:
|
data/.rubocop_todo.yml
CHANGED
@@ -1,17 +1,12 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on 2020-
|
3
|
+
# on 2020-08-17 23:30:51 UTC using RuboCop version 0.89.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
8
|
|
9
|
-
# Offense count:
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
- 'spec/lib/my_api_client/config_spec.rb'
|
14
|
-
- 'spec/lib/my_api_client/error_handling_spec.rb'
|
15
|
-
- 'spec/lib/my_api_client/exceptions_spec.rb'
|
16
|
-
- 'spec/lib/my_api_client/request_spec.rb'
|
17
|
-
- 'spec/lib/my_api_client/rspec/stub_spec.rb'
|
9
|
+
# Offense count: 60
|
10
|
+
# Configuration parameters: AllowSubject.
|
11
|
+
RSpec/MultipleMemoizedHelpers:
|
12
|
+
Max: 15
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,234 @@
|
|
1
1
|
# Change log
|
2
2
|
|
3
|
+
## v0.16.1 (Aug 27, 2020)
|
4
|
+
|
5
|
+
### Feature
|
6
|
+
|
7
|
+
* [#296](https://github.com/ryz310/my_api_client/pull/296) Support HTTP PUT method ([@ryz310](https://github.com/ryz310))
|
8
|
+
|
9
|
+
### Rubocop Challenge
|
10
|
+
|
11
|
+
* [#256](https://github.com/ryz310/my_api_client/pull/256) Performance/StartWith-20200523233027 ([@ryz310](https://github.com/ryz310))
|
12
|
+
* [#268](https://github.com/ryz310/my_api_client/pull/268) Lint/RedundantCopDisableDirective-20200622233019 ([@ryz310](https://github.com/ryz310))
|
13
|
+
* [#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))
|
14
|
+
* [#293](https://github.com/ryz310/my_api_client/pull/293) RSpec/LeadingSubject-20200817233022 ([@ryz310](https://github.com/ryz310))
|
15
|
+
|
16
|
+
### Dependabot
|
17
|
+
|
18
|
+
* [#232](https://github.com/ryz310/my_api_client/pull/232) ryz310/dependabot/bundler/faraday-1.0.1 ([@ryz310](https://github.com/ryz310))
|
19
|
+
* [#241](https://github.com/ryz310/my_api_client/pull/241) ryz310/dependabot/bundler/my_api/byebug-11.1.3 ([@ryz310](https://github.com/ryz310))
|
20
|
+
* [#243](https://github.com/ryz310/my_api_client/pull/243) ryz310/dependabot/bundler/yard-0.9.25 ([@ryz310](https://github.com/ryz310))
|
21
|
+
* [#248](https://github.com/ryz310/my_api_client/pull/248) ryz310/dependabot/bundler/activesupport-5.2.4.3 ([@ryz310](https://github.com/ryz310))
|
22
|
+
* [#251](https://github.com/ryz310/my_api_client/pull/251) ryz310/dependabot/bundler/my_api/puma-4.3.5 ([@ryz310](https://github.com/ryz310))
|
23
|
+
* [#257](https://github.com/ryz310/my_api_client/pull/257) ryz310/dependabot/bundler/my_api/dynomite-1.2.6 ([@ryz310](https://github.com/ryz310))
|
24
|
+
* [#264](https://github.com/ryz310/my_api_client/pull/264) ryz310/dependabot/bundler/my_api/rack-2.2.3 ([@ryz310](https://github.com/ryz310))
|
25
|
+
* [#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))
|
26
|
+
* [#266](https://github.com/ryz310/my_api_client/pull/266) ryz310/dependabot/bundler/my_api/capybara-3.33.0 ([@ryz310](https://github.com/ryz310))
|
27
|
+
* [#281](https://github.com/ryz310/my_api_client/pull/281) ryz310/dependabot/bundler/rubocop-performance-1.7.1 ([@ryz310](https://github.com/ryz310))
|
28
|
+
* [#287](https://github.com/ryz310/my_api_client/pull/287) ryz310/dependabot/bundler/my_api/kramdown-2.3.0 ([@ryz310](https://github.com/ryz310))
|
29
|
+
* [#290](https://github.com/ryz310/my_api_client/pull/290) ryz310/dependabot/bundler/bugsnag-6.16.0 ([@ryz310](https://github.com/ryz310))
|
30
|
+
* [#294](https://github.com/ryz310/my_api_client/pull/294) ryz310/dependabot/bundler/my_api/jets-2.3.17 ([@ryz310](https://github.com/ryz310))
|
31
|
+
* [#295](https://github.com/ryz310/my_api_client/pull/295) ryz310/dependabot/bundler/rubocop-rspec-1.43.2 ([@ryz310](https://github.com/ryz310))
|
32
|
+
|
33
|
+
### Misc
|
34
|
+
|
35
|
+
* [#271](https://github.com/ryz310/my_api_client/pull/271) Minor fixes ([@ryz310](https://github.com/ryz310))
|
36
|
+
|
37
|
+
## v0.16.0 (Mar 29, 2020)
|
38
|
+
|
39
|
+
### Breaking Change
|
40
|
+
|
41
|
+
#### [#225](https://github.com/ryz310/my_api_client/pull/225) Raise an exception whenever an error is detected ([@ryz310](https://github.com/ryz310))
|
42
|
+
|
43
|
+
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.
|
44
|
+
You can specify raising error class with `raise` option.
|
45
|
+
|
46
|
+
**Before**
|
47
|
+
|
48
|
+
```rb
|
49
|
+
error_handling json: { '$.errors.code': 10..19 }, with: :my_error_handling
|
50
|
+
|
51
|
+
def my_error_handling
|
52
|
+
# Executes this method when an error is detected.
|
53
|
+
# No exception is raised. You can raise an error if necessary.
|
54
|
+
end
|
55
|
+
```
|
56
|
+
```rb
|
57
|
+
error_handling status_code: 500..599 do |_params, logger|
|
58
|
+
# Executes this block when an error is detected.
|
59
|
+
# No exception is raised. You can raise an error if necessary.
|
60
|
+
end
|
61
|
+
```
|
62
|
+
|
63
|
+
**After**
|
64
|
+
|
65
|
+
```rb
|
66
|
+
error_handling json: { '$.errors.code': 10..19 }, with: :my_error_handling
|
67
|
+
|
68
|
+
def my_error_handling
|
69
|
+
# Executes this method when an error is detected.
|
70
|
+
# And then raise `MyApiClient::Error`.
|
71
|
+
end
|
72
|
+
```
|
73
|
+
```rb
|
74
|
+
error_handling status_code: 500..599 do |params, logger|
|
75
|
+
# Executes this block when an error is detected.
|
76
|
+
# And then raise `MyApiClient::Error`.
|
77
|
+
end
|
78
|
+
```
|
79
|
+
|
80
|
+
#### [#226](https://github.com/ryz310/my_api_client/pull/226) Default error handlers ([@ryz310](https://github.com/ryz310))
|
81
|
+
|
82
|
+
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.
|
83
|
+
|
84
|
+
You can check default `error_handling` or `retry_on` here.
|
85
|
+
|
86
|
+
See: https://github.com/ryz310/my_api_client/blob/master/lib/my_api_client/default_error_handlers.rb
|
87
|
+
|
88
|
+
### Dependabot
|
89
|
+
|
90
|
+
* [#227](https://github.com/ryz310/my_api_client/pull/227) ryz310/dependabot/bundler/pry-byebug-3.9.0 ([@ryz310](https://github.com/ryz310))
|
91
|
+
* [#228](https://github.com/ryz310/my_api_client/pull/228) ryz310/dependabot/bundler/my_api/jets-2.3.15 ([@ryz310](https://github.com/ryz310))
|
92
|
+
|
93
|
+
### Misc
|
94
|
+
|
95
|
+
* [#229](https://github.com/ryz310/my_api_client/pull/229) Edit dependabot configuration ([@ryz310](https://github.com/ryz310))
|
96
|
+
|
97
|
+
## v0.15.0 (Mar 21, 2020)
|
98
|
+
|
99
|
+
### Feature
|
100
|
+
|
101
|
+
* [#220](https://github.com/ryz310/my_api_client/pull/220) Pageable HTTP request ([@ryz310](https://github.com/ryz310))
|
102
|
+
* Add `#pageable_get` method (alias: `#pget`)
|
103
|
+
* For example:
|
104
|
+
* API client definition
|
105
|
+
```ruby
|
106
|
+
class MyPaginationApiClient < ApplicationApiClient
|
107
|
+
endpoint 'https://example.com/v1'
|
108
|
+
|
109
|
+
# GET pagination?page=1
|
110
|
+
def pagination
|
111
|
+
pageable_get 'pagination', paging: '$.links.next', headers: headers, query: { page: 1 }
|
112
|
+
end
|
113
|
+
|
114
|
+
private
|
115
|
+
|
116
|
+
def headers
|
117
|
+
{ 'Content-Type': 'application/json;charset=UTF-8' }
|
118
|
+
end
|
119
|
+
end
|
120
|
+
```
|
121
|
+
* The pagination API response
|
122
|
+
```json
|
123
|
+
{
|
124
|
+
"links": {
|
125
|
+
"next": "https://example.com/pagination?page=3",
|
126
|
+
"previous": "https://example.com/pagination?page=1",
|
127
|
+
},
|
128
|
+
"page": 2
|
129
|
+
}
|
130
|
+
```
|
131
|
+
* Usage
|
132
|
+
```ruby
|
133
|
+
api_clinet = MyPaginationApiClient.new
|
134
|
+
api_clinet.pagination.each do |response|
|
135
|
+
# Do something.
|
136
|
+
end
|
137
|
+
|
138
|
+
p = api_clinet.pagination
|
139
|
+
p.next # => 1st page result
|
140
|
+
p.next # => 2nd page result
|
141
|
+
p.next # => 3rd page result
|
142
|
+
```
|
143
|
+
* [#223](https://github.com/ryz310/my_api_client/pull/223) Use Enumerator::Lazy instead of Enumerator ([@ryz310](https://github.com/ryz310))
|
144
|
+
|
145
|
+
## v0.14.0 (Mar 14, 2020)
|
146
|
+
|
147
|
+
### Feature
|
148
|
+
|
149
|
+
* [#211](https://github.com/ryz310/my_api_client/pull/211) Integration testing using the jets framework ([@ryz310](https://github.com/ryz310))
|
150
|
+
* [#213](https://github.com/ryz310/my_api_client/pull/213) Add status API to integration testing ([@ryz310](https://github.com/ryz310))
|
151
|
+
* [#214](https://github.com/ryz310/my_api_client/pull/214) Add error API to integration testing ([@ryz310](https://github.com/ryz310))
|
152
|
+
* [#215](https://github.com/ryz310/my_api_client/pull/215) Update the REST API to enhance integration testing ([@ryz310](https://github.com/ryz310))
|
153
|
+
|
154
|
+
### Refactoring
|
155
|
+
|
156
|
+
* [#179](https://github.com/ryz310/my_api_client/pull/179) Change the "with" option structure ([@ryz310](https://github.com/ryz310))
|
157
|
+
* [#206](https://github.com/ryz310/my_api_client/pull/206) Rebuild api request processing ([@ryz310](https://github.com/ryz310))
|
158
|
+
* [#207](https://github.com/ryz310/my_api_client/pull/207) Fix offending codes ([@ryz310](https://github.com/ryz310))
|
159
|
+
|
160
|
+
### Breaking Change
|
161
|
+
|
162
|
+
* [#196](https://github.com/ryz310/my_api_client/pull/196) Change the request structure ([@ryz310](https://github.com/ryz310))
|
163
|
+
|
164
|
+
> ### logging
|
165
|
+
>
|
166
|
+
> **before**
|
167
|
+
>
|
168
|
+
> ```
|
169
|
+
> I, [2020-02-02T15:26:53.788092 #93220] INFO -- : API request `GET https://api.esa.io/v1/teams/feedforce/posts`: "Start"
|
170
|
+
> I, [2020-02-02T15:26:55.760452 #93220] INFO -- : API request `GET https://api.esa.io/v1/teams/feedforce/posts`: "Duration 1.97186 sec"
|
171
|
+
> I, [2020-02-02T15:26:55.760739 #93220] INFO -- : API request `GET https://api.esa.io/v1/teams/feedforce/posts`: "Success (200)"
|
172
|
+
> ```
|
173
|
+
>
|
174
|
+
> **after**
|
175
|
+
>
|
176
|
+
> Shows URL with query strings.
|
177
|
+
>
|
178
|
+
> ```
|
179
|
+
> I, [2020-02-02T15:20:47.471040 #90870] INFO -- : API request `GET https://api.esa.io/v1/teams/feedforce/posts?page=1&per_page=100&q=user%3Aryosuke_sato+category%3Aunsorted`: "Start"
|
180
|
+
> I, [2020-02-02T15:20:49.516099 #90870] INFO -- : API request `GET https://api.esa.io/v1/teams/feedforce/posts?page=1&per_page=100&q=user%3Aryosuke_sato+category%3Aunsorted`: "Duration 2.034907 sec"
|
181
|
+
> I, [2020-02-02T15:20:49.516391 #90870] INFO -- : API request `GET https://api.esa.io/v1/teams/feedforce/posts?page=1&per_page=100&q=user%3Aryosuke_sato+category%3Aunsorted`: "Success (200)"
|
182
|
+
> ```
|
183
|
+
>
|
184
|
+
> ### MyApiClient::Params::Request
|
185
|
+
>
|
186
|
+
> **before**
|
187
|
+
>
|
188
|
+
> ```rb
|
189
|
+
> request_params.metadata # =>
|
190
|
+
> # {
|
191
|
+
> # line: 'GET path/to/resource',
|
192
|
+
> # headers: { 'Content-Type': 'application/json; charset=utf-8' },
|
193
|
+
> # query: { key: 'value' }
|
194
|
+
> # }
|
195
|
+
> ```
|
196
|
+
>
|
197
|
+
> **after**
|
198
|
+
>
|
199
|
+
> The `#metadata` does not include `query` key and then includes full URL into `line` value.
|
200
|
+
>
|
201
|
+
> ```rb
|
202
|
+
> request_params.metadata # =>
|
203
|
+
> # {
|
204
|
+
> # line: 'GET https://example.com/path/to/resource?key=value',
|
205
|
+
> # headers: { 'Content-Type': 'application/json; charset=utf-8' }
|
206
|
+
> # }
|
207
|
+
> ```
|
208
|
+
|
209
|
+
### Rubocop Challenge
|
210
|
+
|
211
|
+
* [#205](https://github.com/ryz310/my_api_client/pull/205) Re-generate .rubocop_todo.yml with RuboCop v0.80.0 ([@ryz310](https://github.com/ryz310))
|
212
|
+
* [#210](https://github.com/ryz310/my_api_client/pull/210) Re-generate .rubocop_todo.yml with RuboCop v0.80.1 ([@ryz310](https://github.com/ryz310))
|
213
|
+
|
214
|
+
### Dependabot
|
215
|
+
|
216
|
+
* [#190](https://github.com/ryz310/my_api_client/pull/190) Add a config file of the dependabot ([@ryz310](https://github.com/ryz310))
|
217
|
+
* [#183](https://github.com/ryz310/my_api_client/pull/183) Bump pry-byebug from 3.7.0 to 3.8.0 ([@ryz310](https://github.com/ryz310))
|
218
|
+
* [#194](https://github.com/ryz310/my_api_client/pull/194) Bump bugsnag from 6.12.2 to 6.13.0 ([@ryz310](https://github.com/ryz310))
|
219
|
+
* [#197](https://github.com/ryz310/my_api_client/pull/197) Bump webmock from 3.8.0 to 3.8.1 ([@ryz310](https://github.com/ryz310))
|
220
|
+
* [#199](https://github.com/ryz310/my_api_client/pull/199) Bump webmock from 3.8.1 to 3.8.2 ([@ryz310](https://github.com/ryz310))
|
221
|
+
* [#216](https://github.com/ryz310/my_api_client/pull/216) Bump webmock from 3.8.2 to 3.8.3 ([@ryz310](https://github.com/ryz310))
|
222
|
+
|
223
|
+
### Renovate
|
224
|
+
|
225
|
+
* [#193](https://github.com/ryz310/my_api_client/pull/193) Change renovate automerge setting ([@ryz310](https://github.com/ryz310))
|
226
|
+
* [#189](https://github.com/ryz310/my_api_client/pull/189) Update the renovate settings ([@ryz310](https://github.com/ryz310))
|
227
|
+
* [#184](https://github.com/ryz310/my_api_client/pull/184) Update ruby-orbs orb to v1.5.1 ([@ryz310](https://github.com/ryz310))
|
228
|
+
* [#185](https://github.com/ryz310/my_api_client/pull/185) Update ruby-orbs orb to v1.5.4 ([@ryz310](https://github.com/ryz310))
|
229
|
+
* [#187](https://github.com/ryz310/my_api_client/pull/187) Update ruby-orbs orb to v1.5.6 ([@ryz310](https://github.com/ryz310))
|
230
|
+
* [#192](https://github.com/ryz310/my_api_client/pull/192) Update ruby-orbs orb to v1.6.0 ([@ryz310](https://github.com/ryz310))
|
231
|
+
|
3
232
|
## v0.13.0 (Jan 21, 2020)
|
4
233
|
|
5
234
|
### Feature
|