my_api_client 0.17.0 → 0.21.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.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +32 -158
  3. data/.gem_comet.yml +13 -2
  4. data/.github/dependabot.yml +32 -0
  5. data/.rubocop.yml +1 -1
  6. data/.rubocop_todo.yml +22 -12
  7. data/CHANGELOG.md +61 -74
  8. data/Gemfile +0 -3
  9. data/Gemfile.lock +79 -61
  10. data/README.jp.md +71 -7
  11. data/gemfiles/rails_5.0.gemfile +1 -0
  12. data/gemfiles/rails_5.1.gemfile +1 -0
  13. data/gemfiles/rails_5.2.gemfile +1 -0
  14. data/gemfiles/rails_6.0.gemfile +1 -0
  15. data/gemfiles/{rails_4.2.gemfile → rails_6.1.gemfile} +1 -1
  16. data/lib/generators/rails/USAGE +1 -1
  17. data/lib/generators/rails/api_client_generator.rb +6 -0
  18. data/lib/generators/rails/templates/api_client.rb.erb +1 -1
  19. data/lib/generators/rspec/USAGE +1 -1
  20. data/lib/generators/rspec/api_client_generator.rb +6 -0
  21. data/lib/generators/rspec/templates/api_client_spec.rb.erb +1 -1
  22. data/lib/my_api_client/base.rb +2 -9
  23. data/lib/my_api_client/integrations/bugsnag.rb +1 -1
  24. data/lib/my_api_client/params/params.rb +1 -3
  25. data/lib/my_api_client/request.rb +1 -1
  26. data/lib/my_api_client/rspec/matchers/be_handled_as_an_error.rb +3 -3
  27. data/lib/my_api_client/rspec/matchers/request_to.rb +1 -1
  28. data/lib/my_api_client/rspec/stub.rb +40 -15
  29. data/lib/my_api_client/version.rb +1 -1
  30. data/my_api/.ruby-version +1 -1
  31. data/my_api/Gemfile +3 -0
  32. data/my_api/Gemfile.lock +112 -105
  33. data/my_api/app/controllers/pagination_controller.rb +2 -2
  34. data/my_api/public/index.html +2 -2
  35. data/my_api_client.gemspec +3 -3
  36. data/rails_app/rails_5.2/Gemfile +0 -1
  37. data/rails_app/rails_5.2/Gemfile.lock +73 -64
  38. data/rails_app/rails_5.2/config/environments/production.rb +1 -1
  39. data/rails_app/rails_6.0/Gemfile.lock +87 -77
  40. data/rails_app/rails_6.0/config/environments/production.rb +1 -1
  41. data/rails_app/rails_6.1/.gitattributes +8 -0
  42. data/rails_app/rails_6.1/.gitignore +28 -0
  43. data/rails_app/rails_6.1/.rspec +3 -0
  44. data/rails_app/rails_6.1/Gemfile +17 -0
  45. data/rails_app/rails_6.1/Gemfile.lock +203 -0
  46. data/rails_app/rails_6.1/README.md +24 -0
  47. data/rails_app/rails_6.1/Rakefile +6 -0
  48. data/rails_app/rails_6.1/app/controllers/application_controller.rb +4 -0
  49. data/rails_app/rails_6.1/app/controllers/concerns/.keep +0 -0
  50. data/rails_app/rails_6.1/app/javascript/.keep +0 -0
  51. data/rails_app/rails_6.1/app/models/application_record.rb +5 -0
  52. data/rails_app/rails_6.1/app/models/concerns/.keep +0 -0
  53. data/rails_app/rails_6.1/bin/bundle +114 -0
  54. data/rails_app/rails_6.1/bin/rails +4 -0
  55. data/rails_app/rails_6.1/bin/rake +4 -0
  56. data/rails_app/rails_6.1/bin/setup +33 -0
  57. data/rails_app/rails_6.1/config.ru +6 -0
  58. data/rails_app/rails_6.1/config/application.rb +42 -0
  59. data/rails_app/rails_6.1/config/boot.rb +5 -0
  60. data/rails_app/rails_6.1/config/credentials.yml.enc +1 -0
  61. data/rails_app/rails_6.1/config/database.yml +25 -0
  62. data/rails_app/rails_6.1/config/environment.rb +7 -0
  63. data/rails_app/rails_6.1/config/environments/development.rb +59 -0
  64. data/rails_app/rails_6.1/config/environments/production.rb +97 -0
  65. data/rails_app/rails_6.1/config/environments/test.rb +51 -0
  66. data/rails_app/rails_6.1/config/initializers/application_controller_renderer.rb +9 -0
  67. data/rails_app/rails_6.1/config/initializers/backtrace_silencers.rb +10 -0
  68. data/rails_app/rails_6.1/config/initializers/cors.rb +17 -0
  69. data/rails_app/rails_6.1/config/initializers/filter_parameter_logging.rb +8 -0
  70. data/rails_app/rails_6.1/config/initializers/inflections.rb +17 -0
  71. data/rails_app/rails_6.1/config/initializers/mime_types.rb +5 -0
  72. data/rails_app/rails_6.1/config/initializers/wrap_parameters.rb +16 -0
  73. data/rails_app/rails_6.1/config/locales/en.yml +33 -0
  74. data/rails_app/rails_6.1/config/routes.rb +5 -0
  75. data/rails_app/rails_6.1/db/seeds.rb +8 -0
  76. data/rails_app/rails_6.1/lib/tasks/.keep +0 -0
  77. data/rails_app/rails_6.1/public/robots.txt +1 -0
  78. data/rails_app/rails_6.1/spec/rails_helper.rb +14 -0
  79. data/rails_app/rails_6.1/spec/spec_helper.rb +13 -0
  80. data/rails_app/rails_6.1/tmp/.keep +0 -0
  81. data/rails_app/rails_6.1/tmp/pids/.keep +0 -0
  82. data/rails_app/rails_6.1/vendor/.keep +0 -0
  83. metadata +52 -11
  84. data/.dependabot/config.yml +0 -34
  85. 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.17.0)
