my_api_client 0.17.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 +5 -45
- data/.rubocop.yml +1 -1
- data/.rubocop_todo.yml +25 -1
- data/CHANGELOG.md +25 -0
- data/Gemfile +0 -3
- data/Gemfile.lock +37 -35
- data/README.jp.md +3 -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/rspec/USAGE +1 -1
- data/lib/generators/rspec/api_client_generator.rb +6 -0
- data/lib/generators/rspec/templates/api_client_spec.rb.erb +1 -1
- data/lib/my_api_client/params/params.rb +1 -3
- data/lib/my_api_client/version.rb +1 -1
- data/my_api/Gemfile.lock +36 -36
- data/my_api_client.gemspec +2 -2
- data/rails_app/rails_5.2/Gemfile +0 -1
- data/rails_app/rails_5.2/Gemfile.lock +1 -1
- data/rails_app/rails_6.0/Gemfile.lock +1 -1
- metadata +6 -7
- data/gemfiles/rails_4.2.gemfile +0 -15
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:
|
@@ -180,7 +180,8 @@ commands:
|
|
180
180
|
command: |
|
181
181
|
bin/rails g api_client path/to/resource \
|
182
182
|
get:path/to/resource \
|
183
|
-
post:path/to/resource
|
183
|
+
post:path/to/resource \
|
184
|
+
--endpoint https://example.com/myapi
|
184
185
|
- run:
|
185
186
|
name: Check the API client files exists
|
186
187
|
command: |
|
@@ -247,7 +248,7 @@ jobs:
|
|
247
248
|
- code-climate/install
|
248
249
|
- code-climate/sum-coverage:
|
249
250
|
input: codeclimate.*.json
|
250
|
-
parts:
|
251
|
+
parts: 13
|
251
252
|
- code-climate/upload-coverage
|
252
253
|
rubocop:
|
253
254
|
executor: gem_executor
|
@@ -275,26 +276,6 @@ workflows:
|
|
275
276
|
|
276
277
|
commit:
|
277
278
|
jobs:
|
278
|
-
- build_gem:
|
279
|
-
name: build_on_ruby_2.4_and_rails_4.2
|
280
|
-
ruby_version: '2.4'
|
281
|
-
rails_version: '4.2'
|
282
|
-
- build_gem:
|
283
|
-
name: build_on_ruby_2.4_and_rails_5.0
|
284
|
-
ruby_version: '2.4'
|
285
|
-
rails_version: '5.0'
|
286
|
-
- build_gem:
|
287
|
-
name: build_on_ruby_2.4_and_rails_5.1
|
288
|
-
ruby_version: '2.4'
|
289
|
-
rails_version: '5.1'
|
290
|
-
- build_gem:
|
291
|
-
name: build_on_ruby_2.4_and_rails_5.2
|
292
|
-
ruby_version: '2.4'
|
293
|
-
rails_version: '5.2'
|
294
|
-
- build_gem:
|
295
|
-
name: build_on_ruby_2.5_and_rails_4.2
|
296
|
-
ruby_version: '2.5'
|
297
|
-
rails_version: '4.2'
|
298
279
|
- build_gem:
|
299
280
|
name: build_on_ruby_2.5_and_rails_5.0
|
300
281
|
ruby_version: '2.5'
|
@@ -311,10 +292,6 @@ workflows:
|
|
311
292
|
name: build_on_ruby_2.5_and_rails_6.0
|
312
293
|
ruby_version: '2.5'
|
313
294
|
rails_version: '6.0'
|
314
|
-
- build_gem:
|
315
|
-
name: build_on_ruby_2.6_and_rails_4.2
|
316
|
-
ruby_version: '2.6'
|
317
|
-
rails_version: '4.2'
|
318
295
|
- build_gem:
|
319
296
|
name: build_on_ruby_2.6_and_rails_5.0
|
320
297
|
ruby_version: '2.6'
|
@@ -353,10 +330,6 @@ workflows:
|
|
353
330
|
ruby_version: '2.7'
|
354
331
|
rails_version: '6.0'
|
355
332
|
bundler_options: '--without integrations'
|
356
|
-
- verify_generator:
|
357
|
-
name: verify_generator_on_ruby_2.4_and_rails_5.2
|
358
|
-
ruby_version: '2.4'
|
359
|
-
rails_version: '5.2'
|
360
333
|
- verify_generator:
|
361
334
|
name: verify_generator_on_ruby_2.5_and_rails_5.2
|
362
335
|
ruby_version: '2.5'
|
@@ -386,16 +359,10 @@ workflows:
|
|
386
359
|
- yardoc
|
387
360
|
- upload-coverage:
|
388
361
|
requires:
|
389
|
-
- build_on_ruby_2.4_and_rails_4.2
|
390
|
-
- build_on_ruby_2.4_and_rails_5.0
|
391
|
-
- build_on_ruby_2.4_and_rails_5.1
|
392
|
-
- build_on_ruby_2.4_and_rails_5.2
|
393
|
-
- build_on_ruby_2.5_and_rails_4.2
|
394
362
|
- build_on_ruby_2.5_and_rails_5.0
|
395
363
|
- build_on_ruby_2.5_and_rails_5.1
|
396
364
|
- build_on_ruby_2.5_and_rails_5.2
|
397
365
|
- build_on_ruby_2.5_and_rails_6.0
|
398
|
-
- build_on_ruby_2.6_and_rails_4.2
|
399
366
|
- build_on_ruby_2.6_and_rails_5.0
|
400
367
|
- build_on_ruby_2.6_and_rails_5.1
|
401
368
|
- build_on_ruby_2.6_and_rails_5.2
|
@@ -408,16 +375,10 @@ workflows:
|
|
408
375
|
- release:
|
409
376
|
context: RubyGems API Key
|
410
377
|
requires:
|
411
|
-
- build_on_ruby_2.4_and_rails_4.2
|
412
|
-
- build_on_ruby_2.4_and_rails_5.0
|
413
|
-
- build_on_ruby_2.4_and_rails_5.1
|
414
|
-
- build_on_ruby_2.4_and_rails_5.2
|
415
|
-
- build_on_ruby_2.5_and_rails_4.2
|
416
378
|
- build_on_ruby_2.5_and_rails_5.0
|
417
379
|
- build_on_ruby_2.5_and_rails_5.1
|
418
380
|
- build_on_ruby_2.5_and_rails_5.2
|
419
381
|
- build_on_ruby_2.5_and_rails_6.0
|
420
|
-
- build_on_ruby_2.6_and_rails_4.2
|
421
382
|
- build_on_ruby_2.6_and_rails_5.0
|
422
383
|
- build_on_ruby_2.6_and_rails_5.1
|
423
384
|
- build_on_ruby_2.6_and_rails_5.2
|
@@ -427,7 +388,6 @@ workflows:
|
|
427
388
|
- build_on_ruby_2.7_and_rails_5.2
|
428
389
|
- build_on_ruby_2.7_and_rails_6.0_with_integrations
|
429
390
|
- build_on_ruby_2.7_and_rails_6.0_without_integrations
|
430
|
-
- verify_generator_on_ruby_2.4_and_rails_5.2
|
431
391
|
- verify_generator_on_ruby_2.5_and_rails_5.2
|
432
392
|
- verify_generator_on_ruby_2.5_and_rails_6.0
|
433
393
|
- verify_generator_on_ruby_2.6_and_rails_5.2
|
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
CHANGED
@@ -1,11 +1,19 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on 2020-
|
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
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
|
+
|
9
17
|
# Offense count: 5
|
10
18
|
Lint/MissingSuper:
|
11
19
|
Exclude:
|
@@ -15,11 +23,27 @@ Lint/MissingSuper:
|
|
15
23
|
- 'lib/my_api_client/request/executor.rb'
|
16
24
|
- 'lib/my_api_client/sleeper.rb'
|
17
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
|
+
|
18
35
|
# Offense count: 60
|
19
36
|
# Configuration parameters: AllowSubject.
|
20
37
|
RSpec/MultipleMemoizedHelpers:
|
21
38
|
Max: 15
|
22
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
|
+
|
23
47
|
# Offense count: 1
|
24
48
|
# Cop supports --auto-correct.
|
25
49
|
Style/HashTransformValues:
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,30 @@
|
|
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
|
+
|
3
28
|
## v0.17.0 (Sep 20, 2020)
|
4
29
|
|
5
30
|
### 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.18.0)
|
5
|
+
activesupport (>= 5.0.0)
|
6
6
|
faraday (>= 0.17.1)
|
7
7
|
jsonpath
|
8
8
|
sawyer (>= 0.8.2)
|
@@ -10,15 +10,16 @@ PATH
|
|
10
10
|
GEM
|
11
11
|
remote: https://rubygems.org/
|
12
12
|
specs:
|
13
|
-
activesupport (
|
13
|
+
activesupport (6.0.3.4)
|
14
14
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
15
15
|
i18n (>= 0.7, < 2)
|
16
16
|
minitest (~> 5.1)
|
17
17
|
tzinfo (~> 1.1)
|
18
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
18
19
|
addressable (2.7.0)
|
19
20
|
public_suffix (>= 2.0.2, < 5.0)
|
20
21
|
ast (2.4.1)
|
21
|
-
bugsnag (6.
|
22
|
+
bugsnag (6.18.0)
|
22
23
|
concurrent-ruby (~> 1.0)
|
23
24
|
byebug (11.1.3)
|
24
25
|
coderay (1.1.3)
|
@@ -26,21 +27,21 @@ GEM
|
|
26
27
|
crack (0.4.4)
|
27
28
|
diff-lcs (1.4.4)
|
28
29
|
docile (1.3.2)
|
29
|
-
faraday (1.0
|
30
|
+
faraday (1.1.0)
|
30
31
|
multipart-post (>= 1.2, < 3)
|
32
|
+
ruby2_keywords
|
31
33
|
hashdiff (1.0.1)
|
32
34
|
i18n (1.8.5)
|
33
35
|
concurrent-ruby (~> 1.0)
|
34
36
|
json (2.3.1)
|
35
|
-
jsonpath (1.0.
|
37
|
+
jsonpath (1.0.6)
|
36
38
|
multi_json
|
37
|
-
to_regexp (~> 0.2.1)
|
38
39
|
method_source (1.0.0)
|
39
40
|
minitest (5.14.2)
|
40
41
|
multi_json (1.15.0)
|
41
42
|
multipart-post (2.1.1)
|
42
|
-
parallel (1.
|
43
|
-
parser (2.7.
|
43
|
+
parallel (1.20.1)
|
44
|
+
parser (2.7.2.0)
|
44
45
|
ast (~> 2.4.1)
|
45
46
|
pry (0.13.1)
|
46
47
|
coderay (~> 1.1)
|
@@ -51,40 +52,42 @@ GEM
|
|
51
52
|
public_suffix (4.0.6)
|
52
53
|
rainbow (3.0.0)
|
53
54
|
rake (13.0.1)
|
54
|
-
regexp_parser (
|
55
|
+
regexp_parser (2.0.0)
|
55
56
|
rexml (3.2.4)
|
56
|
-
rspec (3.
|
57
|
-
rspec-core (~> 3.
|
58
|
-
rspec-expectations (~> 3.
|
59
|
-
rspec-mocks (~> 3.
|
60
|
-
rspec-core (3.
|
61
|
-
rspec-support (~> 3.
|
62
|
-
rspec-expectations (3.
|
57
|
+
rspec (3.10.0)
|
58
|
+
rspec-core (~> 3.10.0)
|
59
|
+
rspec-expectations (~> 3.10.0)
|
60
|
+
rspec-mocks (~> 3.10.0)
|
61
|
+
rspec-core (3.10.0)
|
62
|
+
rspec-support (~> 3.10.0)
|
63
|
+
rspec-expectations (3.10.0)
|
63
64
|
diff-lcs (>= 1.2.0, < 2.0)
|
64
|
-
rspec-support (~> 3.
|
65
|
-
rspec-mocks (3.
|
65
|
+
rspec-support (~> 3.10.0)
|
66
|
+
rspec-mocks (3.10.0)
|
66
67
|
diff-lcs (>= 1.2.0, < 2.0)
|
67
|
-
rspec-support (~> 3.
|
68
|
-
rspec-support (3.
|
68
|
+
rspec-support (~> 3.10.0)
|
69
|
+
rspec-support (3.10.0)
|
69
70
|
rspec_junit_formatter (0.4.1)
|
70
71
|
rspec-core (>= 2, < 4, != 2.12.0)
|
71
|
-
rubocop (
|
72
|
+
rubocop (1.5.1)
|
72
73
|
parallel (~> 1.10)
|
73
|
-
parser (>= 2.7.1.
|
74
|
+
parser (>= 2.7.1.5)
|
74
75
|
rainbow (>= 2.2.2, < 4.0)
|
75
|
-
regexp_parser (>=
|
76
|
+
regexp_parser (>= 2.0)
|
76
77
|
rexml
|
77
|
-
rubocop-ast (>=
|
78
|
+
rubocop-ast (>= 1.2.0)
|
78
79
|
ruby-progressbar (~> 1.7)
|
79
80
|
unicode-display_width (>= 1.4.0, < 2.0)
|
80
|
-
rubocop-ast (
|
81
|
-
parser (>= 2.7.1.
|
82
|
-
rubocop-performance (1.
|
83
|
-
rubocop (>= 0.
|
81
|
+
rubocop-ast (1.3.0)
|
82
|
+
parser (>= 2.7.1.5)
|
83
|
+
rubocop-performance (1.9.1)
|
84
|
+
rubocop (>= 0.90.0, < 2.0)
|
84
85
|
rubocop-ast (>= 0.4.0)
|
85
|
-
rubocop-rspec (
|
86
|
-
rubocop (~> 0
|
86
|
+
rubocop-rspec (2.0.1)
|
87
|
+
rubocop (~> 1.0)
|
88
|
+
rubocop-ast (>= 1.1.0)
|
87
89
|
ruby-progressbar (1.10.1)
|
90
|
+
ruby2_keywords (0.0.2)
|
88
91
|
sawyer (0.8.2)
|
89
92
|
addressable (>= 2.3.5)
|
90
93
|
faraday (> 0.8, < 2.0)
|
@@ -94,21 +97,20 @@ GEM
|
|
94
97
|
simplecov-html (~> 0.10.0)
|
95
98
|
simplecov-html (0.10.2)
|
96
99
|
thread_safe (0.3.6)
|
97
|
-
|
98
|
-
tzinfo (1.2.7)
|
100
|
+
tzinfo (1.2.8)
|
99
101
|
thread_safe (~> 0.1)
|
100
102
|
unicode-display_width (1.7.0)
|
101
|
-
webmock (3.
|
103
|
+
webmock (3.10.0)
|
102
104
|
addressable (>= 2.3.6)
|
103
105
|
crack (>= 0.3.2)
|
104
106
|
hashdiff (>= 0.4.0, < 2.0.0)
|
105
107
|
yard (0.9.25)
|
108
|
+
zeitwerk (2.4.2)
|
106
109
|
|
107
110
|
PLATFORMS
|
108
111
|
ruby
|
109
112
|
|
110
113
|
DEPENDENCIES
|
111
|
-
activesupport (< 6.0.0)
|
112
114
|
bugsnag (>= 6.11.0)
|
113
115
|
bundler (>= 2.0)
|
114
116
|
my_api_client!
|
data/README.jp.md
CHANGED
@@ -12,8 +12,8 @@ MyApiClient は API リクエストクラスを作成するための汎用的な
|
|
12
12
|
|
13
13
|
## Supported Versions
|
14
14
|
|
15
|
-
* Ruby 2.
|
16
|
-
* Rails
|
15
|
+
* Ruby 2.5, 2.6, 2.7
|
16
|
+
* Rails 5.0, 5.1, 5.2, 6.0
|
17
17
|
|
18
18
|
## Installation
|
19
19
|
|
@@ -26,7 +26,7 @@ gem 'my_api_client'
|
|
26
26
|
Ruby on Rails を利用している場合は `generator` 機能を利用できます。
|
27
27
|
|
28
28
|
```sh
|
29
|
-
$ 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
|
30
30
|
|
31
31
|
create app/api_clients/application_api_client.rb
|
32
32
|
create app/api_clients/path/to/resource_api_client.rb
|
data/lib/generators/rails/USAGE
CHANGED
@@ -2,7 +2,7 @@ Description:
|
|
2
2
|
Generate a new api client class files.
|
3
3
|
|
4
4
|
Example:
|
5
|
-
`rails g api_client path/to/resource get:path/to/resource`
|
5
|
+
`rails g api_client path/to/resource get:path/to/resource` --endpoint https://example.com
|
6
6
|
|
7
7
|
This will create:
|
8
8
|
create app/api_clients/application_api_client.rb
|
@@ -15,6 +15,12 @@ module Rails
|
|
15
15
|
default: %w[get:path/to/resource post:path/to/resource],
|
16
16
|
banner: '{method}:{path} {method}:{path}'
|
17
17
|
|
18
|
+
class_option :endpoint,
|
19
|
+
type: :string,
|
20
|
+
default: 'https://example.com',
|
21
|
+
banner: 'https://example.com',
|
22
|
+
desc: 'Common part of the target API endpoint'
|
23
|
+
|
18
24
|
def generate_root_class
|
19
25
|
file_path = File.join('app/api_clients', 'application_api_client.rb')
|
20
26
|
return if File.exist?(file_path)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class <%= "#{class_name}ApiClient" %> < ::ApplicationApiClient
|
4
|
-
endpoint '
|
4
|
+
endpoint '<%= options[:endpoint] %>'
|
5
5
|
|
6
6
|
# error_handling json: { '$.errors.code': 10 } do |params, logger|
|
7
7
|
# # Behavior when detected an error.
|
data/lib/generators/rspec/USAGE
CHANGED
@@ -2,7 +2,7 @@ Description:
|
|
2
2
|
Generate a new api client spec files.
|
3
3
|
|
4
4
|
Example:
|
5
|
-
rails g rspec:api_client path/to/resource get:path/to/resource`
|
5
|
+
rails g rspec:api_client path/to/resource get:path/to/resource` --endpoint https://example.com
|
6
6
|
|
7
7
|
This will create:
|
8
8
|
create spec/api_clients/path/to/resource_api_client_spec.rb
|
@@ -16,6 +16,12 @@ module Rspec
|
|
16
16
|
default: %w[get:path/to/resource post:path/to/resource],
|
17
17
|
banner: '{method}:{path} {method}:{path}'
|
18
18
|
|
19
|
+
class_option :endpoint,
|
20
|
+
type: :string,
|
21
|
+
default: 'https://example.com',
|
22
|
+
banner: 'https://example.com',
|
23
|
+
desc: 'Common part of the target API endpoint'
|
24
|
+
|
19
25
|
class_option :api_client_specs, type: :boolean, default: true
|
20
26
|
|
21
27
|
def generate_api_client_spec
|
@@ -44,7 +44,7 @@ RSpec.describe <%= "#{class_name}ApiClient" %>, <%= type_metatag(:api_client) %>
|
|
44
44
|
|
45
45
|
it do
|
46
46
|
expect { api_request }
|
47
|
-
.to request_to(:<%= http_method %>, '
|
47
|
+
.to request_to(:<%= http_method %>, '<%= options[:endpoint] %>/<%= pathname %>')
|
48
48
|
<% if http_method == 'get' -%>
|
49
49
|
.with(headers: headers, query: {})
|
50
50
|
<% else -%>
|
@@ -40,9 +40,7 @@ module MyApiClient
|
|
40
40
|
# @return [Hash] Metadata for bugsnag
|
41
41
|
def request_metadata
|
42
42
|
if request.present?
|
43
|
-
request.metadata.
|
44
|
-
memo[:"request_#{key}"] = value
|
45
|
-
end
|
43
|
+
request.metadata.transform_keys { |key| :"request_#{key}" }
|
46
44
|
else
|
47
45
|
{}
|
48
46
|
end
|
data/my_api/Gemfile.lock
CHANGED
@@ -1,34 +1,34 @@
|
|
1
1
|
GEM
|
2
2
|
remote: https://rubygems.org/
|
3
3
|
specs:
|
4
|
-
actionmailer (6.0.3.
|
5
|
-
actionpack (= 6.0.3.
|
6
|
-
actionview (= 6.0.3.
|
7
|
-
activejob (= 6.0.3.
|
4
|
+
actionmailer (6.0.3.4)
|
5
|
+
actionpack (= 6.0.3.4)
|
6
|
+
actionview (= 6.0.3.4)
|
7
|
+
activejob (= 6.0.3.4)
|
8
8
|
mail (~> 2.5, >= 2.5.4)
|
9
9
|
rails-dom-testing (~> 2.0)
|
10
|
-
actionpack (6.0.3.
|
11
|
-
actionview (= 6.0.3.
|
12
|
-
activesupport (= 6.0.3.
|
10
|
+
actionpack (6.0.3.4)
|
11
|
+
actionview (= 6.0.3.4)
|
12
|
+
activesupport (= 6.0.3.4)
|
13
13
|
rack (~> 2.0, >= 2.0.8)
|
14
14
|
rack-test (>= 0.6.3)
|
15
15
|
rails-dom-testing (~> 2.0)
|
16
16
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
17
|
-
actionview (6.0.3.
|
18
|
-
activesupport (= 6.0.3.
|
17
|
+
actionview (6.0.3.4)
|
18
|
+
activesupport (= 6.0.3.4)
|
19
19
|
builder (~> 3.1)
|
20
20
|
erubi (~> 1.4)
|
21
21
|
rails-dom-testing (~> 2.0)
|
22
22
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
23
|
-
activejob (6.0.3.
|
24
|
-
activesupport (= 6.0.3.
|
23
|
+
activejob (6.0.3.4)
|
24
|
+
activesupport (= 6.0.3.4)
|
25
25
|
globalid (>= 0.3.6)
|
26
|
-
activemodel (6.0.3.
|
27
|
-
activesupport (= 6.0.3.
|
28
|
-
activerecord (6.0.3.
|
29
|
-
activemodel (= 6.0.3.
|
30
|
-
activesupport (= 6.0.3.
|
31
|
-
activesupport (6.0.3.
|
26
|
+
activemodel (6.0.3.4)
|
27
|
+
activesupport (= 6.0.3.4)
|
28
|
+
activerecord (6.0.3.4)
|
29
|
+
activemodel (= 6.0.3.4)
|
30
|
+
activesupport (= 6.0.3.4)
|
31
|
+
activesupport (6.0.3.4)
|
32
32
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
33
33
|
i18n (>= 0.7, < 2)
|
34
34
|
minitest (~> 5.1)
|
@@ -90,7 +90,7 @@ GEM
|
|
90
90
|
aws_config (0.1.0)
|
91
91
|
builder (3.2.4)
|
92
92
|
byebug (11.1.3)
|
93
|
-
capybara (3.
|
93
|
+
capybara (3.34.0)
|
94
94
|
addressable
|
95
95
|
mini_mime (>= 0.1.3)
|
96
96
|
nokogiri (~> 1.8)
|
@@ -105,7 +105,7 @@ GEM
|
|
105
105
|
cfnresponse (0.4.0)
|
106
106
|
concurrent-ruby (1.1.7)
|
107
107
|
crass (1.0.6)
|
108
|
-
diff-lcs (1.
|
108
|
+
diff-lcs (1.4.4)
|
109
109
|
dotenv (2.7.6)
|
110
110
|
dynomite (1.2.6)
|
111
111
|
activesupport
|
@@ -176,8 +176,8 @@ GEM
|
|
176
176
|
nio4r (2.5.4)
|
177
177
|
nokogiri (1.10.10)
|
178
178
|
mini_portile2 (~> 2.4.0)
|
179
|
-
public_suffix (4.0.
|
180
|
-
puma (5.
|
179
|
+
public_suffix (4.0.6)
|
180
|
+
puma (5.1.0)
|
181
181
|
nio4r (~> 2.0)
|
182
182
|
rack (2.2.3)
|
183
183
|
rack-test (1.1.0)
|
@@ -187,30 +187,30 @@ GEM
|
|
187
187
|
nokogiri (>= 1.6)
|
188
188
|
rails-html-sanitizer (1.3.0)
|
189
189
|
loofah (~> 2.3)
|
190
|
-
railties (6.0.3.
|
191
|
-
actionpack (= 6.0.3.
|
192
|
-
activesupport (= 6.0.3.
|
190
|
+
railties (6.0.3.4)
|
191
|
+
actionpack (= 6.0.3.4)
|
192
|
+
activesupport (= 6.0.3.4)
|
193
193
|
method_source
|
194
194
|
rake (>= 0.8.7)
|
195
195
|
thor (>= 0.20.3, < 2.0)
|
196
196
|
rainbow (3.0.0)
|
197
197
|
rake (13.0.1)
|
198
198
|
recursive-open-struct (1.1.2)
|
199
|
-
regexp_parser (1.
|
199
|
+
regexp_parser (1.8.2)
|
200
200
|
rexml (3.2.4)
|
201
|
-
rspec (3.
|
202
|
-
rspec-core (~> 3.
|
203
|
-
rspec-expectations (~> 3.
|
204
|
-
rspec-mocks (~> 3.
|
205
|
-
rspec-core (3.
|
206
|
-
rspec-support (~> 3.
|
207
|
-
rspec-expectations (3.
|
201
|
+
rspec (3.10.0)
|
202
|
+
rspec-core (~> 3.10.0)
|
203
|
+
rspec-expectations (~> 3.10.0)
|
204
|
+
rspec-mocks (~> 3.10.0)
|
205
|
+
rspec-core (3.10.0)
|
206
|
+
rspec-support (~> 3.10.0)
|
207
|
+
rspec-expectations (3.10.0)
|
208
208
|
diff-lcs (>= 1.2.0, < 2.0)
|
209
|
-
rspec-support (~> 3.
|
210
|
-
rspec-mocks (3.
|
209
|
+
rspec-support (~> 3.10.0)
|
210
|
+
rspec-mocks (3.10.0)
|
211
211
|
diff-lcs (>= 1.2.0, < 2.0)
|
212
|
-
rspec-support (~> 3.
|
213
|
-
rspec-support (3.
|
212
|
+
rspec-support (~> 3.10.0)
|
213
|
+
rspec-support (3.10.0)
|
214
214
|
rspec_junit_formatter (0.4.1)
|
215
215
|
rspec-core (>= 2, < 4, != 2.12.0)
|
216
216
|
shotgun (0.9.2)
|
data/my_api_client.gemspec
CHANGED
@@ -22,9 +22,9 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
23
|
spec.require_paths = ['lib']
|
24
24
|
|
25
|
-
spec.required_ruby_version = '>= 2.
|
25
|
+
spec.required_ruby_version = '>= 2.5.0'
|
26
26
|
|
27
|
-
spec.add_dependency 'activesupport', '>=
|
27
|
+
spec.add_dependency 'activesupport', '>= 5.0.0'
|
28
28
|
spec.add_dependency 'faraday', '>= 0.17.1'
|
29
29
|
spec.add_dependency 'jsonpath'
|
30
30
|
spec.add_dependency 'sawyer', '>= 0.8.2'
|
data/rails_app/rails_5.2/Gemfile
CHANGED
@@ -6,7 +6,6 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
|
6
6
|
gem 'bootsnap', '>= 1.1.0', require: false
|
7
7
|
gem 'my_api_client', path: '../..'
|
8
8
|
gem 'rails', '~> 5.2.4'
|
9
|
-
gem 'sprockets', '~> 3.0' # for ruby 2.4
|
10
9
|
|
11
10
|
group :development, :test do
|
12
11
|
gem 'byebug', platforms: %i[mri mingw x64_mingw]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: my_api_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.18.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ryz310
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 5.0.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 5.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: faraday
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -252,7 +252,6 @@ files:
|
|
252
252
|
- example/api_clients/my_pagination_api_client.rb
|
253
253
|
- example/api_clients/my_rest_api_client.rb
|
254
254
|
- example/api_clients/my_status_api_client.rb
|
255
|
-
- gemfiles/rails_4.2.gemfile
|
256
255
|
- gemfiles/rails_5.0.gemfile
|
257
256
|
- gemfiles/rails_5.1.gemfile
|
258
257
|
- gemfiles/rails_5.2.gemfile
|
@@ -409,14 +408,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
409
408
|
requirements:
|
410
409
|
- - ">="
|
411
410
|
- !ruby/object:Gem::Version
|
412
|
-
version: 2.
|
411
|
+
version: 2.5.0
|
413
412
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
414
413
|
requirements:
|
415
414
|
- - ">="
|
416
415
|
- !ruby/object:Gem::Version
|
417
416
|
version: '0'
|
418
417
|
requirements: []
|
419
|
-
rubygems_version: 3.1.
|
418
|
+
rubygems_version: 3.1.4
|
420
419
|
signing_key:
|
421
420
|
specification_version: 4
|
422
421
|
summary: The framework of Web API Client
|
data/gemfiles/rails_4.2.gemfile
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# This file was generated by Appraisal
|
4
|
-
|
5
|
-
source 'https://rubygems.org'
|
6
|
-
|
7
|
-
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
8
|
-
|
9
|
-
gem 'activesupport', '~> 4.2.0'
|
10
|
-
|
11
|
-
group :integrations, optional: true do
|
12
|
-
gem 'bugsnag', '>= 6.11.0'
|
13
|
-
end
|
14
|
-
|
15
|
-
gemspec
|