my_api_client 0.15.0 → 0.19.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 +169 -95
- data/.dependabot/config.yml +2 -5
- data/.rubocop.yml +5 -1
- data/.rubocop_challenge.yml +1 -0
- data/.rubocop_todo.yml +53 -1
- data/CHANGELOG.md +171 -0
- data/Gemfile +0 -3
- data/Gemfile.lock +70 -64
- data/README.jp.md +97 -24
- data/bin/console +4 -0
- data/example/api_clients/application_api_client.rb +2 -10
- data/example/api_clients/my_rest_api_client.rb +9 -3
- data/gemfiles/{rails_4.2.gemfile → rails_6.1.gemfile} +1 -1
- 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 +5 -0
- data/lib/my_api_client/base.rb +4 -9
- data/lib/my_api_client/default_error_handlers.rb +64 -0
- data/lib/my_api_client/error_handling.rb +3 -4
- 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 +2 -2
- data/lib/my_api_client/request/basic.rb +1 -3
- data/lib/my_api_client/request/executor.rb +1 -1
- data/lib/my_api_client/version.rb +1 -1
- data/my_api/Gemfile.lock +89 -87
- data/my_api/app/controllers/pagination_controller.rb +1 -1
- data/my_api/spec/controllers/rest_controller_spec.rb +23 -5
- 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 +174 -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 +190 -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
- 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 +197 -0
- data/rails_app/rails_6.1/README.md +24 -0
- data/rails_app/rails_6.1/Rakefile +6 -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 +114 -0
- data/rails_app/rails_6.1/bin/rails +4 -0
- data/rails_app/rails_6.1/bin/rake +4 -0
- data/rails_app/rails_6.1/bin/setup +33 -0
- data/rails_app/rails_6.1/config.ru +6 -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/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
- metadata +119 -7
@@ -0,0 +1 @@
|
|
1
|
+
---
|
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-
|
3
|
+
# on 2020-12-25 23:31:13 UTC using RuboCop version 1.7.0.
|
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,176 @@
|
|
1
1
|
# Change log
|
2
2
|
|
3
|
+
## v0.19.0 (Jan 04, 2021)
|
4
|
+
|
5
|
+
### Feature
|
6
|
+
|
7
|
+
* [#402](https://github.com/ryz310/my_api_client/pull/402) Support ruby 3.0 and rails 6.1 ([@ryz310](https://github.com/ryz310))
|
8
|
+
|
9
|
+
### Rubocop Challenge
|
10
|
+
|
11
|
+
* [#400](https://github.com/ryz310/my_api_client/pull/400) Re-generate .rubocop_todo.yml with RuboCop v1.7.0 ([@ryz310](https://github.com/ryz310))
|
12
|
+
|
13
|
+
### Dependabot
|
14
|
+
|
15
|
+
* [#352](https://github.com/ryz310/my_api_client/pull/352) Bump jets from 2.3.17 to 2.3.18 in /my_api ([@ryz310](https://github.com/ryz310))
|
16
|
+
* [#391](https://github.com/ryz310/my_api_client/pull/391) ryz310/dependabot/bundler/rubocop-1.6.1 ([@ryz310](https://github.com/ryz310))
|
17
|
+
* [#392](https://github.com/ryz310/my_api_client/pull/392) ryz310/dependabot/bundler/my_api/puma-5.1.1 ([@ryz310](https://github.com/ryz310))
|
18
|
+
* [#395](https://github.com/ryz310/my_api_client/pull/395) ryz310/dependabot/bundler/rubocop-rspec-2.1.0 ([@ryz310](https://github.com/ryz310))
|
19
|
+
* [#396](https://github.com/ryz310/my_api_client/pull/396) ryz310/dependabot/bundler/webmock-3.11.0 ([@ryz310](https://github.com/ryz310))
|
20
|
+
* [#398](https://github.com/ryz310/my_api_client/pull/398) ryz310/dependabot/bundler/rake-13.0.3 ([@ryz310](https://github.com/ryz310))
|
21
|
+
* [#401](https://github.com/ryz310/my_api_client/pull/401) ryz310/dependabot/bundler/yard-0.9.26 ([@ryz310](https://github.com/ryz310))
|
22
|
+
* [#403](https://github.com/ryz310/my_api_client/pull/403) ryz310/dependabot/bundler/jsonpath-1.1.0 ([@ryz310](https://github.com/ryz310))
|
23
|
+
* [#404](https://github.com/ryz310/my_api_client/pull/404) Bump faraday from 1.2.0 to 1.3.0 ([@ryz310](https://github.com/ryz310))
|
24
|
+
* [#406](https://github.com/ryz310/my_api_client/pull/406) ryz310/dependabot/bundler/rubocop-performance-1.9.2 ([@ryz310](https://github.com/ryz310))
|
25
|
+
* [#407](https://github.com/ryz310/my_api_client/pull/407) Bump nokogiri from 1.10.10 to 1.11.0 in /my_api ([@ryz310](https://github.com/ryz310))
|
26
|
+
* [#408](https://github.com/ryz310/my_api_client/pull/408) Bump nokogiri from 1.10.10 to 1.11.0 in /rails_app/rails_5.2 ([@ryz310](https://github.com/ryz310))
|
27
|
+
* [#409](https://github.com/ryz310/my_api_client/pull/409) Bump nokogiri from 1.10.10 to 1.11.0 in /rails_app/rails_6.1 ([@ryz310](https://github.com/ryz310))
|
28
|
+
* [#410](https://github.com/ryz310/my_api_client/pull/410) Bump nokogiri from 1.10.10 to 1.11.0 in /rails_app/rails_6.0 ([@ryz310](https://github.com/ryz310))
|
29
|
+
|
30
|
+
## v0.18.0 (Dec 04, 2020)
|
31
|
+
|
32
|
+
### Feature
|
33
|
+
|
34
|
+
* [#381](https://github.com/ryz310/my_api_client/pull/381) Add endpoint option to the generator ([@ryz310](https://github.com/ryz310))
|
35
|
+
|
36
|
+
### Breaking Change
|
37
|
+
|
38
|
+
* [#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))
|
39
|
+
|
40
|
+
### Rubocop Challenge
|
41
|
+
|
42
|
+
* [#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))
|
43
|
+
|
44
|
+
### Dependabot
|
45
|
+
|
46
|
+
* [#338](https://github.com/ryz310/my_api_client/pull/338) ryz310/dependabot/bundler/faraday-1.1.0 ([@ryz310](https://github.com/ryz310))
|
47
|
+
* [#344](https://github.com/ryz310/my_api_client/pull/344) ryz310/dependabot/bundler/bugsnag-6.18.0 ([@ryz310](https://github.com/ryz310))
|
48
|
+
* [#345](https://github.com/ryz310/my_api_client/pull/345) ryz310/dependabot/bundler/rspec-3.10.0 ([@ryz310](https://github.com/ryz310))
|
49
|
+
* [#356](https://github.com/ryz310/my_api_client/pull/356) ryz310/dependabot/bundler/webmock-3.10.0 ([@ryz310](https://github.com/ryz310))
|
50
|
+
* [#369](https://github.com/ryz310/my_api_client/pull/369) ryz310/dependabot/bundler/jsonpath-1.0.6 ([@ryz310](https://github.com/ryz310))
|
51
|
+
* [#376](https://github.com/ryz310/my_api_client/pull/376) ryz310/dependabot/bundler/rubocop-performance-1.9.1 ([@ryz310](https://github.com/ryz310))
|
52
|
+
* [#380](https://github.com/ryz310/my_api_client/pull/380) ryz310/dependabot/bundler/rubocop-rspec-2.0.1 ([@ryz310](https://github.com/ryz310))
|
53
|
+
* [#382](https://github.com/ryz310/my_api_client/pull/382) ryz310/dependabot/bundler/rubocop-1.5.1 ([@ryz310](https://github.com/ryz310))
|
54
|
+
|
55
|
+
## v0.17.0 (Sep 20, 2020)
|
56
|
+
|
57
|
+
### Feature
|
58
|
+
|
59
|
+
* [#303](https://github.com/ryz310/my_api_client/pull/303) Change the duration format to milliseconds ([@ryz310](https://github.com/ryz310))
|
60
|
+
* [#308](https://github.com/ryz310/my_api_client/pull/308) Add testing for api client generators ([@ryz310](https://github.com/ryz310))
|
61
|
+
|
62
|
+
### Rubocop Challenge
|
63
|
+
|
64
|
+
* [#311](https://github.com/ryz310/my_api_client/pull/311) Style/GlobalStdStream-20200906233350 ([@ryz310](https://github.com/ryz310))
|
65
|
+
* [#312](https://github.com/ryz310/my_api_client/pull/312) Style/StringConcatenation-20200907233020 ([@ryz310](https://github.com/ryz310))
|
66
|
+
* [#313](https://github.com/ryz310/my_api_client/pull/313) Style/HashTransformValues-20200908233016 ([@ryz310](https://github.com/ryz310))
|
67
|
+
* [#316](https://github.com/ryz310/my_api_client/pull/316) Layout/EmptyLinesAroundAttributeAccessor-20200909233021 ([@ryz310](https://github.com/ryz310))
|
68
|
+
* [#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))
|
69
|
+
|
70
|
+
### Dependabot
|
71
|
+
|
72
|
+
* [#299](https://github.com/ryz310/my_api_client/pull/299) ryz310/dependabot/bundler/bugsnag-6.17.0 ([@ryz310](https://github.com/ryz310))
|
73
|
+
* [#310](https://github.com/ryz310/my_api_client/pull/310) ryz310/dependabot/bundler/rubocop-performance-1.8.0 ([@ryz310](https://github.com/ryz310))
|
74
|
+
* [#314](https://github.com/ryz310/my_api_client/pull/314) ryz310/dependabot/bundler/activesupport-5.2.4.4 ([@ryz310](https://github.com/ryz310))
|
75
|
+
* [#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))
|
76
|
+
* [#318](https://github.com/ryz310/my_api_client/pull/318) ryz310/dependabot/bundler/webmock-3.9.1 ([@ryz310](https://github.com/ryz310))
|
77
|
+
* [#319](https://github.com/ryz310/my_api_client/pull/319) ryz310/dependabot/bundler/rubocop-0.91.0 ([@ryz310](https://github.com/ryz310))
|
78
|
+
* [#321](https://github.com/ryz310/my_api_client/pull/321) ryz310/dependabot/bundler/my_api/puma-5.0.0 ([@ryz310](https://github.com/ryz310))
|
79
|
+
|
80
|
+
## v0.16.1 (Aug 27, 2020)
|
81
|
+
|
82
|
+
### Feature
|
83
|
+
|
84
|
+
* [#296](https://github.com/ryz310/my_api_client/pull/296) Support HTTP PUT method ([@ryz310](https://github.com/ryz310))
|
85
|
+
|
86
|
+
### Rubocop Challenge
|
87
|
+
|
88
|
+
* [#256](https://github.com/ryz310/my_api_client/pull/256) Performance/StartWith-20200523233027 ([@ryz310](https://github.com/ryz310))
|
89
|
+
* [#268](https://github.com/ryz310/my_api_client/pull/268) Lint/RedundantCopDisableDirective-20200622233019 ([@ryz310](https://github.com/ryz310))
|
90
|
+
* [#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))
|
91
|
+
* [#293](https://github.com/ryz310/my_api_client/pull/293) RSpec/LeadingSubject-20200817233022 ([@ryz310](https://github.com/ryz310))
|
92
|
+
|
93
|
+
### Dependabot
|
94
|
+
|
95
|
+
* [#232](https://github.com/ryz310/my_api_client/pull/232) ryz310/dependabot/bundler/faraday-1.0.1 ([@ryz310](https://github.com/ryz310))
|
96
|
+
* [#241](https://github.com/ryz310/my_api_client/pull/241) ryz310/dependabot/bundler/my_api/byebug-11.1.3 ([@ryz310](https://github.com/ryz310))
|
97
|
+
* [#243](https://github.com/ryz310/my_api_client/pull/243) ryz310/dependabot/bundler/yard-0.9.25 ([@ryz310](https://github.com/ryz310))
|
98
|
+
* [#248](https://github.com/ryz310/my_api_client/pull/248) ryz310/dependabot/bundler/activesupport-5.2.4.3 ([@ryz310](https://github.com/ryz310))
|
99
|
+
* [#251](https://github.com/ryz310/my_api_client/pull/251) ryz310/dependabot/bundler/my_api/puma-4.3.5 ([@ryz310](https://github.com/ryz310))
|
100
|
+
* [#257](https://github.com/ryz310/my_api_client/pull/257) ryz310/dependabot/bundler/my_api/dynomite-1.2.6 ([@ryz310](https://github.com/ryz310))
|
101
|
+
* [#264](https://github.com/ryz310/my_api_client/pull/264) ryz310/dependabot/bundler/my_api/rack-2.2.3 ([@ryz310](https://github.com/ryz310))
|
102
|
+
* [#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))
|
103
|
+
* [#266](https://github.com/ryz310/my_api_client/pull/266) ryz310/dependabot/bundler/my_api/capybara-3.33.0 ([@ryz310](https://github.com/ryz310))
|
104
|
+
* [#281](https://github.com/ryz310/my_api_client/pull/281) ryz310/dependabot/bundler/rubocop-performance-1.7.1 ([@ryz310](https://github.com/ryz310))
|
105
|
+
* [#287](https://github.com/ryz310/my_api_client/pull/287) ryz310/dependabot/bundler/my_api/kramdown-2.3.0 ([@ryz310](https://github.com/ryz310))
|
106
|
+
* [#290](https://github.com/ryz310/my_api_client/pull/290) ryz310/dependabot/bundler/bugsnag-6.16.0 ([@ryz310](https://github.com/ryz310))
|
107
|
+
* [#294](https://github.com/ryz310/my_api_client/pull/294) ryz310/dependabot/bundler/my_api/jets-2.3.17 ([@ryz310](https://github.com/ryz310))
|
108
|
+
* [#295](https://github.com/ryz310/my_api_client/pull/295) ryz310/dependabot/bundler/rubocop-rspec-1.43.2 ([@ryz310](https://github.com/ryz310))
|
109
|
+
|
110
|
+
### Misc
|
111
|
+
|
112
|
+
* [#271](https://github.com/ryz310/my_api_client/pull/271) Minor fixes ([@ryz310](https://github.com/ryz310))
|
113
|
+
|
114
|
+
## v0.16.0 (Mar 29, 2020)
|
115
|
+
|
116
|
+
### Breaking Change
|
117
|
+
|
118
|
+
#### [#225](https://github.com/ryz310/my_api_client/pull/225) Raise an exception whenever an error is detected ([@ryz310](https://github.com/ryz310))
|
119
|
+
|
120
|
+
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.
|
121
|
+
You can specify raising error class with `raise` option.
|
122
|
+
|
123
|
+
**Before**
|
124
|
+
|
125
|
+
```rb
|
126
|
+
error_handling json: { '$.errors.code': 10..19 }, with: :my_error_handling
|
127
|
+
|
128
|
+
def my_error_handling
|
129
|
+
# Executes this method when an error is detected.
|
130
|
+
# No exception is raised. You can raise an error if necessary.
|
131
|
+
end
|
132
|
+
```
|
133
|
+
```rb
|
134
|
+
error_handling status_code: 500..599 do |_params, logger|
|
135
|
+
# Executes this block when an error is detected.
|
136
|
+
# No exception is raised. You can raise an error if necessary.
|
137
|
+
end
|
138
|
+
```
|
139
|
+
|
140
|
+
**After**
|
141
|
+
|
142
|
+
```rb
|
143
|
+
error_handling json: { '$.errors.code': 10..19 }, with: :my_error_handling
|
144
|
+
|
145
|
+
def my_error_handling
|
146
|
+
# Executes this method when an error is detected.
|
147
|
+
# And then raise `MyApiClient::Error`.
|
148
|
+
end
|
149
|
+
```
|
150
|
+
```rb
|
151
|
+
error_handling status_code: 500..599 do |params, logger|
|
152
|
+
# Executes this block when an error is detected.
|
153
|
+
# And then raise `MyApiClient::Error`.
|
154
|
+
end
|
155
|
+
```
|
156
|
+
|
157
|
+
#### [#226](https://github.com/ryz310/my_api_client/pull/226) Default error handlers ([@ryz310](https://github.com/ryz310))
|
158
|
+
|
159
|
+
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.
|
160
|
+
|
161
|
+
You can check default `error_handling` or `retry_on` here.
|
162
|
+
|
163
|
+
See: https://github.com/ryz310/my_api_client/blob/master/lib/my_api_client/default_error_handlers.rb
|
164
|
+
|
165
|
+
### Dependabot
|
166
|
+
|
167
|
+
* [#227](https://github.com/ryz310/my_api_client/pull/227) ryz310/dependabot/bundler/pry-byebug-3.9.0 ([@ryz310](https://github.com/ryz310))
|
168
|
+
* [#228](https://github.com/ryz310/my_api_client/pull/228) ryz310/dependabot/bundler/my_api/jets-2.3.15 ([@ryz310](https://github.com/ryz310))
|
169
|
+
|
170
|
+
### Misc
|
171
|
+
|
172
|
+
* [#229](https://github.com/ryz310/my_api_client/pull/229) Edit dependabot configuration ([@ryz310](https://github.com/ryz310))
|
173
|
+
|
3
174
|
## v0.15.0 (Mar 21, 2020)
|
4
175
|
|
5
176
|
### Feature
|
data/Gemfile
CHANGED
@@ -4,9 +4,6 @@ source 'https://rubygems.org'
|
|
4
4
|
|
5
5
|
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
6
6
|
|
7
|
-
# Workaound for ruby 2.4. Because activesupport v6.0.0 requires ruby 2.5 over.
|
8
|
-
gem 'activesupport', '< 6.0.0'
|
9
|
-
|
10
7
|
group :integrations, optional: true do
|
11
8
|
gem 'bugsnag', '>= 6.11.0'
|
12
9
|
end
|
data/Gemfile.lock
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
my_api_client (0.
|
5
|
-
activesupport (>=
|
4
|
+
my_api_client (0.19.0)
|
5
|
+
activesupport (>= 5.2.0)
|
6
6
|
faraday (>= 0.17.1)
|
7
7
|
jsonpath
|
8
8
|
sawyer (>= 0.8.2)
|
@@ -10,79 +10,87 @@ PATH
|
|
10
10
|
GEM
|
11
11
|
remote: https://rubygems.org/
|
12
12
|
specs:
|
13
|
-
activesupport (
|
13
|
+
activesupport (6.1.0)
|
14
14
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
15
|
-
i18n (>=
|
16
|
-
minitest (
|
17
|
-
tzinfo (~>
|
15
|
+
i18n (>= 1.6, < 2)
|
16
|
+
minitest (>= 5.1)
|
17
|
+
tzinfo (~> 2.0)
|
18
|
+
zeitwerk (~> 2.3)
|
18
19
|
addressable (2.7.0)
|
19
20
|
public_suffix (>= 2.0.2, < 5.0)
|
20
|
-
ast (2.4.
|
21
|
-
bugsnag (6.
|
21
|
+
ast (2.4.1)
|
22
|
+
bugsnag (6.18.0)
|
22
23
|
concurrent-ruby (~> 1.0)
|
23
|
-
byebug (11.1.
|
24
|
-
coderay (1.1.
|
25
|
-
concurrent-ruby (1.1.
|
26
|
-
crack (0.4.
|
27
|
-
|
28
|
-
diff-lcs (1.
|
29
|
-
docile (1.3.
|
30
|
-
faraday (1.
|
24
|
+
byebug (11.1.3)
|
25
|
+
coderay (1.1.3)
|
26
|
+
concurrent-ruby (1.1.7)
|
27
|
+
crack (0.4.5)
|
28
|
+
rexml
|
29
|
+
diff-lcs (1.4.4)
|
30
|
+
docile (1.3.4)
|
31
|
+
faraday (1.3.0)
|
32
|
+
faraday-net_http (~> 1.0)
|
31
33
|
multipart-post (>= 1.2, < 3)
|
34
|
+
ruby2_keywords
|
35
|
+
faraday-net_http (1.0.0)
|
32
36
|
hashdiff (1.0.1)
|
33
|
-
i18n (1.8.
|
37
|
+
i18n (1.8.7)
|
34
38
|
concurrent-ruby (~> 1.0)
|
35
|
-
|
36
|
-
|
37
|
-
jsonpath (1.0.5)
|
39
|
+
json (2.5.1)
|
40
|
+
jsonpath (1.1.0)
|
38
41
|
multi_json
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
multi_json (1.14.1)
|
42
|
+
method_source (1.0.0)
|
43
|
+
minitest (5.14.2)
|
44
|
+
multi_json (1.15.0)
|
43
45
|
multipart-post (2.1.1)
|
44
|
-
parallel (1.
|
45
|
-
parser (
|
46
|
-
ast (~> 2.4.
|
47
|
-
pry (0.
|
48
|
-
coderay (~> 1.1
|
49
|
-
method_source (~>
|
50
|
-
pry-byebug (3.
|
46
|
+
parallel (1.20.1)
|
47
|
+
parser (3.0.0.0)
|
48
|
+
ast (~> 2.4.1)
|
49
|
+
pry (0.13.1)
|
50
|
+
coderay (~> 1.1)
|
51
|
+
method_source (~> 1.0)
|
52
|
+
pry-byebug (3.9.0)
|
51
53
|
byebug (~> 11.0)
|
52
|
-
pry (~> 0.
|
53
|
-
public_suffix (4.0.
|
54
|
+
pry (~> 0.13.0)
|
55
|
+
public_suffix (4.0.6)
|
54
56
|
rainbow (3.0.0)
|
55
|
-
rake (13.0.
|
57
|
+
rake (13.0.3)
|
58
|
+
regexp_parser (2.0.3)
|
56
59
|
rexml (3.2.4)
|
57
|
-
rspec (3.
|
58
|
-
rspec-core (~> 3.
|
59
|
-
rspec-expectations (~> 3.
|
60
|
-
rspec-mocks (~> 3.
|
61
|
-
rspec-core (3.
|
62
|
-
rspec-support (~> 3.
|
63
|
-
rspec-expectations (3.
|
60
|
+
rspec (3.10.0)
|
61
|
+
rspec-core (~> 3.10.0)
|
62
|
+
rspec-expectations (~> 3.10.0)
|
63
|
+
rspec-mocks (~> 3.10.0)
|
64
|
+
rspec-core (3.10.1)
|
65
|
+
rspec-support (~> 3.10.0)
|
66
|
+
rspec-expectations (3.10.1)
|
64
67
|
diff-lcs (>= 1.2.0, < 2.0)
|
65
|
-
rspec-support (~> 3.
|
66
|
-
rspec-mocks (3.
|
68
|
+
rspec-support (~> 3.10.0)
|
69
|
+
rspec-mocks (3.10.1)
|
67
70
|
diff-lcs (>= 1.2.0, < 2.0)
|
68
|
-
rspec-support (~> 3.
|
69
|
-
rspec-support (3.
|
71
|
+
rspec-support (~> 3.10.0)
|
72
|
+
rspec-support (3.10.1)
|
70
73
|
rspec_junit_formatter (0.4.1)
|
71
74
|
rspec-core (>= 2, < 4, != 2.12.0)
|
72
|
-
rubocop (
|
73
|
-
jaro_winkler (~> 1.5.1)
|
75
|
+
rubocop (1.7.0)
|
74
76
|
parallel (~> 1.10)
|
75
|
-
parser (>= 2.7.
|
77
|
+
parser (>= 2.7.1.5)
|
76
78
|
rainbow (>= 2.2.2, < 4.0)
|
79
|
+
regexp_parser (>= 1.8, < 3.0)
|
77
80
|
rexml
|
81
|
+
rubocop-ast (>= 1.2.0, < 2.0)
|
78
82
|
ruby-progressbar (~> 1.7)
|
79
|
-
unicode-display_width (>= 1.4.0, <
|
80
|
-
rubocop-
|
81
|
-
|
82
|
-
rubocop-
|
83
|
-
rubocop (>= 0.
|
84
|
-
|
85
|
-
|
83
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
84
|
+
rubocop-ast (1.4.0)
|
85
|
+
parser (>= 2.7.1.5)
|
86
|
+
rubocop-performance (1.9.2)
|
87
|
+
rubocop (>= 0.90.0, < 2.0)
|
88
|
+
rubocop-ast (>= 0.4.0)
|
89
|
+
rubocop-rspec (2.1.0)
|
90
|
+
rubocop (~> 1.0)
|
91
|
+
rubocop-ast (>= 1.1.0)
|
92
|
+
ruby-progressbar (1.11.0)
|
93
|
+
ruby2_keywords (0.0.2)
|
86
94
|
sawyer (0.8.2)
|
87
95
|
addressable (>= 2.3.5)
|
88
96
|
faraday (> 0.8, < 2.0)
|
@@ -91,22 +99,20 @@ GEM
|
|
91
99
|
json (>= 1.8, < 3)
|
92
100
|
simplecov-html (~> 0.10.0)
|
93
101
|
simplecov-html (0.10.2)
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
unicode-display_width (1.6.1)
|
99
|
-
webmock (3.8.3)
|
102
|
+
tzinfo (2.0.4)
|
103
|
+
concurrent-ruby (~> 1.0)
|
104
|
+
unicode-display_width (1.7.0)
|
105
|
+
webmock (3.11.0)
|
100
106
|
addressable (>= 2.3.6)
|
101
107
|
crack (>= 0.3.2)
|
102
108
|
hashdiff (>= 0.4.0, < 2.0.0)
|
103
|
-
yard (0.9.
|
109
|
+
yard (0.9.26)
|
110
|
+
zeitwerk (2.4.2)
|
104
111
|
|
105
112
|
PLATFORMS
|
106
113
|
ruby
|
107
114
|
|
108
115
|
DEPENDENCIES
|
109
|
-
activesupport (< 6.0.0)
|
110
116
|
bugsnag (>= 6.11.0)
|
111
117
|
bundler (>= 2.0)
|
112
118
|
my_api_client!
|
@@ -122,4 +128,4 @@ DEPENDENCIES
|
|
122
128
|
yard
|
123
129
|
|
124
130
|
BUNDLED WITH
|
125
|
-
2.
|
131
|
+
2.2.3
|
data/README.jp.md
CHANGED
@@ -6,12 +6,14 @@ MyApiClient は API リクエストクラスを作成するための汎用的な
|
|
6
6
|
|
7
7
|
ただし、 Sawyer はダミーデータの作成が難しかったり、他の gem で競合することがよくあるので、将来的には依存しないように変更していくかもしれません。
|
8
8
|
|
9
|
-
また、 Ruby on Rails
|
9
|
+
また、 Ruby on Rails で利用することを想定してますが、それ以外の環境でも動作するように作っています。不具合などあれば Issue ページからご報告下さい。
|
10
|
+
|
11
|
+
[toc]
|
10
12
|
|
11
13
|
## Supported Versions
|
12
14
|
|
13
|
-
* Ruby 2.
|
14
|
-
* Rails
|
15
|
+
* Ruby 2.5, 2.6, 2.7, 3.0
|
16
|
+
* Rails 5.2, 6.0, 6.1
|
15
17
|
|
16
18
|
## Installation
|
17
19
|
|
@@ -24,7 +26,7 @@ gem 'my_api_client'
|
|
24
26
|
Ruby on Rails を利用している場合は `generator` 機能を利用できます。
|
25
27
|
|
26
28
|
```sh
|
27
|
-
$ rails g api_client path/to/resource get:path/to/resource
|
29
|
+
$ rails g api_client path/to/resource get:path/to/resource --endpoint https://example.com
|
28
30
|
|
29
31
|
create app/api_clients/application_api_client.rb
|
30
32
|
create app/api_clients/path/to/resource_api_client.rb
|
@@ -147,30 +149,31 @@ end
|
|
147
149
|
|
148
150
|
### Error handling
|
149
151
|
|
150
|
-
|
152
|
+
`my_api_client` ではレスポンスの内容によって例外を発生させるエラーハンドリングを定義できます。ここでは例として前述のコードにエラーハンドリングを定義しています。
|
151
153
|
|
152
154
|
```ruby
|
153
155
|
class ExampleApiClient < MyApiClient::Base
|
154
156
|
endpoint 'https://example.com'
|
155
157
|
|
156
|
-
error_handling status_code: 400..499,
|
158
|
+
error_handling status_code: 400..499,
|
159
|
+
raise: MyApiClient::ClientError
|
157
160
|
|
158
|
-
error_handling status_code: 500..599 do |
|
161
|
+
error_handling status_code: 500..599, raise: MyApiClient::ServerError do |_params, logger|
|
159
162
|
logger.warn 'Server error occurred.'
|
160
|
-
raise MyApiClient::ServerError, params
|
161
163
|
end
|
162
164
|
|
163
|
-
error_handling json: { '$.errors.code': 10..19 },
|
165
|
+
error_handling json: { '$.errors.code': 10..19 },
|
166
|
+
raise: MyApiClient::ClientError,
|
167
|
+
with: :my_error_handling
|
164
168
|
|
165
169
|
# Omission...
|
166
170
|
|
167
171
|
private
|
168
172
|
|
169
|
-
# @param params [MyApiClient::Params::Params] HTTP
|
173
|
+
# @param params [MyApiClient::Params::Params] HTTP reqest and response params
|
170
174
|
# @param logger [MyApiClient::Request::Logger] Logger for a request processing
|
171
175
|
def my_error_handling(params, logger)
|
172
176
|
logger.warn "Response Body: #{params.response.body.inspect}"
|
173
|
-
raise MyApiClient::ClientError, params
|
174
177
|
end
|
175
178
|
end
|
176
179
|
```
|
@@ -183,29 +186,26 @@ error_handling status_code: 400..499, raise: MyApiClient::ClientError
|
|
183
186
|
|
184
187
|
これは `ExampleApiClient` からのリクエスト全てにおいて、レスポンスのステータスコードが `400..499` であった場合に `MyApiClient::ClientError` が例外として発生するようになります。 `ExampleApiClient` を継承したクラスにもエラーハンドリングは適用されます。ステータスコードのエラーハンドリングは親クラスで定義すると良いと思います。
|
185
188
|
|
186
|
-
なお、 `status_code` には `Integer` `Range` `Regexp`
|
189
|
+
なお、 `status_code` には `Integer` `Range` `Regexp` が指定可能です。
|
190
|
+
|
191
|
+
`raise` には `MyApiClient::Error` を継承したクラスが指定可能です。`my_api_client` で標準で定義しているエラークラスについては以下のソースコードをご確認下さい。 `raise` を省略した場合は `MyApiClient::Error` を発生するようになります。
|
187
192
|
|
188
|
-
https://github.com/ryz310/my_api_client/blob/master/lib/my_api_client/errors
|
193
|
+
https://github.com/ryz310/my_api_client/blob/master/lib/my_api_client/errors
|
189
194
|
|
190
|
-
次に、 `
|
195
|
+
次に、 `block` を指定する場合について。
|
191
196
|
|
192
197
|
```ruby
|
193
|
-
error_handling status_code: 500..599 do |
|
198
|
+
error_handling status_code: 500..599, raise: MyApiClient::ServerError do |_params, logger|
|
194
199
|
logger.warn 'Server error occurred.'
|
195
|
-
raise MyApiClient::ServerError, params
|
196
200
|
end
|
197
201
|
```
|
198
202
|
|
199
|
-
上記の例であれば、ステータスコードが `500..599` の場合に `block` の内容が実行れます。引数の `params` にはリクエスト情報とレスポンス情報が含まれています。`logger` はログ出力用インスタンスですが、このインスタンスを使ってログ出力すると、以下のようにリクエスト情報がログ出力に含まれるようになり、デバッグの際に便利です。
|
203
|
+
上記の例であれば、ステータスコードが `500..599` の場合に `MyApiClient::ServerError` を発生させる前に `block` の内容が実行れます。引数の `params` にはリクエスト情報とレスポンス情報が含まれています。`logger` はログ出力用インスタンスですが、このインスタンスを使ってログ出力すると、以下のようにリクエスト情報がログ出力に含まれるようになり、デバッグの際に便利です。
|
200
204
|
|
201
205
|
```text
|
202
206
|
API request `GET https://example.com/path/to/resouce`: "Server error occurred."
|
203
207
|
```
|
204
208
|
|
205
|
-
リクエストに失敗した場合は例外処理を実行する、という設計が一般的だと思われるので、基本的にブロックの最後に `raise` を実行する事になると思います。
|
206
|
-
|
207
|
-
最後に `json` と `with` を利用する場合について。
|
208
|
-
|
209
209
|
```ruby
|
210
210
|
error_handling json: { '$.errors.code': 10..19 }, with: :my_error_handling
|
211
211
|
```
|
@@ -221,17 +221,28 @@ error_handling json: { '$.errors.code': 10..19 }, with: :my_error_handling
|
|
221
221
|
}
|
222
222
|
```
|
223
223
|
|
224
|
-
`with`
|
224
|
+
`with` にはインスタンスメソッド名を指定することで、エラーを検出した際、例外を発生させる前に任意のメソッドを実行させることができます。メソッドに渡される引数は `block` 定義の場合と同じく `params` と `logger` です。なお、 `block` と `with` は同時には利用できません。
|
225
225
|
|
226
226
|
```ruby
|
227
227
|
# @param params [MyApiClient::Params::Params] HTTP req and res params
|
228
228
|
# @param logger [MyApiClient::Request::Logger] Logger for a request processing
|
229
229
|
def my_error_handling(params, logger)
|
230
230
|
logger.warn "Response Body: #{params.response.body.inspect}"
|
231
|
-
raise MyApiClient::ClientError, params
|
232
231
|
end
|
233
232
|
```
|
234
233
|
|
234
|
+
#### Default error handling
|
235
|
+
|
236
|
+
`my_api_client` では、標準でステータスコード 400 ~ 500 番台のレスポンスを例外として処理するようにしています。ステータスコードが 400 番台場合は `MyApiClient::ClientError`、 500 番台の場合は `MyApiClient::ServerError` を継承した例外クラスが raise されます。
|
237
|
+
|
238
|
+
また、 `MyApiClient::NetworkError` に対しても標準で `retry_on` が定義されています。
|
239
|
+
|
240
|
+
いずれも override 可能ですので、必要に応じて `error_handling` を定義して下さい。
|
241
|
+
|
242
|
+
以下のファイルで定義しています。
|
243
|
+
|
244
|
+
https://github.com/ryz310/my_api_client/blob/master/lib/my_api_client/default_error_handlers.rb
|
245
|
+
|
235
246
|
#### Symbol を利用する
|
236
247
|
|
237
248
|
```ruby
|
@@ -300,7 +311,9 @@ end
|
|
300
311
|
|
301
312
|
API リクエストを何度も実行していると回線の不調などによりネットワークエラーが発生する事があります。長時間ネットワークが使えなくなるケースもありますが、瞬間的なエラーであるケースも多々あります。 `MyApiClient` ではネットワーク系の例外はまとめて `MyApiClient::NetworkError` として `raise` されます。この例外の詳細は後述しますが、 `retry_on` を利用する事で、 `ActiveJob` のように任意の例外処理を補足して、一定回数、一定の期間を空けて API リクエストをリトライさせる事ができます。
|
302
313
|
|
303
|
-
|
314
|
+
なお、 `retry_on MyApiClient::NetworkError` は標準実装されているため、特別に定義せずとも自動的に適用されます。 `wait` や `attempts` に任意の値を設定したい場合のみ定義してご利用ください。
|
315
|
+
|
316
|
+
ただし、 `ActiveJob` とは異なり同期処理でリトライするため、ネットワークの瞬断に備えたリトライ以外ではあまり使う機会はないのではないかと思います。上記の例のように API Rate Limit に備えてリトライするケースもあるかと思いますが、こちらは `ActiveJob` で対応した方が良いかもしれません。
|
304
317
|
|
305
318
|
ちなみに一応 `discard_on` も実装していますが、作者自身が有効な用途を見出せていないので、詳細は割愛します。良い利用方法があれば教えてください。
|
306
319
|
|
@@ -629,6 +642,66 @@ rescue MyApiClient::Error => e
|
|
629
642
|
end
|
630
643
|
```
|
631
644
|
|
645
|
+
## Deployment
|
646
|
+
|
647
|
+
この gem のリリースには [gem_comet](https://github.com/ryz310/gem_comet) を利用しています。
|
648
|
+
`gem_comet` の README.md にも使い方が載っていますが、備忘録のため、こちらにもリリースフローを記載しておきます。
|
649
|
+
|
650
|
+
### Preparement
|
651
|
+
|
652
|
+
以下のコマンドで `.envrc` を作成し、 `GITHUB_ACCESS_TOKEN` を設定します。
|
653
|
+
|
654
|
+
```sh
|
655
|
+
$ cp .envrc.skeleton .envrc
|
656
|
+
```
|
657
|
+
|
658
|
+
以下のコマンドで `gem_comet` をインストールします。
|
659
|
+
|
660
|
+
```sh
|
661
|
+
$ gem install gem_comet
|
662
|
+
```
|
663
|
+
|
664
|
+
### USAGE
|
665
|
+
|
666
|
+
以下のコマンドで、最後のリリースから現在までに merge した PR の一覧を確認できます。
|
667
|
+
|
668
|
+
```sh
|
669
|
+
$ gem_comet changelog
|
670
|
+
```
|
671
|
+
|
672
|
+
以下のコマンドで gem のリリースを実行します。
|
673
|
+
`{VERSION}` には新しく付与するバージョン番号を指定します。
|
674
|
+
|
675
|
+
```sh
|
676
|
+
$ gem_comet release {VERSION}
|
677
|
+
```
|
678
|
+
|
679
|
+
実行すると、 https://github.com/ryz310/my_api_client/pulls に以下のような PR が作成されます。
|
680
|
+
|
681
|
+
* [Update v0\.16\.1](https://github.com/ryz310/my_api_client/pull/297)
|
682
|
+
* [Release v0\.16\.1](https://github.com/ryz310/my_api_client/pull/298)
|
683
|
+
|
684
|
+
まず、 `Update v{VERSION}` という PR から merge に取り掛かります。
|
685
|
+
|
686
|
+
PR のコメントにも TODO が記載されていますが、まず、バージョン番号が正しく採番されているかを確認します。
|
687
|
+
|
688
|
+
See: [314a4c0](https://github.com/ryz310/my_api_client/pull/297/commits/314a4c06f66324ce77b640b1ee8db5c84ee038a2)
|
689
|
+
|
690
|
+
次に `CHANGELOG.md` を編集して、 CHANGELOG を見やすく整理します。
|
691
|
+
|
692
|
+
See: [33a2d17](https://github.com/ryz310/my_api_client/pull/297/commits/33a2d1703c773813c837e74ee3181906b2f2e502)
|
693
|
+
|
694
|
+
これらが整ったら、 `Update v{VERSION}` を merge します。
|
695
|
+
|
696
|
+
これでリリース準備が整ったので、`Release v{VERSION}` の merge に取り掛かります。
|
697
|
+
|
698
|
+
この PR にこれからリリースする gem に対する変更が全て載っています。
|
699
|
+
変更内容の最終確認をして、 CI も通ったことを確認したら `Release v{VERSION}` を merge します。
|
700
|
+
|
701
|
+
あとは Circle CI 側で gem のリリースが自動実行されるので、暫く待ちましょう。
|
702
|
+
|
703
|
+
お疲れさまでした :tea:
|
704
|
+
|
632
705
|
## Contributing
|
633
706
|
|
634
707
|
不具合の報告や Pull Request を歓迎しています。OSS という事で自分はなるべく頑張って英語を使うようにしていますが、日本語での報告でも大丈夫です :+1:
|