5
- activesupport (>= 4.2.0)
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 (5.2.4.4)
13
+ activesupport (6.1.4)
14
14
  concurrent-ruby (~> 1.0, >= 1.0.2)
15
- i18n (>= 0.7, < 2)
16
- minitest (~> 5.1)
17
- tzinfo (~> 1.1)
18
- addressable (2.7.0)
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.1)
21
- bugsnag (6.17.0)
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.7)
26
- crack (0.4.4)
26
+ concurrent-ruby (1.1.9)
27
+ crack (0.4.5)
28
+ rexml
27
29
  diff-lcs (1.4.4)
28
- docile (1.3.2)
29
- faraday (1.0.1)
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.5)
51
+ i18n (1.8.10)
33
52
  concurrent-ruby (~> 1.0)
34
- json (2.3.1)
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.2)
56
+ minitest (5.14.4)
40
57
  multi_json (1.15.0)
41
58
  multipart-post (2.1.1)
42
- parallel (1.19.2)
43
- parser (2.7.1.4)
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.1)
54
- regexp_parser (1.8.0)
55
- rexml (3.2.4)
56
- rspec (3.9.0)
57
- rspec-core (~> 3.9.0)
58
- rspec-expectations (~> 3.9.0)
59
- rspec-mocks (~> 3.9.0)
60
- rspec-core (3.9.2)
61
- rspec-support (~> 3.9.3)
62
- rspec-expectations (3.9.2)
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.9.0)
65
- rspec-mocks (3.9.1)
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.9.0)
68
- rspec-support (3.9.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 (0.91.0)
88
+ rubocop (1.18.4)
72
89
  parallel (~> 1.10)
73
- parser (>= 2.7.1.1)
90
+ parser (>= 3.0.0.0)
74
91
  rainbow (>= 2.2.2, < 4.0)
75
- regexp_parser (>= 1.7)
92
+ regexp_parser (>= 1.8, < 3.0)
76
93
  rexml
77
- rubocop-ast (>= 0.4.0, < 1.0)
94
+ rubocop-ast (>= 1.8.0, < 2.0)
78
95
  ruby-progressbar (~> 1.7)
79
- unicode-display_width (>= 1.4.0, < 2.0)
80
- rubocop-ast (0.4.2)
81
- parser (>= 2.7.1.4)
82
- rubocop-performance (1.8.1)
83
- rubocop (>= 0.87.0)
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 (1.43.2)
86
- rubocop (~> 0.87)
87
- ruby-progressbar (1.10.1)
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.17.1)
110
+ simplecov (0.21.2)
92
111
  docile (~> 1.1)
