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.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +8 -7
  3. data/.rubocop.yml +7 -4
  4. data/.ruby-version +1 -0
  5. data/CHANGELOG.md +71 -0
  6. data/Gemfile.lock +95 -81
  7. data/README.jp.md +2 -2
  8. data/README.md +2 -2
  9. data/example/api_clients/my_error_api_client.rb +1 -1
  10. data/example/api_clients/my_header_api_client.rb +1 -1
  11. data/example/api_clients/my_pagination_api_client.rb +2 -2
  12. data/example/api_clients/my_rest_api_client.rb +10 -10
  13. data/example/api_clients/my_status_api_client.rb +1 -1
  14. data/gemfiles/rails_7.1.gemfile +15 -0
  15. data/gemfiles/rails_7.2.gemfile +15 -0
  16. data/lib/my_api_client/base.rb +1 -1
  17. data/lib/my_api_client/error_handling.rb +1 -1
  18. data/lib/my_api_client/errors/network_error.rb +1 -1
  19. data/lib/my_api_client/errors.rb +1 -1
  20. data/lib/my_api_client/exceptions.rb +1 -1
  21. data/lib/my_api_client/params/params.rb +1 -1
  22. data/lib/my_api_client/params/request.rb +8 -8
  23. data/lib/my_api_client/request/basic.rb +2 -2
  24. data/lib/my_api_client/request/executor.rb +1 -1
  25. data/lib/my_api_client/request/pagination.rb +1 -3
  26. data/lib/my_api_client/request.rb +5 -5
  27. data/lib/my_api_client/rspec/matcher_helper.rb +3 -3
  28. data/lib/my_api_client/rspec/matchers/request_to.rb +1 -1
  29. data/lib/my_api_client/version.rb +1 -1
  30. data/my_api/Gemfile +1 -1
  31. data/my_api/Gemfile.lock +83 -71
  32. data/my_api/app/controllers/error_controller.rb +1 -1
  33. data/my_api/app/controllers/pagination_controller.rb +1 -1
  34. data/my_api/app/controllers/rest_controller.rb +4 -4
  35. data/my_api/app/controllers/status_controller.rb +1 -1
  36. data/my_api/spec/controllers/error_controller_spec.rb +4 -4
  37. data/my_api/spec/controllers/status_controller_spec.rb +3 -3
  38. data/my_api_client.gemspec +2 -1
  39. data/rails_app/rails_6.1/Gemfile.lock +73 -71
  40. data/rails_app/rails_7.0/Gemfile.lock +78 -76
  41. data/rails_app/rails_7.1/.dockerignore +31 -0
  42. data/rails_app/rails_7.1/.rspec +1 -0
  43. data/rails_app/rails_7.1/Dockerfile +55 -0
  44. data/rails_app/rails_7.1/Gemfile +16 -0
  45. data/rails_app/rails_7.1/Gemfile.lock +241 -0
  46. data/rails_app/rails_7.1/README.md +24 -0
  47. data/rails_app/rails_7.1/Rakefile +8 -0
  48. data/rails_app/rails_7.1/app/controllers/application_controller.rb +4 -0
  49. data/rails_app/rails_7.1/app/controllers/concerns/.keep +0 -0
  50. data/rails_app/rails_7.1/app/models/application_record.rb +5 -0
  51. data/rails_app/rails_7.1/app/models/concerns/.keep +0 -0
  52. data/rails_app/rails_7.1/bin/bundle +122 -0
  53. data/rails_app/rails_7.1/bin/docker-entrypoint +8 -0
  54. data/rails_app/rails_7.1/bin/rails +6 -0
  55. data/rails_app/rails_7.1/bin/rake +6 -0
  56. data/rails_app/rails_7.1/bin/setup +35 -0
  57. data/rails_app/rails_7.1/config/application.rb +46 -0
  58. data/rails_app/rails_7.1/config/boot.rb +5 -0
  59. data/rails_app/rails_7.1/config/credentials.yml.enc +1 -0
  60. data/rails_app/rails_7.1/config/database.yml +25 -0
  61. data/rails_app/rails_7.1/config/environment.rb +7 -0
  62. data/rails_app/rails_7.1/config/environments/development.rb +58 -0
  63. data/rails_app/rails_7.1/config/environments/production.rb +74 -0
  64. data/rails_app/rails_7.1/config/environments/test.rb +56 -0
  65. data/rails_app/rails_7.1/config/initializers/cors.rb +17 -0
  66. data/rails_app/rails_7.1/config/initializers/filter_parameter_logging.rb +10 -0
  67. data/rails_app/rails_7.1/config/initializers/inflections.rb +17 -0
  68. data/rails_app/rails_7.1/config/locales/en.yml +31 -0
  69. data/rails_app/rails_7.1/config/puma.rb +46 -0
  70. data/rails_app/rails_7.1/config/routes.rb +12 -0
  71. data/rails_app/rails_7.1/config.ru +8 -0
  72. data/rails_app/rails_7.1/db/seeds.rb +10 -0
  73. data/rails_app/rails_7.1/lib/tasks/.keep +0 -0
  74. data/rails_app/rails_7.1/public/robots.txt +2 -0
  75. data/rails_app/rails_7.1/spec/rails_helper.rb +13 -0
  76. data/rails_app/rails_7.1/spec/spec_helper.rb +13 -0
  77. data/rails_app/rails_7.1/storage/.keep +0 -0
  78. data/rails_app/rails_7.1/tmp/.keep +0 -0
  79. data/rails_app/rails_7.1/tmp/pids/.keep +0 -0
  80. data/rails_app/rails_7.1/tmp/storage/.keep +0 -0
  81. data/rails_app/rails_7.1/vendor/.keep +0 -0
  82. data/rails_app/rails_7.2/.dockerignore +42 -0
  83. data/rails_app/rails_7.2/.github/dependabot.yml +12 -0
  84. data/rails_app/rails_7.2/.github/workflows/ci.yml +55 -0
  85. data/rails_app/rails_7.2/.rspec +1 -0
  86. data/rails_app/rails_7.2/Dockerfile +62 -0
  87. data/rails_app/rails_7.2/Gemfile +15 -0
  88. data/rails_app/rails_7.2/Gemfile.lock +240 -0
  89. data/rails_app/rails_7.2/README.md +24 -0
  90. data/rails_app/rails_7.2/Rakefile +8 -0
  91. data/rails_app/rails_7.2/app/controllers/application_controller.rb +4 -0
  92. data/rails_app/rails_7.2/app/controllers/concerns/.keep +0 -0
  93. data/rails_app/rails_7.2/app/models/application_record.rb +5 -0
  94. data/rails_app/rails_7.2/app/models/concerns/.keep +0 -0
  95. data/rails_app/rails_7.2/bin/brakeman +9 -0
  96. data/rails_app/rails_7.2/bin/bundle +122 -0
  97. data/rails_app/rails_7.2/bin/docker-entrypoint +13 -0
  98. data/rails_app/rails_7.2/bin/rails +6 -0
  99. data/rails_app/rails_7.2/bin/rake +6 -0
  100. data/rails_app/rails_7.2/bin/rubocop +10 -0
  101. data/rails_app/rails_7.2/bin/setup +39 -0
  102. data/rails_app/rails_7.2/config/application.rb +46 -0
  103. data/rails_app/rails_7.2/config/boot.rb +5 -0
  104. data/rails_app/rails_7.2/config/credentials.yml.enc +1 -0
  105. data/rails_app/rails_7.2/config/database.yml +32 -0
  106. data/rails_app/rails_7.2/config/environment.rb +7 -0
  107. data/rails_app/rails_7.2/config/environments/development.rb +59 -0
  108. data/rails_app/rails_7.2/config/environments/production.rb +77 -0
  109. data/rails_app/rails_7.2/config/environments/test.rb +53 -0
  110. data/rails_app/rails_7.2/config/initializers/cors.rb +18 -0
  111. data/rails_app/rails_7.2/config/initializers/filter_parameter_logging.rb +10 -0
  112. data/rails_app/rails_7.2/config/initializers/inflections.rb +18 -0
  113. data/rails_app/rails_7.2/config/locales/en.yml +31 -0
  114. data/rails_app/rails_7.2/config/puma.rb +36 -0
  115. data/rails_app/rails_7.2/config/routes.rb +12 -0
  116. data/rails_app/rails_7.2/config.ru +8 -0
  117. data/rails_app/rails_7.2/db/seeds.rb +11 -0
  118. data/rails_app/rails_7.2/lib/tasks/.keep +0 -0
  119. data/rails_app/rails_7.2/public/robots.txt +3 -0
  120. data/rails_app/rails_7.2/spec/rails_helper.rb +13 -0
  121. data/rails_app/rails_7.2/spec/spec_helper.rb +13 -0
  122. data/rails_app/rails_7.2/storage/.keep +0 -0
  123. data/rails_app/rails_7.2/tmp/.keep +0 -0
  124. data/rails_app/rails_7.2/tmp/pids/.keep +0 -0
  125. data/rails_app/rails_7.2/tmp/storage/.keep +0 -0
  126. data/rails_app/rails_7.2/vendor/.keep +0 -0
  127. 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: 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: headers,
