my_api_client 1.1.0 → 1.3.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 +8 -7
- data/.rubocop.yml +7 -4
- data/.ruby-version +1 -0
- data/CHANGELOG.md +71 -0
- data/Gemfile.lock +95 -81
- data/README.jp.md +2 -2
- data/README.md +2 -2
- data/example/api_clients/my_error_api_client.rb +1 -1
- data/example/api_clients/my_header_api_client.rb +1 -1
- data/example/api_clients/my_pagination_api_client.rb +2 -2
- data/example/api_clients/my_rest_api_client.rb +10 -10
- data/example/api_clients/my_status_api_client.rb +1 -1
- data/gemfiles/rails_7.1.gemfile +15 -0
- data/gemfiles/rails_7.2.gemfile +15 -0
- data/lib/my_api_client/base.rb +1 -1
- data/lib/my_api_client/error_handling.rb +1 -1
- data/lib/my_api_client/errors/network_error.rb +1 -1
- data/lib/my_api_client/errors.rb +1 -1
- data/lib/my_api_client/exceptions.rb +1 -1
- data/lib/my_api_client/params/params.rb +1 -1
- data/lib/my_api_client/params/request.rb +8 -8
- data/lib/my_api_client/request/basic.rb +2 -2
- data/lib/my_api_client/request/executor.rb +1 -1
- data/lib/my_api_client/request/pagination.rb +1 -3
- data/lib/my_api_client/request.rb +5 -5
- data/lib/my_api_client/rspec/matcher_helper.rb +3 -3
- data/lib/my_api_client/rspec/matchers/request_to.rb +1 -1
- data/lib/my_api_client/version.rb +1 -1
- data/my_api/Gemfile +1 -1
- data/my_api/Gemfile.lock +83 -71
- data/my_api/app/controllers/error_controller.rb +1 -1
- data/my_api/app/controllers/pagination_controller.rb +1 -1
- data/my_api/app/controllers/rest_controller.rb +4 -4
- data/my_api/app/controllers/status_controller.rb +1 -1
- data/my_api/spec/controllers/error_controller_spec.rb +4 -4
- data/my_api/spec/controllers/status_controller_spec.rb +3 -3
- data/my_api_client.gemspec +2 -1
- data/rails_app/rails_6.1/Gemfile.lock +73 -71
- data/rails_app/rails_7.0/Gemfile.lock +78 -76
- data/rails_app/rails_7.1/.dockerignore +31 -0
- data/rails_app/rails_7.1/.rspec +1 -0
- data/rails_app/rails_7.1/Dockerfile +55 -0
- data/rails_app/rails_7.1/Gemfile +16 -0
- data/rails_app/rails_7.1/Gemfile.lock +241 -0
- data/rails_app/rails_7.1/README.md +24 -0
- data/rails_app/rails_7.1/Rakefile +8 -0
- data/rails_app/rails_7.1/app/controllers/application_controller.rb +4 -0
- data/rails_app/rails_7.1/app/controllers/concerns/.keep +0 -0
- data/rails_app/rails_7.1/app/models/application_record.rb +5 -0
- data/rails_app/rails_7.1/app/models/concerns/.keep +0 -0
- data/rails_app/rails_7.1/bin/bundle +122 -0
- data/rails_app/rails_7.1/bin/docker-entrypoint +8 -0
- data/rails_app/rails_7.1/bin/rails +6 -0
- data/rails_app/rails_7.1/bin/rake +6 -0
- data/rails_app/rails_7.1/bin/setup +35 -0
- data/rails_app/rails_7.1/config/application.rb +46 -0
- data/rails_app/rails_7.1/config/boot.rb +5 -0
- data/rails_app/rails_7.1/config/credentials.yml.enc +1 -0
- data/rails_app/rails_7.1/config/database.yml +25 -0
- data/rails_app/rails_7.1/config/environment.rb +7 -0
- data/rails_app/rails_7.1/config/environments/development.rb +58 -0
- data/rails_app/rails_7.1/config/environments/production.rb +74 -0
- data/rails_app/rails_7.1/config/environments/test.rb +56 -0
- data/rails_app/rails_7.1/config/initializers/cors.rb +17 -0
- data/rails_app/rails_7.1/config/initializers/filter_parameter_logging.rb +10 -0
- data/rails_app/rails_7.1/config/initializers/inflections.rb +17 -0
- data/rails_app/rails_7.1/config/locales/en.yml +31 -0
- data/rails_app/rails_7.1/config/puma.rb +46 -0
- data/rails_app/rails_7.1/config/routes.rb +12 -0
- data/rails_app/rails_7.1/config.ru +8 -0
- data/rails_app/rails_7.1/db/seeds.rb +10 -0
- data/rails_app/rails_7.1/lib/tasks/.keep +0 -0
- data/rails_app/rails_7.1/public/robots.txt +2 -0
- data/rails_app/rails_7.1/spec/rails_helper.rb +13 -0
- data/rails_app/rails_7.1/spec/spec_helper.rb +13 -0
- data/rails_app/rails_7.1/storage/.keep +0 -0
- data/rails_app/rails_7.1/tmp/.keep +0 -0
- data/rails_app/rails_7.1/tmp/pids/.keep +0 -0
- data/rails_app/rails_7.1/tmp/storage/.keep +0 -0
- data/rails_app/rails_7.1/vendor/.keep +0 -0
- data/rails_app/rails_7.2/.dockerignore +42 -0
- data/rails_app/rails_7.2/.github/dependabot.yml +12 -0
- data/rails_app/rails_7.2/.github/workflows/ci.yml +55 -0
- data/rails_app/rails_7.2/.rspec +1 -0
- data/rails_app/rails_7.2/Dockerfile +62 -0
- data/rails_app/rails_7.2/Gemfile +15 -0
- data/rails_app/rails_7.2/Gemfile.lock +240 -0
- data/rails_app/rails_7.2/README.md +24 -0
- data/rails_app/rails_7.2/Rakefile +8 -0
- data/rails_app/rails_7.2/app/controllers/application_controller.rb +4 -0
- data/rails_app/rails_7.2/app/controllers/concerns/.keep +0 -0
- data/rails_app/rails_7.2/app/models/application_record.rb +5 -0
- data/rails_app/rails_7.2/app/models/concerns/.keep +0 -0
- data/rails_app/rails_7.2/bin/brakeman +9 -0
- data/rails_app/rails_7.2/bin/bundle +122 -0
- data/rails_app/rails_7.2/bin/docker-entrypoint +13 -0
- data/rails_app/rails_7.2/bin/rails +6 -0
- data/rails_app/rails_7.2/bin/rake +6 -0
- data/rails_app/rails_7.2/bin/rubocop +10 -0
- data/rails_app/rails_7.2/bin/setup +39 -0
- data/rails_app/rails_7.2/config/application.rb +46 -0
- data/rails_app/rails_7.2/config/boot.rb +5 -0
- data/rails_app/rails_7.2/config/credentials.yml.enc +1 -0
- data/rails_app/rails_7.2/config/database.yml +32 -0
- data/rails_app/rails_7.2/config/environment.rb +7 -0
- data/rails_app/rails_7.2/config/environments/development.rb +59 -0
- data/rails_app/rails_7.2/config/environments/production.rb +77 -0
- data/rails_app/rails_7.2/config/environments/test.rb +53 -0
- data/rails_app/rails_7.2/config/initializers/cors.rb +18 -0
- data/rails_app/rails_7.2/config/initializers/filter_parameter_logging.rb +10 -0
- data/rails_app/rails_7.2/config/initializers/inflections.rb +18 -0
- data/rails_app/rails_7.2/config/locales/en.yml +31 -0
- data/rails_app/rails_7.2/config/puma.rb +36 -0
- data/rails_app/rails_7.2/config/routes.rb +12 -0
- data/rails_app/rails_7.2/config.ru +8 -0
- data/rails_app/rails_7.2/db/seeds.rb +11 -0
- data/rails_app/rails_7.2/lib/tasks/.keep +0 -0
- data/rails_app/rails_7.2/public/robots.txt +3 -0
- data/rails_app/rails_7.2/spec/rails_helper.rb +13 -0
- data/rails_app/rails_7.2/spec/spec_helper.rb +13 -0
- data/rails_app/rails_7.2/storage/.keep +0 -0
- data/rails_app/rails_7.2/tmp/.keep +0 -0
- data/rails_app/rails_7.2/tmp/pids/.keep +0 -0
- data/rails_app/rails_7.2/tmp/storage/.keep +0 -0
- data/rails_app/rails_7.2/vendor/.keep +0 -0
- metadata +107 -7
@@ -10,20 +10,20 @@ module MyApiClient
|
|
10
10
|
#
|
11
11
|
# @param method [Symbol] describe_method_here
|
12
12
|
# @param uri [URI] describe_uri_here
|
13
|
-
# @param headers [Hash, nil] describe_headers_here
|
14
|
-
# @param body [Hash, nil] describe_body_here
|
13
|
+
# @param headers [Hash, Proc<Hash>, nil] describe_headers_here
|
14
|
+
# @param body [Hash, Proc<Hash>, nil] describe_body_here
|
15
15
|
def initialize(method, uri, headers, body)
|
16
16
|
@method = method
|
17
17
|
@uri = uri
|
18
|
-
@headers = headers
|
19
|
-
@body = body
|
18
|
+
@headers = headers.is_a?(Proc) ? headers.call : headers
|
19
|
+
@body = body.is_a?(Proc) ? body.call : body
|
20
20
|
end
|
21
21
|
|
22
22
|
# Description of #to_sawyer_args
|
23
23
|
#
|
24
24
|
# @return [Array<Object>] Arguments for Sawyer::Agent#call
|
25
25
|
def to_sawyer_args
|
26
|
-
[method, uri.to_s, body, { headers:
|
26
|
+
[method, uri.to_s, body, { headers: }]
|
27
27
|
end
|
28
28
|
|
29
29
|
# Generate metadata for bugsnag.
|
@@ -33,8 +33,8 @@ module MyApiClient
|
|
33
33
|
def metadata
|
34
34
|
{
|
35
35
|
line: "#{method.upcase} #{uri}",
|
36
|
-
headers
|
37
|
-
body
|
36
|
+
headers:,
|
37
|
+
body:,
|
38
38
|
}.compact
|
39
39
|
end
|
40
40
|
alias to_bugsnag metadata
|
@@ -43,7 +43,7 @@ module MyApiClient
|
|
43
43
|
#
|
44
44
|
# @return [String] Contents as string
|
45
45
|
def inspect
|
46
|
-
{ method
|
46
|
+
{ method:, uri: uri.to_s, headers:, body: }.inspect
|
47
47
|
end
|
48
48
|
end
|
49
49
|
end
|
@@ -13,11 +13,11 @@ module MyApiClient
|
|
13
13
|
# @param pathname [String]
|
14
14
|
# Pathname of the request target URL.
|
15
15
|
# It's joined with the defined by `endpoint`.
|
16
|
-
# @param headers [Hash, nil]
|
16
|
+
# @param headers [Hash, Proc<Hash>, nil]
|
17
17
|
# Request headers.
|
18
18
|
# @param query [Hash, nil]
|
19
19
|
# Query string.
|
20
|
-
# @param body [Hash, nil]
|
20
|
+
# @param body [Hash, Proc<Hash>, nil]
|
21
21
|
# Request body. You should not specify it when use GET method.
|
22
22
|
# @return [Sawyer::Resource]
|
23
23
|
# Response body instance if the block is not given.
|
@@ -11,12 +11,10 @@ module MyApiClient
|
|
11
11
|
# Pathname of the request target URL. It's joined with the defined by `endpoint`.
|
12
12
|
# @param paging [String, Proc]
|
13
13
|
# Specify the pagination link path included in the response body as JsonPath expression
|
14
|
-
# @param headers [Hash, nil]
|
14
|
+
# @param headers [Hash, Proc<Hash>, nil]
|
15
15
|
# Request headers.
|
16
16
|
# @param query [Hash, nil]
|
17
17
|
# Query string.
|
18
|
-
# @param body [Hash, nil]
|
19
|
-
# Request body. You should not specify it when use GET method.
|
20
18
|
# @return [Enumerator::Lazy]
|
21
19
|
# Yields the pagination API response.
|
22
20
|
def pageable_get(pathname, paging:, headers: nil, query: nil)
|
@@ -15,11 +15,11 @@ module MyApiClient
|
|
15
15
|
# @param pathname [String]
|
16
16
|
# Pathname of the request target URL.
|
17
17
|
# It's joined with the defined by `endpoint`.
|
18
|
-
# @param headers [Hash, nil]
|
18
|
+
# @param headers [Hash, Proc<Hash>, nil]
|
19
19
|
# Request headers.
|
20
20
|
# @param query [Hash, nil]
|
21
21
|
# Query string.
|
22
|
-
# @param body [Hash, nil]
|
22
|
+
# @param body [Hash, Proc<Hash>, nil]
|
23
23
|
# Request body.
|
24
24
|
# @return [Sawyer::Response]
|
25
25
|
# Response instance.
|
@@ -35,9 +35,9 @@ module MyApiClient
|
|
35
35
|
# HTTP method. e.g. `:get`, `:post`, `:put`, `:patch` and `:delete`.
|
36
36
|
# @param uri [URI]
|
37
37
|
# Request target URI including query strings.
|
38
|
-
# @param headers [Hash, nil]
|
38
|
+
# @param headers [Hash, Proc<Hash>, nil]
|
39
39
|
# Request headers.
|
40
|
-
# @param body [Hash, nil]
|
40
|
+
# @param body [Hash, Proc<Hash>, nil]
|
41
41
|
# Request body.
|
42
42
|
# @return [Sawyer::Response]
|
43
43
|
# Response instance.
|
@@ -46,7 +46,7 @@ module MyApiClient
|
|
46
46
|
instance: self,
|
47
47
|
request_params: Params::Request.new(http_method, uri, headers, body),
|
48
48
|
request_logger: Logger.new(logger, http_method, uri),
|
49
|
-
faraday_options:
|
49
|
+
faraday_options:
|
50
50
|
)
|
51
51
|
end
|
52
52
|
|
@@ -21,7 +21,7 @@ RSpec::Matchers.define :request_to do |expected_method, expected_url|
|
|
21
21
|
@actual =
|
22
22
|
{
|
23
23
|
request_line: request_line(method, @actual_schema_and_hostname + pathname),
|
24
|
-
body
|
24
|
+
body:,
|
25
25
|
headers: options[:headers],
|
26
26
|
}.compact
|
27
27
|
end.and_return(dummy_response)
|
data/my_api/Gemfile
CHANGED
@@ -7,7 +7,7 @@ gem 'jets', '~> 4.0.10'
|
|
7
7
|
gem 'dynomite'
|
8
8
|
|
9
9
|
# See: https://github.com/boltops-tools/jets/issues/523
|
10
|
-
gem 'nokogiri', '~> 1.
|
10
|
+
gem 'nokogiri', '~> 1.17.2'
|
11
11
|
|
12
12
|
# development and test groups are not bundled as part of the deployment
|
13
13
|
group :development, :test do
|
data/my_api/Gemfile.lock
CHANGED
@@ -1,43 +1,43 @@
|
|
1
1
|
GEM
|
2
2
|
remote: https://rubygems.org/
|
3
3
|
specs:
|
4
|
-
actionmailer (6.1.7.
|
5
|
-
actionpack (= 6.1.7.
|
6
|
-
actionview (= 6.1.7.
|
7
|
-
activejob (= 6.1.7.
|
8
|
-
activesupport (= 6.1.7.
|
4
|
+
actionmailer (6.1.7.9)
|
5
|
+
actionpack (= 6.1.7.9)
|
6
|
+
actionview (= 6.1.7.9)
|
7
|
+
activejob (= 6.1.7.9)
|
8
|
+
activesupport (= 6.1.7.9)
|
9
9
|
mail (~> 2.5, >= 2.5.4)
|
10
10
|
rails-dom-testing (~> 2.0)
|
11
|
-
actionpack (6.1.7.
|
12
|
-
actionview (= 6.1.7.
|
13
|
-
activesupport (= 6.1.7.
|
11
|
+
actionpack (6.1.7.9)
|
12
|
+
actionview (= 6.1.7.9)
|
13
|
+
activesupport (= 6.1.7.9)
|
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.7.
|
19
|
-
activesupport (= 6.1.7.
|
18
|
+
actionview (6.1.7.9)
|
19
|
+
activesupport (= 6.1.7.9)
|
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.7.
|
25
|
-
activesupport (= 6.1.7.
|
24
|
+
activejob (6.1.7.9)
|
25
|
+
activesupport (= 6.1.7.9)
|
26
26
|
globalid (>= 0.3.6)
|
27
|
-
activemodel (6.1.7.
|
28
|
-
activesupport (= 6.1.7.
|
29
|
-
activerecord (6.1.7.
|
30
|
-
activemodel (= 6.1.7.
|
31
|
-
activesupport (= 6.1.7.
|
32
|
-
activesupport (6.1.7.
|
27
|
+
activemodel (6.1.7.9)
|
28
|
+
activesupport (= 6.1.7.9)
|
29
|
+
activerecord (6.1.7.9)
|
30
|
+
activemodel (= 6.1.7.9)
|
31
|
+
activesupport (= 6.1.7.9)
|
32
|
+
activesupport (6.1.7.9)
|
33
33
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
34
34
|
i18n (>= 1.6, < 2)
|
35
35
|
minitest (>= 5.1)
|
36
36
|
tzinfo (~> 2.0)
|
37
37
|
zeitwerk (~> 2.3)
|
38
|
-
addressable (2.8.
|
39
|
-
public_suffix (>= 2.0.2, <
|
40
|
-
aws-eventstream (1.
|
38
|
+
addressable (2.8.7)
|
39
|
+
public_suffix (>= 2.0.2, < 7.0)
|
40
|
+
aws-eventstream (1.4.0)
|
41
41
|
aws-mfa-secure (0.4.4)
|
42
42
|
activesupport
|
43
43
|
aws-sdk-core
|
@@ -46,7 +46,7 @@ GEM
|
|
46
46
|
rainbow
|
47
47
|
thor
|
48
48
|
zeitwerk
|
49
|
-
aws-partitions (1.
|
49
|
+
aws-partitions (1.1113.0)
|
50
50
|
aws-sdk-apigateway (1.90.0)
|
51
51
|
aws-sdk-core (~> 3, >= 3.188.0)
|
52
52
|
aws-sigv4 (~> 1.1)
|
@@ -56,14 +56,16 @@ GEM
|
|
56
56
|
aws-sdk-cloudwatchlogs (1.75.0)
|
57
57
|
aws-sdk-core (~> 3, >= 3.188.0)
|
58
58
|
aws-sigv4 (~> 1.1)
|
59
|
-
aws-sdk-core (3.
|
59
|
+
aws-sdk-core (3.225.1)
|
60
60
|
aws-eventstream (~> 1, >= 1.3.0)
|
61
|
-
aws-partitions (~> 1, >= 1.
|
62
|
-
aws-sigv4 (~> 1.
|
61
|
+
aws-partitions (~> 1, >= 1.992.0)
|
62
|
+
aws-sigv4 (~> 1.9)
|
63
|
+
base64
|
63
64
|
jmespath (~> 1, >= 1.6.1)
|
64
|
-
|
65
|
-
|
66
|
-
aws-
|
65
|
+
logger
|
66
|
+
aws-sdk-dynamodb (1.145.0)
|
67
|
+
aws-sdk-core (~> 3, >= 3.225.0)
|
68
|
+
aws-sigv4 (~> 1.5)
|
67
69
|
aws-sdk-kinesis (1.54.0)
|
68
70
|
aws-sdk-core (~> 3, >= 3.188.0)
|
69
71
|
aws-sigv4 (~> 1.1)
|
@@ -86,16 +88,17 @@ GEM
|
|
86
88
|
aws-sdk-ssm (1.162.0)
|
87
89
|
aws-sdk-core (~> 3, >= 3.188.0)
|
88
90
|
aws-sigv4 (~> 1.1)
|
89
|
-
aws-sigv4 (1.
|
91
|
+
aws-sigv4 (1.12.0)
|
90
92
|
aws-eventstream (~> 1, >= 1.0.2)
|
91
93
|
aws_config (0.1.1)
|
92
|
-
|
94
|
+
base64 (0.3.0)
|
95
|
+
builder (3.3.0)
|
93
96
|
byebug (11.1.3)
|
94
|
-
capybara (3.
|
97
|
+
capybara (3.40.0)
|
95
98
|
addressable
|
96
99
|
matrix
|
97
100
|
mini_mime (>= 0.1.3)
|
98
|
-
nokogiri (~> 1.
|
101
|
+
nokogiri (~> 1.11)
|
99
102
|
rack (>= 1.6.0)
|
100
103
|
rack-test (>= 0.6.3)
|
101
104
|
regexp_parser (>= 1.5, < 3.0)
|
@@ -107,21 +110,27 @@ GEM
|
|
107
110
|
memoist
|
108
111
|
rainbow
|
109
112
|
cfn_response (0.2.0)
|
110
|
-
|
113
|
+
childprocess (5.1.0)
|
114
|
+
logger (~> 1.5)
|
115
|
+
concurrent-ruby (1.3.5)
|
111
116
|
crass (1.0.6)
|
112
|
-
date (3.
|
113
|
-
diff-lcs (1.
|
117
|
+
date (3.4.1)
|
118
|
+
diff-lcs (1.6.2)
|
114
119
|
dotenv (2.8.1)
|
115
|
-
dynomite (
|
120
|
+
dynomite (2.0.3)
|
121
|
+
activemodel
|
116
122
|
activesupport
|
117
123
|
aws-sdk-dynamodb
|
124
|
+
memoist
|
118
125
|
rainbow
|
119
|
-
|
126
|
+
thor
|
127
|
+
zeitwerk
|
128
|
+
erubi (1.13.0)
|
120
129
|
gems (1.2.0)
|
121
130
|
globalid (1.2.1)
|
122
131
|
activesupport (>= 6.1)
|
123
132
|
hashie (5.0.0)
|
124
|
-
i18n (1.14.
|
133
|
+
i18n (1.14.7)
|
125
134
|
concurrent-ruby (~> 1.0)
|
126
135
|
jets (4.0.10)
|
127
136
|
actionmailer (~> 6.1.0)
|
@@ -164,9 +173,12 @@ GEM
|
|
164
173
|
jmespath (1.6.2)
|
165
174
|
kramdown (2.4.0)
|
166
175
|
rexml
|
167
|
-
launchy (
|
176
|
+
launchy (3.1.1)
|
168
177
|
addressable (~> 2.8)
|
169
|
-
|
178
|
+
childprocess (~> 5.0)
|
179
|
+
logger (~> 1.6)
|
180
|
+
logger (1.7.0)
|
181
|
+
loofah (2.24.1)
|
170
182
|
crass (~> 1.0.2)
|
171
183
|
nokogiri (>= 1.12.0)
|
172
184
|
mail (2.8.1)
|
@@ -178,59 +190,59 @@ GEM
|
|
178
190
|
memoist (0.16.2)
|
179
191
|
method_source (1.0.0)
|
180
192
|
mini_mime (1.1.5)
|
181
|
-
mini_portile2 (2.8.
|
182
|
-
minitest (5.
|
183
|
-
net-imap (0.4.
|
193
|
+
mini_portile2 (2.8.9)
|
194
|
+
minitest (5.25.5)
|
195
|
+
net-imap (0.4.20)
|
184
196
|
date
|
185
197
|
net-protocol
|
186
198
|
net-pop (0.1.2)
|
187
199
|
net-protocol
|
188
200
|
net-protocol (0.2.2)
|
189
201
|
timeout
|
190
|
-
net-smtp (0.
|
202
|
+
net-smtp (0.5.0)
|
191
203
|
net-protocol
|
192
|
-
nio4r (2.7.
|
193
|
-
nokogiri (1.
|
204
|
+
nio4r (2.7.4)
|
205
|
+
nokogiri (1.17.2)
|
194
206
|
mini_portile2 (~> 2.8.2)
|
195
207
|
racc (~> 1.4)
|
196
|
-
public_suffix (
|
197
|
-
puma (6.
|
208
|
+
public_suffix (6.0.2)
|
209
|
+
puma (6.6.0)
|
198
210
|
nio4r (~> 2.0)
|
199
|
-
racc (1.
|
200
|
-
rack (2.2.
|
211
|
+
racc (1.8.1)
|
212
|
+
rack (2.2.17)
|
201
213
|
rack-test (2.1.0)
|
202
214
|
rack (>= 1.3)
|
203
215
|
rails-dom-testing (2.2.0)
|
204
216
|
activesupport (>= 5.0.0)
|
205
217
|
minitest
|
206
218
|
nokogiri (>= 1.6)
|
207
|
-
rails-html-sanitizer (1.6.
|
219
|
+
rails-html-sanitizer (1.6.1)
|
208
220
|
loofah (~> 2.21)
|
209
|
-
nokogiri (
|
210
|
-
railties (6.1.7.
|
211
|
-
actionpack (= 6.1.7.
|
212
|
-
activesupport (= 6.1.7.
|
221
|
+
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
|
222
|
+
railties (6.1.7.9)
|
223
|
+
actionpack (= 6.1.7.9)
|
224
|
+
activesupport (= 6.1.7.9)
|
213
225
|
method_source
|
214
226
|
rake (>= 12.2)
|
215
227
|
thor (~> 1.0)
|
216
228
|
rainbow (3.1.1)
|
217
229
|
rake (13.1.0)
|
218
230
|
recursive-open-struct (1.1.3)
|
219
|
-
regexp_parser (2.
|
220
|
-
rexml (3.
|
221
|
-
rspec (3.
|
222
|
-
rspec-core (~> 3.
|
223
|
-
rspec-expectations (~> 3.
|
224
|
-
rspec-mocks (~> 3.
|
225
|
-
rspec-core (3.
|
226
|
-
rspec-support (~> 3.
|
227
|
-
rspec-expectations (3.
|
231
|
+
regexp_parser (2.9.0)
|
232
|
+
rexml (3.3.9)
|
233
|
+
rspec (3.13.1)
|
234
|
+
rspec-core (~> 3.13.0)
|
235
|
+
rspec-expectations (~> 3.13.0)
|
236
|
+
rspec-mocks (~> 3.13.0)
|
237
|
+
rspec-core (3.13.4)
|
238
|
+
rspec-support (~> 3.13.0)
|
239
|
+
rspec-expectations (3.13.5)
|
228
240
|
diff-lcs (>= 1.2.0, < 2.0)
|
229
|
-
rspec-support (~> 3.
|
230
|
-
rspec-mocks (3.
|
241
|
+
rspec-support (~> 3.13.0)
|
242
|
+
rspec-mocks (3.13.5)
|
231
243
|
diff-lcs (>= 1.2.0, < 2.0)
|
232
|
-
rspec-support (~> 3.
|
233
|
-
rspec-support (3.
|
244
|
+
rspec-support (~> 3.13.0)
|
245
|
+
rspec-support (3.13.4)
|
234
246
|
rspec_junit_formatter (0.6.0)
|
235
247
|
rspec-core (>= 2, < 4, != 2.12.0)
|
236
248
|
serverlessgems (0.4.0)
|
@@ -241,12 +253,12 @@ GEM
|
|
241
253
|
rack (>= 1.0)
|
242
254
|
text-table (1.2.4)
|
243
255
|
thor (1.3.0)
|
244
|
-
timeout (0.4.
|
256
|
+
timeout (0.4.3)
|
245
257
|
tzinfo (2.0.6)
|
246
258
|
concurrent-ruby (~> 1.0)
|
247
259
|
xpath (3.2.0)
|
248
260
|
nokogiri (~> 1.8)
|
249
|
-
zeitwerk (2.6.
|
261
|
+
zeitwerk (2.6.18)
|
250
262
|
|
251
263
|
PLATFORMS
|
252
264
|
ruby
|
@@ -257,7 +269,7 @@ DEPENDENCIES
|
|
257
269
|
dynomite
|
258
270
|
jets (~> 4.0.10)
|
259
271
|
launchy
|
260
|
-
nokogiri (~> 1.
|
272
|
+
nokogiri (~> 1.17.2)
|
261
273
|
puma
|
262
274
|
rack
|
263
275
|
rspec
|
@@ -50,7 +50,7 @@ class PaginationController < ApplicationController
|
|
50
50
|
# but it should be `https://xxxxx.execute-api.ap-northeast-1.amazonaws.com/dev/pagination`.
|
51
51
|
# So this is workaround.
|
52
52
|
def page_link(page)
|
53
|
-
query_strings = "?#{{ page:
|
53
|
+
query_strings = "?#{{ page: }.to_query}"
|
54
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)
|
@@ -10,7 +10,7 @@ class RestController < ApplicationController
|
|
10
10
|
|
11
11
|
# GET rest/:id
|
12
12
|
def show
|
13
|
-
render status: :ok, json: find_post(id:
|
13
|
+
render status: :ok, json: find_post(id:)
|
14
14
|
end
|
15
15
|
|
16
16
|
# POST rest
|
@@ -22,7 +22,7 @@ class RestController < ApplicationController
|
|
22
22
|
# POST/PUT/PATCH rest/:id
|
23
23
|
def update
|
24
24
|
render status: :ok,
|
25
|
-
json: update_post(id
|
25
|
+
json: update_post(id:, title: params[:title])
|
26
26
|
end
|
27
27
|
|
28
28
|
# DELETE rest/:id
|
@@ -49,11 +49,11 @@ class RestController < ApplicationController
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def create_post(title:)
|
52
|
-
{ id: 4, title:
|
52
|
+
{ id: 4, title: }
|
53
53
|
end
|
54
54
|
|
55
55
|
def update_post(id:, title:)
|
56
|
-
find_post(id:
|
56
|
+
find_post(id:).tap do |post|
|
57
57
|
post[:title] = title
|
58
58
|
end
|
59
59
|
end
|
@@ -8,14 +8,14 @@ describe ErrorController do
|
|
8
8
|
let(:expected_response) do
|
9
9
|
{
|
10
10
|
error: {
|
11
|
-
code
|
11
|
+
code:,
|
12
12
|
message: 'You requested error code: 10',
|
13
13
|
},
|
14
14
|
}.to_json
|
15
15
|
end
|
16
16
|
|
17
17
|
it 'returns 400 Bad request with error code 10' do
|
18
|
-
get
|
18
|
+
get('/error/:code', code:)
|
19
19
|
expect(response.status).to eq 400
|
20
20
|
expect(response.body).to eq expected_response
|
21
21
|
end
|
@@ -27,14 +27,14 @@ describe ErrorController do
|
|
27
27
|
let(:expected_response) do
|
28
28
|
{
|
29
29
|
error: {
|
30
|
-
code
|
30
|
+
code:,
|
31
31
|
message: 'You requested error code: 20',
|
32
32
|
},
|
33
33
|
}.to_json
|
34
34
|
end
|
35
35
|
|
36
36
|
it 'returns 400 Bad request with error code 20' do
|
37
|
-
get
|
37
|
+
get('/error/:code', code:)
|
38
38
|
expect(response.status).to eq 400
|
39
39
|
expect(response.body).to eq expected_response
|
40
40
|
end
|
@@ -10,7 +10,7 @@ describe StatusController do
|
|
10
10
|
end
|
11
11
|
|
12
12
|
it 'returns 200 OK' do
|
13
|
-
get
|
13
|
+
get('/status/:status', status:)
|
14
14
|
expect(response.status).to eq status
|
15
15
|
expect(response.body).to eq expected_response
|
16
16
|
end
|
@@ -24,7 +24,7 @@ describe StatusController do
|
|
24
24
|
end
|
25
25
|
|
26
26
|
it 'returns 400 Bad request' do
|
27
|
-
get
|
27
|
+
get('/status/:status', status:)
|
28
28
|
expect(response.status).to eq status
|
29
29
|
expect(response.body).to eq expected_response
|
30
30
|
end
|
@@ -38,7 +38,7 @@ describe StatusController do
|
|
38
38
|
end
|
39
39
|
|
40
40
|
it 'returns 500 Internal server error' do
|
41
|
-
get
|
41
|
+
get('/status/:status', status:)
|
42
42
|
expect(response.status).to eq status
|
43
43
|
expect(response.body).to eq expected_response
|
44
44
|
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 = '>= 3.
|
25
|
+
spec.required_ruby_version = '>= 3.1.0'
|
26
26
|
|
27
27
|
spec.add_dependency 'activesupport', '>= 6.1.0'
|
28
28
|
spec.add_dependency 'faraday', '>= 0.17.1'
|
@@ -38,6 +38,7 @@ Gem::Specification.new do |spec|
|
|
38
38
|
spec.add_development_dependency 'rubocop-performance'
|
39
39
|
spec.add_development_dependency 'rubocop-rake'
|
40
40
|
spec.add_development_dependency 'rubocop-rspec'
|
41
|
+
spec.add_development_dependency 'rubocop-rspec_rails'
|
41
42
|
spec.add_development_dependency 'simplecov', '0.22.0'
|
42
43
|
spec.add_development_dependency 'webmock'
|
43
44
|
spec.add_development_dependency 'yard'
|