93
- json (>= 1.8, < 3)
94
- simplecov-html (~> 0.10.0)
95
- simplecov-html (0.10.2)
96
- thread_safe (0.3.6)
97
- to_regexp (0.2.1)
98
- tzinfo (1.2.7)
99
- thread_safe (~> 0.1)
100
- unicode-display_width (1.7.0)
101
- webmock (3.9.1)
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.25)
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.17.1)
140
+ simplecov (= 0.21.2)
123
141
  webmock
124
142
  yard
125
143
 
126
144
  BUNDLED WITH
127
- 2.1.4
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.4, 2.5, 2.6, 2.7
16
- * Rails 4.2, 5.0, 5.1, 5.2, 6.0
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
- `receive` `have_received` を使ったテストを書きたい場合は、 `stub_api_client_all` `stub_api_client` の戻り値を利用すると良いでしょう。
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
- また、例外が発生する場合のテストを書きたい場合は、 `raise` オプションを利用することができます。
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
- なお、発生した例外に含まれるレスポンスパラメータもスタブ化したい場合は、 `response` オプションと同時に指定することが可能です。
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) を利用しています。
@@ -7,6 +7,7 @@ source 'https://rubygems.org'
7
7
  git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
8
8
 
9
9
  gem 'activesupport', '~> 5.0.0'
10
+ gem 'tzinfo', '~> 1.1'
10
11
 
11
12
  group :integrations, optional: true do
12
13
  gem 'bugsnag', '>= 6.11.0'
@@ -7,6 +7,7 @@ source 'https://rubygems.org'
7
7
  git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
8
8
 
9
9
  gem 'activesupport', '~> 5.1.0'
10
+ gem 'tzinfo', '~> 1.1'
10
11
 
11
12
  group :integrations, optional: true do
12
13
  gem 'bugsnag', '>= 6.11.0'
@@ -7,6 +7,7 @@ source 'https://rubygems.org'
7
7
  git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
8
8
 
9
9
  gem 'activesupport', '~> 5.2.0'
10
+ gem 'tzinfo', '~> 1.1'
10
11
 
11
12
  group :integrations, optional: true do
12
13
  gem 'bugsnag', '>= 6.11.0'
@@ -7,6 +7,7 @@ source 'https://rubygems.org'
7
7
  git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
8
8
 
9
9
  gem 'activesupport', '~> 6.0.0'
10
+ gem 'tzinfo', '~> 1.1'
10
11
 
11
12
  group :integrations, optional: true do
12
13
  gem 'bugsnag', '>= 6.11.0'
@@ -6,7 +6,7 @@ source 'https://rubygems.org'
6
6
 
7
7
  git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
8
8
 
9
- gem 'activesupport', '~> 4.2.0'
9
+ gem 'activesupport', '~> 6.1.0'
10
10
 
11
11
  group :integrations, optional: true do
12
12
  gem 'bugsnag', '>= 6.11.0'
@@ -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 'https://example.com'
4
+ endpoint '<%= options[:endpoint] %>'
5
5
 
6
6
  # error_handling json: { '$.errors.code': 10 } do |params, logger|
7
7
  # # Behavior when detected an error.
@@ -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