37
- body: 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: method, uri: uri.to_s, headers: headers, body: body }.inspect
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.
@@ -22,7 +22,7 @@ module MyApiClient
22
22
  @request_params = request_params
23
23
  @request_logger = request_logger
24
24
  faraday = Faraday.new(nil, faraday_options)
25
- @agent = Sawyer::Agent.new('', faraday: faraday)
25
+ @agent = Sawyer::Agent.new('', faraday:)
26
26
  end
27
27
 
28
28
  private
@@ -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: faraday_options
49
+ faraday_options:
50
50
  )
51
51
  end
52
52
 
@@ -13,9 +13,9 @@ module MyApiClient
13
13
  Sawyer::Response,
14
14
  timing: 0.0,
15
15
  data: instance_double(Sawyer::Resource),
16
- status: status,
17
- headers: headers,
18
- body: body
16
+ status:,
17
+ headers:,
18
+ body:
19
19
  )
20
20
  end
21
21
 
@@ -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: body,
24
+ body:,
25
25
  headers: options[:headers],
26
26
  }.compact
27
27
  end.and_return(dummy_response)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MyApiClient
4
- VERSION = '1.1.0'
4
+ VERSION = '1.3.0'
5
5
  end
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.16.0'
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.6)
5
- actionpack (= 6.1.7.6)
6
- actionview (= 6.1.7.6)
7
- activejob (= 6.1.7.6)
8
- activesupport (= 6.1.7.6)
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.6)
12
- actionview (= 6.1.7.6)
13
- activesupport (= 6.1.7.6)
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.6)
19
- activesupport (= 6.1.7.6)
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.6)
25
- activesupport (= 6.1.7.6)
24
+ activejob (6.1.7.9)
25
+ activesupport (= 6.1.7.9)
26
26
  globalid (>= 0.3.6)
