my_api_client 0.21.0 → 0.22.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 +23 -7
- data/.rubocop_todo.yml +1 -1
- data/CHANGELOG.md +27 -2
- data/Gemfile +2 -0
- data/Gemfile.lock +23 -21
- data/README.jp.md +10 -10
- data/README.md +392 -8
- data/gemfiles/rails_7.0.gemfile +15 -0
- data/lib/generators/rails/templates/api_client.rb.erb +3 -5
- data/lib/generators/rspec/templates/api_client_spec.rb.erb +0 -8
- data/lib/my_api_client/version.rb +1 -1
- data/my_api/Gemfile +1 -1
- data/my_api/Gemfile.lock +68 -66
- data/my_api/spec/spec_helper.rb +1 -1
- data/my_api_client.gemspec +3 -0
- data/rails_app/rails_5.2/Gemfile.lock +3 -3
- data/rails_app/rails_6.0/Gemfile.lock +15 -9
- data/rails_app/rails_6.1/Gemfile +2 -2
- data/rails_app/rails_6.1/Gemfile.lock +3 -3
- data/rails_app/rails_6.1/Rakefile +3 -1
- data/rails_app/rails_6.1/bin/bundle +28 -20
- data/rails_app/rails_6.1/bin/rails +4 -2
- data/rails_app/rails_6.1/bin/rake +4 -2
- data/rails_app/rails_6.1/bin/setup +3 -1
- data/rails_app/rails_6.1/config.ru +3 -1
- data/rails_app/rails_7.0/Gemfile +13 -0
- data/rails_app/rails_7.0/Gemfile.lock +147 -0
- data/rails_app/rails_7.0/README.md +24 -0
- data/rails_app/rails_7.0/Rakefile +8 -0
- data/rails_app/rails_7.0/app/controllers/application_controller.rb +4 -0
- data/rails_app/rails_7.0/app/models/application_record.rb +5 -0
- data/rails_app/rails_7.0/bin/bundle +122 -0
- data/rails_app/rails_7.0/bin/rails +6 -0
- data/rails_app/rails_7.0/bin/rake +6 -0
- data/rails_app/rails_7.0/bin/setup +35 -0
- data/rails_app/rails_7.0/config/application.rb +41 -0
- data/rails_app/rails_7.0/config/boot.rb +5 -0
- data/rails_app/rails_7.0/config/credentials.yml.enc +1 -0
- data/rails_app/rails_7.0/config/database.yml +25 -0
- data/rails_app/rails_7.0/config/environment.rb +7 -0
- data/rails_app/rails_7.0/config/environments/development.rb +58 -0
- data/rails_app/rails_7.0/config/environments/production.rb +70 -0
- data/rails_app/rails_7.0/config/environments/test.rb +52 -0
- data/rails_app/rails_7.0/config/initializers/cors.rb +17 -0
- data/rails_app/rails_7.0/config/initializers/filter_parameter_logging.rb +8 -0
- data/rails_app/rails_7.0/config/initializers/inflections.rb +17 -0
- data/rails_app/rails_7.0/config/locales/en.yml +33 -0
- data/rails_app/rails_7.0/config/routes.rb +8 -0
- data/rails_app/rails_7.0/config.ru +8 -0
- data/rails_app/rails_7.0/db/seeds.rb +8 -0
- data/rails_app/rails_7.0/public/robots.txt +1 -0
- data/rails_app/rails_7.0/spec/rails_helper.rb +14 -0
- data/rails_app/rails_7.0/spec/spec_helper.rb +13 -0
- metadata +34 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a47b1e4f16c3a2490bed2bc2280aefd6f147241980e37816a34733c6b301242
|
4
|
+
data.tar.gz: ccc14a82d0268ec3db86150fab5e1a3e45c12a807be3cb3c58230e7e7f2aa56d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 655a1d0fc68e43b7d33b4c97107e7641923c9a05d666ba8ec620ba6400984ff672df6d549f2e02ffad77fc720238da9f6b28e0b7201c069ff9271b769f54f710
|
7
|
+
data.tar.gz: 47a6c61e6e30e1bbffc3fcdfa6f011e8e1dc3cc625f4f0cfad35ca1f28b7be5957779db4474741f2daea0d11807d8b2965b192e36e2a1d87443530e3a80bf88a
|
data/.circleci/config.yml
CHANGED
@@ -17,8 +17,8 @@ references:
|
|
17
17
|
- &rails_version
|
18
18
|
rails_version:
|
19
19
|
type: enum
|
20
|
-
enum: &rails_version_enum ['5.2', '6.0', '6.1']
|
21
|
-
default: '
|
20
|
+
enum: &rails_version_enum ['5.2', '6.0', '6.1', '7.0']
|
21
|
+
default: '7.0'
|
22
22
|
- &bundler_options
|
23
23
|
bundler_options:
|
24
24
|
type: string
|
@@ -29,20 +29,20 @@ executors:
|
|
29
29
|
parameters:
|
30
30
|
<<: *ruby_version
|
31
31
|
docker:
|
32
|
-
- image:
|
32
|
+
- image: cimg/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:
|
38
|
+
- image: cimg/ruby:<< parameters.ruby_version >>
|
39
39
|
working_directory: ~/repo
|
40
40
|
rails_executor:
|
41
41
|
parameters:
|
42
42
|
<<: *ruby_version
|
43
43
|
<<: *rails_version
|
44
44
|
docker:
|
45
|
-
- image:
|
45
|
+
- image: cimg/ruby:<< parameters.ruby_version >>
|
46
46
|
working_directory: ~/repo/rails_app/rails_<< parameters.rails_version >>
|
47
47
|
|
48
48
|
commands:
|
@@ -125,7 +125,7 @@ commands:
|
|
125
125
|
- run:
|
126
126
|
name: Rubocop Challenge
|
127
127
|
command: |
|
128
|
-
gem install rubocop_challenger
|
128
|
+
gem install rubocop_challenger
|
129
129
|
rubocop_challenger go --email=ryz310@gmail.com --name=ryz310
|
130
130
|
release:
|
131
131
|
description: Release to RubyGems.org
|
@@ -175,6 +175,10 @@ commands:
|
|
175
175
|
parameters:
|
176
176
|
<<: *rails_version
|
177
177
|
steps:
|
178
|
+
- run:
|
179
|
+
name: "[Workaround] See: https://obel.hatenablog.jp/entry/20210831/1630350000"
|
180
|
+
command: |
|
181
|
+
sudo ln -s /usr/lib/x86_64-linux-gnu/libffi.so.7.1.0 /usr/lib/x86_64-linux-gnu/libffi.so.6
|
178
182
|
- run:
|
179
183
|
name: Generate new API client files
|
180
184
|
command: |
|
@@ -248,7 +252,7 @@ jobs:
|
|
248
252
|
- code-climate/install
|
249
253
|
- code-climate/sum-coverage:
|
250
254
|
input: codeclimate.*.json
|
251
|
-
parts:
|
255
|
+
parts: 20
|
252
256
|
- code-climate/upload-coverage
|
253
257
|
rubocop:
|
254
258
|
executor: gem_executor
|
@@ -286,6 +290,16 @@ workflows:
|
|
286
290
|
exclude:
|
287
291
|
- ruby_version: '3.0'
|
288
292
|
rails_version: '5.2'
|
293
|
+
bundler_options: '--with integrations'
|
294
|
+
- ruby_version: '3.0'
|
295
|
+
rails_version: '5.2'
|
296
|
+
bundler_options: '--without integrations'
|
297
|
+
- ruby_version: '2.6'
|
298
|
+
rails_version: '7.0'
|
299
|
+
bundler_options: '--with integrations'
|
300
|
+
- ruby_version: '2.6'
|
301
|
+
rails_version: '7.0'
|
302
|
+
bundler_options: '--without integrations'
|
289
303
|
- verify_generator:
|
290
304
|
name: verify_generator_on_ruby_<< matrix.ruby_version >>_and_rails_<< matrix.rails_version >>
|
291
305
|
matrix:
|
@@ -295,6 +309,8 @@ workflows:
|
|
295
309
|
exclude:
|
296
310
|
- ruby_version: '3.0'
|
297
311
|
rails_version: '5.2'
|
312
|
+
- ruby_version: '2.6'
|
313
|
+
rails_version: '7.0'
|
298
314
|
- test_api:
|
299
315
|
ruby_version: '2.7' # Jets supports only Ruby 2.x
|
300
316
|
- rubocop
|
data/.rubocop_todo.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on 2021-
|
3
|
+
# on 2021-11-15 23:31:28 UTC using RuboCop version 1.23.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
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,30 @@
|
|
1
1
|
# Change log
|
2
2
|
|
3
|
+
## v0.22.0 (Dec 26, 2021)
|
4
|
+
|
5
|
+
### Feature
|
6
|
+
|
7
|
+
* [#648](https://github.com/ryz310/my_api_client/pull/648) Support Rails 7.0 ([@ryz310](https://github.com/ryz310))
|
8
|
+
|
9
|
+
### Rubocop Challenge
|
10
|
+
|
11
|
+
* [#617](https://github.com/ryz310/my_api_client/pull/617) RSpec/ExcessiveDocstringSpacing-20210922233114 ([@ryz310](https://github.com/ryz310))
|
12
|
+
* [#623](https://github.com/ryz310/my_api_client/pull/623) Security/IoMethods-20210930233112 ([@ryz310](https://github.com/ryz310))
|
13
|
+
* [#624](https://github.com/ryz310/my_api_client/pull/624) ryz310/rubocop-challenge/20211004233152 ([@ryz310](https://github.com/ryz310))
|
14
|
+
* [#638](https://github.com/ryz310/my_api_client/pull/638) Gemspec/RequireMFA-20211115233105 ([@ryz310](https://github.com/ryz310))
|
15
|
+
|
16
|
+
### Dependabot
|
17
|
+
|
18
|
+
* [#576](https://github.com/ryz310/my_api_client/pull/576) Bump bugsnag from 6.21.0 to 6.22.1 ([@ryz310](https://github.com/ryz310))
|
19
|
+
* [#612](https://github.com/ryz310/my_api_client/pull/612) ryz310/dependabot/bundler/faraday-1.8.0 ([@ryz310](https://github.com/ryz310))
|
20
|
+
* [#625](https://github.com/ryz310/my_api_client/pull/625) ryz310/dependabot/bundler/bugsnag-6.24.0 ([@ryz310](https://github.com/ryz310))
|
21
|
+
* [#635](https://github.com/ryz310/my_api_client/pull/635) Bump rubocop-performance from 1.11.5 to 1.12.0 ([@ryz310](https://github.com/ryz310))
|
22
|
+
* [#636](https://github.com/ryz310/my_api_client/pull/636) ryz310/dependabot/bundler/rubocop-rspec-2.6.0 ([@ryz310](https://github.com/ryz310))
|
23
|
+
* [#639](https://github.com/ryz310/my_api_client/pull/639) Bump yard from 0.9.26 to 0.9.27 ([@ryz310](https://github.com/ryz310))
|
24
|
+
* [#640](https://github.com/ryz310/my_api_client/pull/640) Bump bugsnag from 6.24.0 to 6.24.1 ([@ryz310](https://github.com/ryz310))
|
25
|
+
* [#641](https://github.com/ryz310/my_api_client/pull/641) Bump activesupport from 6.1.4.1 to 6.1.4.2 ([@ryz310](https://github.com/ryz310))
|
26
|
+
* [#644](https://github.com/ryz310/my_api_client/pull/644) ryz310/dependabot/bundler/activesupport-6.1.4.4 ([@ryz310](https://github.com/ryz310))
|
27
|
+
|
3
28
|
## v0.21.0 (Aug 07, 2021)
|
4
29
|
|
5
30
|
### Feature
|
@@ -41,7 +66,7 @@
|
|
41
66
|
|
42
67
|
### Feature
|
43
68
|
|
44
|
-
* [#402](https://github.com/ryz310/my_api_client/pull/402) Support
|
69
|
+
* [#402](https://github.com/ryz310/my_api_client/pull/402) Support Ruby 3.0 and Rails 6.1 ([@ryz310](https://github.com/ryz310))
|
45
70
|
|
46
71
|
### Rubocop Challenge
|
47
72
|
|
@@ -55,7 +80,7 @@
|
|
55
80
|
|
56
81
|
### Breaking Change
|
57
82
|
|
58
|
-
* [#365](https://github.com/ryz310/my_api_client/pull/365) End of support for
|
83
|
+
* [#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))
|
59
84
|
|
60
85
|
### Rubocop Challenge
|
61
86
|
|
data/Gemfile
CHANGED
@@ -4,6 +4,8 @@ source 'https://rubygems.org'
|
|
4
4
|
|
5
5
|
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
6
6
|
|
7
|
+
gem 'activesupport', '~> 6.1' # TODO: Remove this line at the end of Ruby 2.6 support
|
8
|
+
|
7
9
|
group :integrations, optional: true do
|
8
10
|
gem 'bugsnag', '>= 6.11.0'
|
9
11
|
end
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
my_api_client (0.
|
4
|
+
my_api_client (0.22.0)
|
5
5
|
activesupport (>= 5.2.0)
|
6
6
|
faraday (>= 0.17.1)
|
7
7
|
jsonpath
|
@@ -10,7 +10,7 @@ PATH
|
|
10
10
|
GEM
|
11
11
|
remote: https://rubygems.org/
|
12
12
|
specs:
|
13
|
-
activesupport (6.1.4)
|
13
|
+
activesupport (6.1.4.4)
|
14
14
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
15
15
|
i18n (>= 1.6, < 2)
|
16
16
|
minitest (>= 5.1)
|
@@ -19,16 +19,16 @@ GEM
|
|
19
19
|
addressable (2.8.0)
|
20
20
|
public_suffix (>= 2.0.2, < 5.0)
|
21
21
|
ast (2.4.2)
|
22
|
-
bugsnag (6.
|
22
|
+
bugsnag (6.24.1)
|
23
23
|
concurrent-ruby (~> 1.0)
|
24
24
|
byebug (11.1.3)
|
25
25
|
coderay (1.1.3)
|
26
26
|
concurrent-ruby (1.1.9)
|
27
27
|
crack (0.4.5)
|
28
28
|
rexml
|
29
|
-
diff-lcs (1.
|
29
|
+
diff-lcs (1.5.0)
|
30
30
|
docile (1.4.0)
|
31
|
-
faraday (1.
|
31
|
+
faraday (1.8.0)
|
32
32
|
faraday-em_http (~> 1.0)
|
33
33
|
faraday-em_synchrony (~> 1.0)
|
34
34
|
faraday-excon (~> 1.1)
|
@@ -48,16 +48,16 @@ GEM
|
|
48
48
|
faraday-patron (1.0.0)
|
49
49
|
faraday-rack (1.0.0)
|
50
50
|
hashdiff (1.0.1)
|
51
|
-
i18n (1.8.
|
51
|
+
i18n (1.8.11)
|
52
52
|
concurrent-ruby (~> 1.0)
|
53
53
|
jsonpath (1.1.0)
|
54
54
|
multi_json
|
55
55
|
method_source (1.0.0)
|
56
|
-
minitest (5.
|
56
|
+
minitest (5.15.0)
|
57
57
|
multi_json (1.15.0)
|
58
58
|
multipart-post (2.1.1)
|
59
|
-
parallel (1.
|
60
|
-
parser (3.0.2
|
59
|
+
parallel (1.21.0)
|
60
|
+
parser (3.0.3.2)
|
61
61
|
ast (~> 2.4.1)
|
62
62
|
pry (0.13.1)
|
63
63
|
coderay (~> 1.1)
|
@@ -68,7 +68,7 @@ GEM
|
|
68
68
|
public_suffix (4.0.6)
|
69
69
|
rainbow (3.0.0)
|
70
70
|
rake (13.0.6)
|
71
|
-
regexp_parser (2.
|
71
|
+
regexp_parser (2.2.0)
|
72
72
|
rexml (3.2.5)
|
73
73
|
rspec (3.10.0)
|
74
74
|
rspec-core (~> 3.10.0)
|
@@ -82,26 +82,25 @@ GEM
|
|
82
82
|
rspec-mocks (3.10.2)
|
83
83
|
diff-lcs (>= 1.2.0, < 2.0)
|
84
84
|
rspec-support (~> 3.10.0)
|
85
|
-
rspec-support (3.10.
|
85
|
+
rspec-support (3.10.3)
|
86
86
|
rspec_junit_formatter (0.4.1)
|
87
87
|
rspec-core (>= 2, < 4, != 2.12.0)
|
88
|
-
rubocop (1.
|
88
|
+
rubocop (1.24.0)
|
89
89
|
parallel (~> 1.10)
|
90
90
|
parser (>= 3.0.0.0)
|
91
91
|
rainbow (>= 2.2.2, < 4.0)
|
92
92
|
regexp_parser (>= 1.8, < 3.0)
|
93
93
|
rexml
|
94
|
-
rubocop-ast (>= 1.
|
94
|
+
rubocop-ast (>= 1.15.0, < 2.0)
|
95
95
|
ruby-progressbar (~> 1.7)
|
96
96
|
unicode-display_width (>= 1.4.0, < 3.0)
|
97
|
-
rubocop-ast (1.
|
97
|
+
rubocop-ast (1.15.0)
|
98
98
|
parser (>= 3.0.1.1)
|
99
|
-
rubocop-performance (1.
|
99
|
+
rubocop-performance (1.13.0)
|
100
100
|
rubocop (>= 1.7.0, < 2.0)
|
101
101
|
rubocop-ast (>= 0.4.0)
|
102
|
-
rubocop-rspec (2.
|
103
|
-
rubocop (~> 1.
|
104
|
-
rubocop-ast (>= 1.1.0)
|
102
|
+
rubocop-rspec (2.6.0)
|
103
|
+
rubocop (~> 1.19)
|
105
104
|
ruby-progressbar (1.11.0)
|
106
105
|
ruby2_keywords (0.0.5)
|
107
106
|
sawyer (0.8.2)
|
@@ -115,18 +114,21 @@ GEM
|
|
115
114
|
simplecov_json_formatter (0.1.3)
|
116
115
|
tzinfo (2.0.4)
|
117
116
|
concurrent-ruby (~> 1.0)
|
118
|
-
unicode-display_width (2.
|
117
|
+
unicode-display_width (2.1.0)
|
119
118
|
webmock (3.14.0)
|
120
119
|
addressable (>= 2.8.0)
|
121
120
|
crack (>= 0.3.2)
|
122
121
|
hashdiff (>= 0.4.0, < 2.0.0)
|
123
|
-
|
124
|
-
|
122
|
+
webrick (1.7.0)
|
123
|
+
yard (0.9.27)
|
124
|
+
webrick (~> 1.7.0)
|
125
|
+
zeitwerk (2.5.1)
|
125
126
|
|
126
127
|
PLATFORMS
|
127
128
|
ruby
|
128
129
|
|
129
130
|
DEPENDENCIES
|
131
|
+
activesupport (~> 6.1)
|
130
132
|
bugsnag (>= 6.11.0)
|
131
133
|
bundler (>= 2.0)
|
132
134
|
my_api_client!
|
data/README.jp.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# MyApiClient
|
4
4
|
|
5
|
-
MyApiClient は API リクエストクラスを作成するための汎用的な機能を提供します。Sawyer や Faraday をベースにエラーハンドリングの機能を強化した構造になっています。
|
5
|
+
MyApiClient は API リクエストクラスを作成するための汎用的な機能を提供します。[Sawyer](https://github.com/lostisland/sawyer) や [Faraday](https://github.com/lostisland/faraday) をベースにエラーハンドリングの機能を強化した構造になっています。
|
6
6
|
|
7
7
|
ただし、 Sawyer はダミーデータの作成が難しかったり、他の gem で競合することがよくあるので、将来的には依存しないように変更していくかもしれません。
|
8
8
|
|
@@ -13,11 +13,11 @@ MyApiClient は API リクエストクラスを作成するための汎用的な
|
|
13
13
|
## Supported Versions
|
14
14
|
|
15
15
|
* Ruby 2.6, 2.7, 3.0
|
16
|
-
* Rails 5.2, 6.0, 6.1
|
16
|
+
* Rails 5.2, 6.0, 6.1, 7.0
|
17
17
|
|
18
18
|
## Installation
|
19
19
|
|
20
|
-
|
20
|
+
`my_api_client` を Gemfile に追加して下さい:
|
21
21
|
|
22
22
|
```ruby
|
23
23
|
gem 'my_api_client'
|
@@ -130,13 +130,13 @@ api_clinet.pagination.each do |response|
|
|
130
130
|
# Do something.
|
131
131
|
end
|
132
132
|
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
133
|
+
result = api_clinet.pagination
|
134
|
+
result.next # => 1st page result
|
135
|
+
result.next # => 2nd page result
|
136
|
+
result.next # => 3rd page result
|
137
137
|
```
|
138
138
|
|
139
|
-
なお、`#each` はレスポンスに含まれる `paging` の値が nil になるまで繰り返されるのでご注意ください。例えば `#take` と組み合わせることでページネーションの上限を設定できます。
|
139
|
+
なお、`#each` はレスポンスに含まれる `paging` の値が `nil` になるまで繰り返されるのでご注意ください。例えば `#take` と組み合わせることでページネーションの上限を設定できます。
|
140
140
|
|
141
141
|
`#pageable_get` の alias として `#pget` も利用可能です。
|
142
142
|
|
@@ -206,12 +206,12 @@ end
|
|
206
206
|
API request `GET https://example.com/path/to/resouce`: "Server error occurred."
|
207
207
|
```
|
208
208
|
|
209
|
+
`json` には `Hash` の Key に [JSONPath](https://goessner.net/articles/JsonPath/) を指定して、レスポンス JSON から任意の値を取得し、 Value とマッチするかどうかでエラーハンドリングできます。Value には `String` `Integer` `Range` `Regexp` が指定可能です。上記の場合であれば、以下のような JSON にマッチします。
|
210
|
+
|
209
211
|
```ruby
|
210
212
|
error_handling json: { '$.errors.code': 10..19 }, with: :my_error_handling
|
211
213
|
```
|
212
214
|
|
213
|
-
`json` には `Hash` の Key に [JSONPath](https://goessner.net/articles/JsonPath/) を指定して、レスポンス JSON から任意の値を取得し、 Value とマッチするかどうかでエラーハンドリングできます。Value には `String` `Integer` `Range` `Regexp` が指定可能です。上記の場合であれば、以下のような JSON にマッチします。
|
214
|
-
|
215
215
|
```json
|
216
216
|
{
|
217
217
|
"erros": {
|