my_api_client 0.22.0 → 0.24.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 +26 -26
- data/.rubocop.yml +14 -10
- data/.rubocop_todo.yml +2 -2
- data/CHANGELOG.md +220 -157
- data/Gemfile +0 -2
- data/Gemfile.lock +51 -68
- data/README.jp.md +38 -22
- data/README.md +25 -11
- data/example/api_clients/application_api_client.rb +1 -1
- data/example/api_clients/my_errors.rb +9 -0
- data/example/api_clients/my_header_api_client.rb +38 -0
- data/lib/my_api_client/error_handling/generator.rb +16 -3
- data/lib/my_api_client/errors/network_error.rb +3 -3
- data/lib/my_api_client/errors.rb +2 -2
- data/lib/my_api_client/integrations/bugsnag.rb +2 -2
- data/lib/my_api_client/version.rb +1 -1
- data/my_api/Gemfile +2 -2
- data/my_api/Gemfile.lock +94 -94
- data/my_api/app/controllers/header_controller.rb +12 -0
- data/my_api/app/controllers/pagination_controller.rb +1 -1
- data/my_api/config/routes.rb +1 -0
- data/my_api/spec/controllers/error_controller_spec.rb +1 -1
- data/my_api/spec/controllers/header_controller_spec.rb +33 -0
- data/my_api/spec/controllers/pagination_controller_spec.rb +1 -1
- data/my_api/spec/controllers/rest_controller_spec.rb +1 -1
- data/my_api/spec/controllers/status_controller_spec.rb +1 -1
- data/my_api_client.gemspec +1 -1
- data/rails_app/rails_5.2/Gemfile.lock +8 -8
- data/rails_app/rails_6.0/Gemfile +1 -0
- data/rails_app/rails_6.0/Gemfile.lock +84 -98
- data/rails_app/rails_6.1/Gemfile.lock +89 -99
- data/rails_app/rails_7.0/Gemfile.lock +132 -69
- metadata +7 -4
data/my_api/Gemfile.lock
CHANGED
@@ -1,35 +1,35 @@
|
|
1
1
|
GEM
|
2
2
|
remote: https://rubygems.org/
|
3
3
|
specs:
|
4
|
-
actionmailer (6.1.
|
5
|
-
actionpack (= 6.1.
|
6
|
-
actionview (= 6.1.
|
7
|
-
activejob (= 6.1.
|
8
|
-
activesupport (= 6.1.
|
4
|
+
actionmailer (6.1.6.1)
|
5
|
+
actionpack (= 6.1.6.1)
|
6
|
+
actionview (= 6.1.6.1)
|
7
|
+
activejob (= 6.1.6.1)
|
8
|
+
activesupport (= 6.1.6.1)
|
9
9
|
mail (~> 2.5, >= 2.5.4)
|
10
10
|
rails-dom-testing (~> 2.0)
|
11
|
-
actionpack (6.1.
|
12
|
-
actionview (= 6.1.
|
13
|
-
activesupport (= 6.1.
|
11
|
+
actionpack (6.1.6.1)
|
12
|
+
actionview (= 6.1.6.1)
|
13
|
+
activesupport (= 6.1.6.1)
|
14
14
|
rack (~> 2.0, >= 2.0.9)
|
15
15
|
rack-test (>= 0.6.3)
|
16
16
|
rails-dom-testing (~> 2.0)
|
17
17
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
18
|
-
actionview (6.1.
|
19
|
-
activesupport (= 6.1.
|
18
|
+
actionview (6.1.6.1)
|
19
|
+
activesupport (= 6.1.6.1)
|
20
20
|
builder (~> 3.1)
|
21
21
|
erubi (~> 1.4)
|
22
22
|
rails-dom-testing (~> 2.0)
|
23
23
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
24
|
-
activejob (6.1.
|
25
|
-
activesupport (= 6.1.
|
24
|
+
activejob (6.1.6.1)
|
25
|
+
activesupport (= 6.1.6.1)
|
26
26
|
globalid (>= 0.3.6)
|
27
|
-
activemodel (6.1.
|
28
|
-
activesupport (= 6.1.
|
29
|
-
activerecord (6.1.
|
30
|
-
activemodel (= 6.1.
|
31
|
-
activesupport (= 6.1.
|
32
|
-
activesupport (6.1.
|
27
|
+
activemodel (6.1.6.1)
|
28
|
+
activesupport (= 6.1.6.1)
|
29
|
+
activerecord (6.1.6.1)
|
30
|
+
activemodel (= 6.1.6.1)
|
31
|
+
activesupport (= 6.1.6.1)
|
32
|
+
activesupport (6.1.6.1)
|
33
33
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
34
34
|
i18n (>= 1.6, < 2)
|
35
35
|
minitest (>= 5.1)
|
@@ -38,7 +38,7 @@ GEM
|
|
38
38
|
addressable (2.8.0)
|
39
39
|
public_suffix (>= 2.0.2, < 5.0)
|
40
40
|
aws-eventstream (1.2.0)
|
41
|
-
aws-mfa-secure (0.4.
|
41
|
+
aws-mfa-secure (0.4.4)
|
42
42
|
activesupport
|
43
43
|
aws-sdk-core
|
44
44
|
aws_config
|
@@ -46,52 +46,52 @@ GEM
|
|
46
46
|
rainbow
|
47
47
|
thor
|
48
48
|
zeitwerk
|
49
|
-
aws-partitions (1.
|
50
|
-
aws-sdk-apigateway (1.
|
51
|
-
aws-sdk-core (~> 3, >= 3.
|
49
|
+
aws-partitions (1.616.0)
|
50
|
+
aws-sdk-apigateway (1.78.0)
|
51
|
+
aws-sdk-core (~> 3, >= 3.127.0)
|
52
52
|
aws-sigv4 (~> 1.1)
|
53
|
-
aws-sdk-cloudformation (1.
|
54
|
-
aws-sdk-core (~> 3, >= 3.
|
53
|
+
aws-sdk-cloudformation (1.70.0)
|
54
|
+
aws-sdk-core (~> 3, >= 3.127.0)
|
55
55
|
aws-sigv4 (~> 1.1)
|
56
|
-
aws-sdk-cloudwatchlogs (1.
|
57
|
-
aws-sdk-core (~> 3, >= 3.
|
56
|
+
aws-sdk-cloudwatchlogs (1.53.0)
|
57
|
+
aws-sdk-core (~> 3, >= 3.127.0)
|
58
58
|
aws-sigv4 (~> 1.1)
|
59
|
-
aws-sdk-core (3.
|
59
|
+
aws-sdk-core (3.132.0)
|
60
60
|
aws-eventstream (~> 1, >= 1.0.2)
|
61
61
|
aws-partitions (~> 1, >= 1.525.0)
|
62
62
|
aws-sigv4 (~> 1.1)
|
63
|
-
jmespath (~> 1.
|
64
|
-
aws-sdk-dynamodb (1.
|
65
|
-
aws-sdk-core (~> 3, >= 3.
|
63
|
+
jmespath (~> 1, >= 1.6.1)
|
64
|
+
aws-sdk-dynamodb (1.75.0)
|
65
|
+
aws-sdk-core (~> 3, >= 3.127.0)
|
66
66
|
aws-sigv4 (~> 1.1)
|
67
|
-
aws-sdk-kinesis (1.
|
68
|
-
aws-sdk-core (~> 3, >= 3.
|
67
|
+
aws-sdk-kinesis (1.41.0)
|
68
|
+
aws-sdk-core (~> 3, >= 3.127.0)
|
69
69
|
aws-sigv4 (~> 1.1)
|
70
|
-
aws-sdk-kms (1.
|
71
|
-
aws-sdk-core (~> 3, >= 3.
|
70
|
+
aws-sdk-kms (1.58.0)
|
71
|
+
aws-sdk-core (~> 3, >= 3.127.0)
|
72
72
|
aws-sigv4 (~> 1.1)
|
73
|
-
aws-sdk-lambda (1.
|
74
|
-
aws-sdk-core (~> 3, >= 3.
|
73
|
+
aws-sdk-lambda (1.84.0)
|
74
|
+
aws-sdk-core (~> 3, >= 3.127.0)
|
75
75
|
aws-sigv4 (~> 1.1)
|
76
|
-
aws-sdk-s3 (1.
|
77
|
-
aws-sdk-core (~> 3, >= 3.
|
76
|
+
aws-sdk-s3 (1.114.0)
|
77
|
+
aws-sdk-core (~> 3, >= 3.127.0)
|
78
78
|
aws-sdk-kms (~> 1)
|
79
79
|
aws-sigv4 (~> 1.4)
|
80
|
-
aws-sdk-sns (1.
|
81
|
-
aws-sdk-core (~> 3, >= 3.
|
80
|
+
aws-sdk-sns (1.53.0)
|
81
|
+
aws-sdk-core (~> 3, >= 3.127.0)
|
82
82
|
aws-sigv4 (~> 1.1)
|
83
|
-
aws-sdk-sqs (1.
|
84
|
-
aws-sdk-core (~> 3, >= 3.
|
83
|
+
aws-sdk-sqs (1.51.1)
|
84
|
+
aws-sdk-core (~> 3, >= 3.127.0)
|
85
85
|
aws-sigv4 (~> 1.1)
|
86
|
-
aws-sdk-ssm (1.
|
87
|
-
aws-sdk-core (~> 3, >= 3.
|
86
|
+
aws-sdk-ssm (1.138.0)
|
87
|
+
aws-sdk-core (~> 3, >= 3.127.0)
|
88
88
|
aws-sigv4 (~> 1.1)
|
89
|
-
aws-sigv4 (1.
|
89
|
+
aws-sigv4 (1.5.1)
|
90
90
|
aws-eventstream (~> 1, >= 1.0.2)
|
91
91
|
aws_config (0.1.0)
|
92
92
|
builder (3.2.4)
|
93
93
|
byebug (11.1.3)
|
94
|
-
capybara (3.
|
94
|
+
capybara (3.37.1)
|
95
95
|
addressable
|
96
96
|
matrix
|
97
97
|
mini_mime (>= 0.1.3)
|
@@ -100,29 +100,29 @@ GEM
|
|
100
100
|
rack-test (>= 0.6.3)
|
101
101
|
regexp_parser (>= 1.5, < 3.0)
|
102
102
|
xpath (~> 3.2)
|
103
|
-
cfn-status (0.4.
|
103
|
+
cfn-status (0.4.6)
|
104
104
|
aws-sdk-cloudformation
|
105
105
|
cfn_camelizer (0.4.9)
|
106
106
|
activesupport
|
107
107
|
memoist
|
108
108
|
rainbow
|
109
109
|
cfn_response (0.2.0)
|
110
|
-
concurrent-ruby (1.1.
|
110
|
+
concurrent-ruby (1.1.10)
|
111
111
|
crass (1.0.6)
|
112
|
-
diff-lcs (1.
|
113
|
-
dotenv (2.
|
114
|
-
dynomite (1.2.
|
112
|
+
diff-lcs (1.5.0)
|
113
|
+
dotenv (2.8.1)
|
114
|
+
dynomite (1.2.7)
|
115
115
|
activesupport
|
116
116
|
aws-sdk-dynamodb
|
117
117
|
rainbow
|
118
|
-
erubi (1.
|
118
|
+
erubi (1.11.0)
|
119
119
|
gems (1.2.0)
|
120
120
|
globalid (1.0.0)
|
121
121
|
activesupport (>= 5.0)
|
122
122
|
hashie (5.0.0)
|
123
|
-
i18n (1.
|
123
|
+
i18n (1.12.0)
|
124
124
|
concurrent-ruby (~> 1.0)
|
125
|
-
jets (3.
|
125
|
+
jets (3.1.5)
|
126
126
|
actionmailer (~> 6.1.0)
|
127
127
|
actionpack (~> 6.1.0)
|
128
128
|
actionview (~> 6.1.0)
|
@@ -140,7 +140,7 @@ GEM
|
|
140
140
|
aws-sdk-sqs
|
141
141
|
aws-sdk-ssm
|
142
142
|
cfn-status
|
143
|
-
cfn_camelizer (
|
143
|
+
cfn_camelizer (>= 0.4.9)
|
144
144
|
cfn_response
|
145
145
|
dotenv
|
146
146
|
gems
|
@@ -153,19 +153,19 @@ GEM
|
|
153
153
|
railties (~> 6.1.0)
|
154
154
|
rainbow
|
155
155
|
recursive-open-struct
|
156
|
-
serverlessgems (
|
156
|
+
serverlessgems (>= 0.2.0)
|
157
157
|
shotgun
|
158
158
|
text-table
|
159
159
|
thor
|
160
|
-
zeitwerk (
|
160
|
+
zeitwerk (>= 2.6.0)
|
161
161
|
jets-html-sanitizer (1.0.4)
|
162
162
|
loofah (~> 2.2, >= 2.2.2)
|
163
|
-
jmespath (1.
|
164
|
-
kramdown (2.
|
163
|
+
jmespath (1.6.1)
|
164
|
+
kramdown (2.4.0)
|
165
165
|
rexml
|
166
166
|
launchy (2.5.0)
|
167
167
|
addressable (~> 2.7)
|
168
|
-
loofah (2.
|
168
|
+
loofah (2.18.0)
|
169
169
|
crass (~> 1.0.2)
|
170
170
|
nokogiri (>= 1.5.9)
|
171
171
|
mail (2.7.1)
|
@@ -174,63 +174,63 @@ GEM
|
|
174
174
|
memoist (0.16.2)
|
175
175
|
method_source (1.0.0)
|
176
176
|
mini_mime (1.1.2)
|
177
|
-
mini_portile2 (2.
|
178
|
-
minitest (5.
|
177
|
+
mini_portile2 (2.8.0)
|
178
|
+
minitest (5.16.2)
|
179
179
|
nio4r (2.5.8)
|
180
|
-
nokogiri (1.
|
181
|
-
mini_portile2 (~> 2.
|
180
|
+
nokogiri (1.13.8)
|
181
|
+
mini_portile2 (~> 2.8.0)
|
182
182
|
racc (~> 1.4)
|
183
|
-
public_suffix (4.0.
|
184
|
-
puma (5.5
|
183
|
+
public_suffix (4.0.7)
|
184
|
+
puma (5.6.5)
|
185
185
|
nio4r (~> 2.0)
|
186
186
|
racc (1.6.0)
|
187
|
-
rack (2.2.
|
188
|
-
rack-test (
|
189
|
-
rack (>= 1.
|
187
|
+
rack (2.2.4)
|
188
|
+
rack-test (2.0.2)
|
189
|
+
rack (>= 1.3)
|
190
190
|
rails-dom-testing (2.0.3)
|
191
191
|
activesupport (>= 4.2.0)
|
192
192
|
nokogiri (>= 1.6)
|
193
|
-
rails-html-sanitizer (1.4.
|
193
|
+
rails-html-sanitizer (1.4.3)
|
194
194
|
loofah (~> 2.3)
|
195
|
-
railties (6.1.
|
196
|
-
actionpack (= 6.1.
|
197
|
-
activesupport (= 6.1.
|
195
|
+
railties (6.1.6.1)
|
196
|
+
actionpack (= 6.1.6.1)
|
197
|
+
activesupport (= 6.1.6.1)
|
198
198
|
method_source
|
199
|
-
rake (>=
|
199
|
+
rake (>= 12.2)
|
200
200
|
thor (~> 1.0)
|
201
|
-
rainbow (3.
|
201
|
+
rainbow (3.1.1)
|
202
202
|
rake (13.0.6)
|
203
203
|
recursive-open-struct (1.1.3)
|
204
|
-
regexp_parser (2.
|
204
|
+
regexp_parser (2.4.0)
|
205
205
|
rexml (3.2.5)
|
206
|
-
rspec (3.
|
207
|
-
rspec-core (~> 3.
|
208
|
-
rspec-expectations (~> 3.
|
209
|
-
rspec-mocks (~> 3.
|
210
|
-
rspec-core (3.
|
211
|
-
rspec-support (~> 3.
|
212
|
-
rspec-expectations (3.
|
206
|
+
rspec (3.11.0)
|
207
|
+
rspec-core (~> 3.11.0)
|
208
|
+
rspec-expectations (~> 3.11.0)
|
209
|
+
rspec-mocks (~> 3.11.0)
|
210
|
+
rspec-core (3.11.0)
|
211
|
+
rspec-support (~> 3.11.0)
|
212
|
+
rspec-expectations (3.11.0)
|
213
213
|
diff-lcs (>= 1.2.0, < 2.0)
|
214
|
-
rspec-support (~> 3.
|
215
|
-
rspec-mocks (3.
|
214
|
+
rspec-support (~> 3.11.0)
|
215
|
+
rspec-mocks (3.11.0)
|
216
216
|
diff-lcs (>= 1.2.0, < 2.0)
|
217
|
-
rspec-support (~> 3.
|
218
|
-
rspec-support (3.
|
219
|
-
rspec_junit_formatter (0.
|
217
|
+
rspec-support (~> 3.11.0)
|
218
|
+
rspec-support (3.11.1)
|
219
|
+
rspec_junit_formatter (0.6.0)
|
220
220
|
rspec-core (>= 2, < 4, != 2.12.0)
|
221
|
-
serverlessgems (0.
|
221
|
+
serverlessgems (0.2.0)
|
222
222
|
gems
|
223
223
|
memoist
|
224
224
|
zeitwerk
|
225
225
|
shotgun (0.9.2)
|
226
226
|
rack (>= 1.0)
|
227
227
|
text-table (1.2.4)
|
228
|
-
thor (1.1
|
229
|
-
tzinfo (2.0.
|
228
|
+
thor (1.2.1)
|
229
|
+
tzinfo (2.0.5)
|
230
230
|
concurrent-ruby (~> 1.0)
|
231
231
|
xpath (3.2.0)
|
232
232
|
nokogiri (~> 1.8)
|
233
|
-
zeitwerk (2.
|
233
|
+
zeitwerk (2.6.0)
|
234
234
|
|
235
235
|
PLATFORMS
|
236
236
|
ruby
|
@@ -239,9 +239,9 @@ DEPENDENCIES
|
|
239
239
|
byebug
|
240
240
|
capybara
|
241
241
|
dynomite
|
242
|
-
jets
|
242
|
+
jets (~> 3.1.5)
|
243
243
|
launchy
|
244
|
-
nokogiri (~> 1.
|
244
|
+
nokogiri (~> 1.13.8)
|
245
245
|
puma
|
246
246
|
rack
|
247
247
|
rspec
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# The header API
|
4
|
+
class HeaderController < ApplicationController
|
5
|
+
# GET header
|
6
|
+
def index
|
7
|
+
params.each do |header_name, header_value|
|
8
|
+
response.set_header(header_name, header_value)
|
9
|
+
end
|
10
|
+
render status: :ok, json: {}
|
11
|
+
end
|
12
|
+
end
|
@@ -51,7 +51,7 @@ class PaginationController < ApplicationController
|
|
51
51
|
# So this is workaround.
|
52
52
|
def page_link(page)
|
53
53
|
query_strings = "?#{{ page: page }.to_query}"
|
54
|
-
uri = File.join(ENV
|
54
|
+
uri = File.join(ENV.fetch('JETS_HOST', nil), ENV.fetch('JETS_STAGE', nil), pagination_path)
|
55
55
|
uri.sub!('http://', 'https://')
|
56
56
|
URI.join(uri, query_strings)
|
57
57
|
end
|
data/my_api/config/routes.rb
CHANGED
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
describe HeaderController do
|
4
|
+
describe '#index' do
|
5
|
+
context 'when request header with a header' do
|
6
|
+
let(:headers) { { 'x-header': 'value' } }
|
7
|
+
|
8
|
+
it 'returns 200 OK request with header' do
|
9
|
+
get '/header', query: headers
|
10
|
+
expect(response.status).to eq 200
|
11
|
+
expect(response.body).to eq '{}'
|
12
|
+
expect(response.headers['x-header']).to eq 'value'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
context 'when request header with multiple headers' do
|
17
|
+
let(:headers) do
|
18
|
+
{
|
19
|
+
'x-header': 'value1',
|
20
|
+
'x-second-header': 'value2',
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'returns 200 OK request with header' do
|
25
|
+
get '/header', query: headers
|
26
|
+
expect(response.status).to eq 200
|
27
|
+
expect(response.body).to eq '{}'
|
28
|
+
expect(response.headers['x-header']).to eq 'value1'
|
29
|
+
expect(response.headers['x-second-header']).to eq 'value2'
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/my_api_client.gemspec
CHANGED
@@ -22,7 +22,7 @@ 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.7.0'
|
26
26
|
|
27
27
|
spec.add_dependency 'activesupport', '>= 5.2.0'
|
28
28
|
spec.add_dependency 'faraday', '>= 0.17.1'
|
@@ -81,7 +81,7 @@ GEM
|
|
81
81
|
concurrent-ruby (~> 1.0)
|
82
82
|
jsonpath (1.1.0)
|
83
83
|
multi_json
|
84
|
-
loofah (2.
|
84
|
+
loofah (2.18.0)
|
85
85
|
crass (~> 1.0.2)
|
86
86
|
nokogiri (>= 1.5.9)
|
87
87
|
mail (2.7.1)
|
@@ -89,18 +89,18 @@ GEM
|
|
89
89
|
marcel (1.0.1)
|
90
90
|
method_source (1.0.0)
|
91
91
|
mini_mime (1.1.0)
|
92
|
-
mini_portile2 (2.
|
92
|
+
mini_portile2 (2.8.0)
|
93
93
|
minitest (5.14.4)
|
94
94
|
msgpack (1.3.3)
|
95
95
|
multi_json (1.15.0)
|
96
96
|
multipart-post (2.1.1)
|
97
97
|
nio4r (2.5.7)
|
98
|
-
nokogiri (1.
|
99
|
-
mini_portile2 (~> 2.
|
98
|
+
nokogiri (1.13.9)
|
99
|
+
mini_portile2 (~> 2.8.0)
|
100
100
|
racc (~> 1.4)
|
101
101
|
public_suffix (4.0.6)
|
102
|
-
racc (1.
|
103
|
-
rack (2.2.3)
|
102
|
+
racc (1.6.0)
|
103
|
+
rack (2.2.3.1)
|
104
104
|
rack-test (1.1.0)
|
105
105
|
rack (>= 1.0, < 3)
|
106
106
|
rails (5.2.6)
|
@@ -119,7 +119,7 @@ GEM
|
|
119
119
|
rails-dom-testing (2.0.3)
|
120
120
|
activesupport (>= 4.2.0)
|
121
121
|
nokogiri (>= 1.6)
|
122
|
-
rails-html-sanitizer (1.3
|
122
|
+
rails-html-sanitizer (1.4.3)
|
123
123
|
loofah (~> 2.3)
|
124
124
|
railties (5.2.6)
|
125
125
|
actionpack (= 5.2.6)
|
@@ -159,7 +159,7 @@ GEM
|
|
159
159
|
sprockets (>= 3.0.0)
|
160
160
|
thor (1.1.0)
|
161
161
|
thread_safe (0.3.6)
|
162
|
-
tzinfo (1.2.
|
162
|
+
tzinfo (1.2.10)
|
163
163
|
thread_safe (~> 0.1)
|
164
164
|
websocket-driver (0.7.4)
|
165
165
|
websocket-extensions (>= 0.1.0)
|
data/rails_app/rails_6.0/Gemfile
CHANGED