27
- activemodel (6.1.7.6)
28
- activesupport (= 6.1.7.6)
29
- activerecord (6.1.7.6)
30
- activemodel (= 6.1.7.6)
31
- activesupport (= 6.1.7.6)
32
- activesupport (6.1.7.6)
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.4)
39
- public_suffix (>= 2.0.2, < 6.0)
40
- aws-eventstream (1.3.0)
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.863.0)
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.190.0)
59
+ aws-sdk-core (3.225.1)
60
60
  aws-eventstream (~> 1, >= 1.3.0)
61
- aws-partitions (~> 1, >= 1.651.0)
62
- aws-sigv4 (~> 1.8)
61
+ aws-partitions (~> 1, >= 1.992.0)
62
+ aws-sigv4 (~> 1.9)
63
+ base64
63
64
  jmespath (~> 1, >= 1.6.1)
64
- aws-sdk-dynamodb (1.98.0)
65
- aws-sdk-core (~> 3, >= 3.188.0)
66
- aws-sigv4 (~> 1.1)
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.8.0)
91
+ aws-sigv4 (1.12.0)
90
92
  aws-eventstream (~> 1, >= 1.0.2)
91
93
  aws_config (0.1.1)
92
- builder (3.2.4)
94
+ base64 (0.3.0)
95
+ builder (3.3.0)
93
96
  byebug (11.1.3)
