my_api_client 0.17.0 → 0.21.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +32 -158
- data/.gem_comet.yml +13 -2
- data/.github/dependabot.yml +32 -0
- data/.rubocop.yml +1 -1
- data/.rubocop_todo.yml +22 -12
- data/CHANGELOG.md +61 -74
- data/Gemfile +0 -3
- data/Gemfile.lock +79 -61
- data/README.jp.md +71 -7
- data/gemfiles/rails_5.0.gemfile +1 -0
- data/gemfiles/rails_5.1.gemfile +1 -0
- data/gemfiles/rails_5.2.gemfile +1 -0
- data/gemfiles/rails_6.0.gemfile +1 -0
- 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/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/base.rb +2 -9
- data/lib/my_api_client/integrations/bugsnag.rb +1 -1
- data/lib/my_api_client/params/params.rb +1 -3
- data/lib/my_api_client/request.rb +1 -1
- data/lib/my_api_client/rspec/matchers/be_handled_as_an_error.rb +3 -3
- data/lib/my_api_client/rspec/matchers/request_to.rb +1 -1
- data/lib/my_api_client/rspec/stub.rb +40 -15
- data/lib/my_api_client/version.rb +1 -1
- data/my_api/.ruby-version +1 -1
- data/my_api/Gemfile +3 -0
- data/my_api/Gemfile.lock +112 -105
- data/my_api/app/controllers/pagination_controller.rb +2 -2
- data/my_api/public/index.html +2 -2
- data/my_api_client.gemspec +3 -3
- data/rails_app/rails_5.2/Gemfile +0 -1
- data/rails_app/rails_5.2/Gemfile.lock +73 -64
- data/rails_app/rails_5.2/config/environments/production.rb +1 -1
- data/rails_app/rails_6.0/Gemfile.lock +87 -77
- data/rails_app/rails_6.0/config/environments/production.rb +1 -1
- 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 +203 -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 +52 -11
- data/.dependabot/config.yml +0 -34
- data/.rubocop_challenge.yml +0 -5
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.21.0)
|
5
|
+
activesupport (>= 5.2.0)
|
6
6
|
faraday (>= 0.17.1)
|
7
7
|
jsonpath
|
8
8
|
sawyer (>= 0.8.2)
|
@@ -10,37 +10,54 @@ PATH
|
|
10
10
|
GEM
|
11
11
|
remote: https://rubygems.org/
|
12
12
|
specs:
|
13
|
-
activesupport (
|
13
|
+
activesupport (6.1.4)
|
14
14
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
15
|
-
i18n (>=
|
16
|
-
minitest (
|
17
|
-
tzinfo (~>
|
18
|
-
|
15
|
+
i18n (>= 1.6, < 2)
|
16
|
+
minitest (>= 5.1)
|
17
|
+
tzinfo (~> 2.0)
|
18
|
+
zeitwerk (~> 2.3)
|
19
|
+
addressable (2.8.0)
|
19
20
|
public_suffix (>= 2.0.2, < 5.0)
|
20
|
-
ast (2.4.
|
21
|
-
bugsnag (6.
|
21
|
+
ast (2.4.2)
|
22
|
+
bugsnag (6.21.0)
|
22
23
|
concurrent-ruby (~> 1.0)
|
23
24
|
byebug (11.1.3)
|
24
25
|
coderay (1.1.3)
|
25
|
-
concurrent-ruby (1.1.
|
26
|
-
crack (0.4.
|
26
|
+
concurrent-ruby (1.1.9)
|
27
|
+
crack (0.4.5)
|
28
|
+
rexml
|
27
29
|
diff-lcs (1.4.4)
|
28
|
-
docile (1.
|
29
|
-
faraday (1.0
|
30
|
+
docile (1.4.0)
|
31
|
+
faraday (1.6.0)
|
32
|
+
faraday-em_http (~> 1.0)
|
33
|
+
faraday-em_synchrony (~> 1.0)
|
34
|
+
faraday-excon (~> 1.1)
|
35
|
+
faraday-httpclient (~> 1.0.1)
|
36
|
+
faraday-net_http (~> 1.0)
|
37
|
+
faraday-net_http_persistent (~> 1.1)
|
38
|
+
faraday-patron (~> 1.0)
|
39
|
+
faraday-rack (~> 1.0)
|
30
40
|
multipart-post (>= 1.2, < 3)
|
41
|
+
ruby2_keywords (>= 0.0.4)
|
42
|
+
faraday-em_http (1.0.0)
|
43
|
+
faraday-em_synchrony (1.0.0)
|
44
|
+
faraday-excon (1.1.0)
|
45
|
+
faraday-httpclient (1.0.1)
|
46
|
+
faraday-net_http (1.0.1)
|
47
|
+
faraday-net_http_persistent (1.2.0)
|
48
|
+
faraday-patron (1.0.0)
|
49
|
+
faraday-rack (1.0.0)
|
31
50
|
hashdiff (1.0.1)
|
32
|
-
i18n (1.8.
|
51
|
+
i18n (1.8.10)
|
33
52
|
concurrent-ruby (~> 1.0)
|
34
|
-
|
35
|
-
jsonpath (1.0.5)
|
53
|
+
jsonpath (1.1.0)
|
36
54
|
multi_json
|
37
|
-
to_regexp (~> 0.2.1)
|
38
55
|
method_source (1.0.0)
|
39
|
-
minitest (5.14.
|
56
|
+
minitest (5.14.4)
|
40
57
|
multi_json (1.15.0)
|
41
58
|
multipart-post (2.1.1)
|
42
|
-
parallel (1.
|
43
|
-
parser (
|
59
|
+
parallel (1.20.1)
|
60
|
+
parser (3.0.2.0)
|
44
61
|
ast (~> 2.4.1)
|
45
62
|
pry (0.13.1)
|
46
63
|
coderay (~> 1.1)
|
@@ -50,65 +67,66 @@ GEM
|
|
50
67
|
pry (~> 0.13.0)
|
51
68
|
public_suffix (4.0.6)
|
52
69
|
rainbow (3.0.0)
|
53
|
-
rake (13.0.
|
54
|
-
regexp_parser (1.
|
55
|
-
rexml (3.2.
|
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.
|
70
|
+
rake (13.0.6)
|
71
|
+
regexp_parser (2.1.1)
|
72
|
+
rexml (3.2.5)
|
73
|
+
rspec (3.10.0)
|
74
|
+
rspec-core (~> 3.10.0)
|
75
|
+
rspec-expectations (~> 3.10.0)
|
76
|
+
rspec-mocks (~> 3.10.0)
|
77
|
+
rspec-core (3.10.1)
|
78
|
+
rspec-support (~> 3.10.0)
|
79
|
+
rspec-expectations (3.10.1)
|
63
80
|
diff-lcs (>= 1.2.0, < 2.0)
|
64
|
-
rspec-support (~> 3.
|
65
|
-
rspec-mocks (3.
|
81
|
+
rspec-support (~> 3.10.0)
|
82
|
+
rspec-mocks (3.10.2)
|
66
83
|
diff-lcs (>= 1.2.0, < 2.0)
|
67
|
-
rspec-support (~> 3.
|
68
|
-
rspec-support (3.
|
84
|
+
rspec-support (~> 3.10.0)
|
85
|
+
rspec-support (3.10.2)
|
69
86
|
rspec_junit_formatter (0.4.1)
|
70
87
|
rspec-core (>= 2, < 4, != 2.12.0)
|
71
|
-
rubocop (
|
88
|
+
rubocop (1.18.4)
|
72
89
|
parallel (~> 1.10)
|
73
|
-
parser (>=
|
90
|
+
parser (>= 3.0.0.0)
|
74
91
|
rainbow (>= 2.2.2, < 4.0)
|
75
|
-
regexp_parser (>= 1.
|
92
|
+
regexp_parser (>= 1.8, < 3.0)
|
76
93
|
rexml
|
77
|
-
rubocop-ast (>=
|
94
|
+
rubocop-ast (>= 1.8.0, < 2.0)
|
78
95
|
ruby-progressbar (~> 1.7)
|
79
|
-
unicode-display_width (>= 1.4.0, <
|
80
|
-
rubocop-ast (
|
81
|
-
parser (>=
|
82
|
-
rubocop-performance (1.
|
83
|
-
rubocop (>=
|
96
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
97
|
+
rubocop-ast (1.9.0)
|
98
|
+
parser (>= 3.0.1.1)
|
99
|
+
rubocop-performance (1.11.4)
|
100
|
+
rubocop (>= 1.7.0, < 2.0)
|
84
101
|
rubocop-ast (>= 0.4.0)
|
85
|
-
rubocop-rspec (
|
86
|
-
rubocop (~> 0
|
87
|
-
|
102
|
+
rubocop-rspec (2.4.0)
|
103
|
+
rubocop (~> 1.0)
|
104
|
+
rubocop-ast (>= 1.1.0)
|
105
|
+
ruby-progressbar (1.11.0)
|
106
|
+
ruby2_keywords (0.0.5)
|
88
107
|
sawyer (0.8.2)
|
89
108
|
addressable (>= 2.3.5)
|
90
109
|
faraday (> 0.8, < 2.0)
|
91
|
-
simplecov (0.
|
110
|
+
simplecov (0.21.2)
|
92
111
|
docile (~> 1.1)
|
93
|
-
|
94
|
-
|
95
|
-
simplecov-html (0.
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
addressable (>= 2.3.6)
|
112
|
+
simplecov-html (~> 0.11)
|
113
|
+
simplecov_json_formatter (~> 0.1)
|
114
|
+
simplecov-html (0.12.3)
|
115
|
+
simplecov_json_formatter (0.1.3)
|
116
|
+
tzinfo (2.0.4)
|
117
|
+
concurrent-ruby (~> 1.0)
|
118
|
+
unicode-display_width (2.0.0)
|
119
|
+
webmock (3.14.0)
|
120
|
+
addressable (>= 2.8.0)
|
103
121
|
crack (>= 0.3.2)
|
104
122
|
hashdiff (>= 0.4.0, < 2.0.0)
|
105
|
-
yard (0.9.
|
123
|
+
yard (0.9.26)
|
124
|
+
zeitwerk (2.4.2)
|
106
125
|
|
107
126
|
PLATFORMS
|
108
127
|
ruby
|
109
128
|
|
110
129
|
DEPENDENCIES
|
111
|
-
activesupport (< 6.0.0)
|
112
130
|
bugsnag (>= 6.11.0)
|
113
131
|
bundler (>= 2.0)
|
114
132
|
my_api_client!
|
@@ -119,9 +137,9 @@ DEPENDENCIES
|
|
119
137
|
rubocop
|
120
138
|
rubocop-performance
|
121
139
|
rubocop-rspec
|
122
|
-
simplecov (= 0.
|
140
|
+
simplecov (= 0.21.2)
|
123
141
|
webmock
|
124
142
|
yard
|
125
143
|
|
126
144
|
BUNDLED WITH
|
127
|
-
2.
|
145
|
+
2.2.22
|
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.6, 2.7, 3.0
|
16
|
+
* Rails 5.2, 6.0, 6.1
|
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
|
@@ -551,6 +551,8 @@ end
|
|
551
551
|
|
552
552
|
### Stubbing
|
553
553
|
|
554
|
+
#### `response` option
|
555
|
+
|
554
556
|
以下のような `ApiClient` を定義しているとします。
|
555
557
|
|
556
558
|
```ruby
|
@@ -587,6 +589,7 @@ response = ExampleApiClient.new.request(user_id: 1)
|
|
587
589
|
response.id # => 12345
|
588
590
|
```
|
589
591
|
|
592
|
+
#### Proc
|
590
593
|
|
591
594
|
リクスエストパラメータを使ったレスポンスを返すようにスタブ化したい場合は、 `Proc` を利用することで実現できます。
|
592
595
|
|
@@ -600,7 +603,9 @@ response = ExampleApiClient.new.request(user_id: 1)
|
|
600
603
|
response.id # => 1
|
601
604
|
```
|
602
605
|
|
603
|
-
|
606
|
+
#### Return value of `#stub_api_client_all` and `#stub_api_client`
|
607
|
+
|
608
|
+
`#stub_api_client_all` や `#stub_api_client` の戻り値はスタブ化した API Client のスタブオブジェクトです。`receive` や `have_received` を使ったテストを書きたい場合は、これらの値を利用すると良いでしょう。
|
604
609
|
|
605
610
|
```ruby
|
606
611
|
def execute_api_request
|
@@ -612,7 +617,9 @@ execute_api_request
|
|
612
617
|
expect(api_client).to have_received(:request).with(user_id: 1)
|
613
618
|
```
|
614
619
|
|
615
|
-
|
620
|
+
#### `raise` option
|
621
|
+
|
622
|
+
例外が発生する場合のテストを書きたい場合は、 `raise` オプションを利用することができます。
|
616
623
|
|
617
624
|
```ruby
|
618
625
|
def execute_api_request
|
@@ -623,14 +630,15 @@ stub_api_client_all(ExampleApiClient, request: { raise: MyApiClient::Error })
|
|
623
630
|
expect { execute_api_request }.to raise_error(MyApiClient::Error)
|
624
631
|
```
|
625
632
|
|
626
|
-
|
633
|
+
なお、発生した例外に含まれるレスポンスパラメータやステータスコードもスタブ化したい場合は、 `response` オプションと同時に指定することが可能です。
|
627
634
|
|
628
635
|
```ruby
|
629
636
|
stub_api_client_all(
|
630
637
|
ExampleApiClient,
|
631
638
|
request: {
|
632
639
|
raise: MyApiClient::Error,
|
633
|
-
response: { message: 'error' }
|
640
|
+
response: { message: 'error' },
|
641
|
+
status_code: 429
|
634
642
|
}
|
635
643
|
)
|
636
644
|
|
@@ -639,9 +647,65 @@ begin
|
|
639
647
|
rescue MyApiClient::Error => e
|
640
648
|
response_body = e.params.response.data.to_h
|
641
649
|
expect(response_body).to eq(message: 'error')
|
650
|
+
status_code = e.params.response.status
|
651
|
+
expect(status_code).to eq(429)
|
652
|
+
end
|
653
|
+
```
|
654
|
+
|
655
|
+
#### `pageable` option
|
656
|
+
|
657
|
+
`#pageable_get` (`#pget`) を使った実装用に `pageable` というオプションが利用できます。
|
658
|
+
`pageable` に設定する値は `Enumerable` である必要があります。
|
659
|
+
|
660
|
+
```ruby
|
661
|
+
stub_api_client_all(
|
662
|
+
MyPaginationApiClient,
|
663
|
+
pagination: {
|
664
|
+
pageable: [
|
665
|
+
{ page: 1 },
|
666
|
+
{ page: 2 },
|
667
|
+
{ page: 3 },
|
668
|
+
],
|
669
|
+
}
|
670
|
+
)
|
671
|
+
|
672
|
+
MyPaginationApiClient.new.pagination.each do |response|
|
673
|
+
response.page #=> 1, 2, 3
|
642
674
|
end
|
643
675
|
```
|
644
676
|
|
677
|
+
なお、 `Enumerable` の各値にはここまで紹介した `response`, `raise`, `Proc` など全てのオプションが利用可能です。
|
678
|
+
|
679
|
+
```ruby
|
680
|
+
stub_api_client_all(
|
681
|
+
MyPaginationApiClient,
|
682
|
+
pagination: {
|
683
|
+
pageable: [
|
684
|
+
{ response: { page: 1 } },
|
685
|
+
{ page: 2 },
|
686
|
+
->(params) { { page: 3, user_id: params[:user_id] } },
|
687
|
+
{ raise: MyApiClient::ClientError::IamTeapot },
|
688
|
+
],
|
689
|
+
}
|
690
|
+
)
|
691
|
+
```
|
692
|
+
|
693
|
+
また、 `Enumerator` を使えば無限に続くページネーションを定義することもできます。
|
694
|
+
|
695
|
+
|
696
|
+
```ruby
|
697
|
+
stub_api_client_all(
|
698
|
+
MyPaginationApiClient,
|
699
|
+
pagination: {
|
700
|
+
pageable: Enumerator.new do |y|
|
701
|
+
loop.with_index(1) do |_, i|
|
702
|
+
y << { page: i }
|
703
|
+
end
|
704
|
+
end,
|
705
|
+
}
|
706
|
+
)
|
707
|
+
```
|
708
|
+
|
645
709
|
## Deployment
|
646
710
|
|
647
711
|
この gem のリリースには [gem_comet](https://github.com/ryz310/gem_comet) を利用しています。
|
data/gemfiles/rails_5.0.gemfile
CHANGED
data/gemfiles/rails_5.1.gemfile
CHANGED
data/gemfiles/rails_5.2.gemfile
CHANGED
data/gemfiles/rails_6.0.gemfile
CHANGED
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
|