94
- capybara (3.39.2)
97
+ capybara (3.40.0)
95
98
  addressable
96
99
  matrix
97
100
  mini_mime (>= 0.1.3)
98
- nokogiri (~> 1.8)
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
- concurrent-ruby (1.2.2)
113
+ childprocess (5.1.0)
114
+ logger (~> 1.5)
115
+ concurrent-ruby (1.3.5)
111
116
  crass (1.0.6)
112
- date (3.3.4)
113
- diff-lcs (1.5.0)
117
+ date (3.4.1)
118
+ diff-lcs (1.6.2)
114
119
  dotenv (2.8.1)
115
- dynomite (1.2.7)
120
+ dynomite (2.0.3)
121
+ activemodel
116
122
  activesupport
117
123
  aws-sdk-dynamodb
124
+ memoist
118
125
  rainbow
119
- erubi (1.12.0)
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.1)
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 (2.5.2)
176
+ launchy (3.1.1)
168
177
  addressable (~> 2.8)
169
- loofah (2.22.0)
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.5)
182
- minitest (5.20.0)
183
- net-imap (0.4.7)
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.4.0)
202
+ net-smtp (0.5.0)
191
203
  net-protocol
192
- nio4r (2.7.0)
193
- nokogiri (1.16.0)
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 (5.0.1)
197
- puma (6.4.2)
208
+ public_suffix (6.0.2)
209
+ puma (6.6.0)
198
210
  nio4r (~> 2.0)
199
- racc (1.7.3)
200
- rack (2.2.8)
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.0)
219
+ rails-html-sanitizer (1.6.1)
208
220
  loofah (~> 2.21)
209
- nokogiri (~> 1.14)
210
- railties (6.1.7.6)
211
- actionpack (= 6.1.7.6)
212
- activesupport (= 6.1.7.6)
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.8.1)
220
- rexml (3.2.6)
221
- rspec (3.12.0)
222
- rspec-core (~> 3.12.0)
223
- rspec-expectations (~> 3.12.0)
224
- rspec-mocks (~> 3.12.0)
225
- rspec-core (3.12.0)
226
- rspec-support (~> 3.12.0)
227
- rspec-expectations (3.12.0)
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.12.0)
230
- rspec-mocks (3.12.0)
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.12.0)
233
- rspec-support (3.12.0)
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.1)
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.12)
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.16.0)
272
+ nokogiri (~> 1.17.2)
261
273
  puma
262
274
  rack
263
275
  rspec
@@ -13,7 +13,7 @@ class ErrorController < ApplicationController
13
13
  code = params[:code].to_i
14
14
  {
15
15
  error: {
16
- code: code,
16
+ code:,
17
17
  message: "You requested error code: #{code}",
18
18
  },
19
19
  }
@@ -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: page }.to_query}"
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: 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: id, title: params[:title])
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: title }
52
+ { id: 4, title: }
53
53
  end
54
54
 
55
55
  def update_post(id:, title:)
56
- find_post(id: id).tap do |post|
56
+ find_post(id:).tap do |post|
57
57
  post[:title] = title
58
58
  end
59
59
  end
@@ -5,7 +5,7 @@ class StatusController < ApplicationController
5
5
  # GET status/:status
6
6
  def show
7
7
  status = params[:status].to_i
8
- render status: status,
8
+ render status:,
9
9
  json: { message: "You requested status code: #{status}" }
10
10
  end
11
11
  end
@@ -8,14 +8,14 @@ describe ErrorController do
8
8
  let(:expected_response) do
9
9
  {
10
10
  error: {
11
- code: 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 '/error/:code', code: code
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: 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 '/error/:code', code: code
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 '/status/:status', status: status
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 '/status/:status', status: status
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 '/status/:status', status: status
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
@@ -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.0.0'
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'