shark-on-lambda 2.0.0 → 2.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 224a4b3bddf92d9409d38d0ad65bae7511e05c0d9d40d8d2b1b6ba5c4224f6e0
4
- data.tar.gz: 46a5ac6faeac926b023069ad953fb2b96340f969a9dcc8df116e29d6536999a2
3
+ metadata.gz: 60c364794145282c0c04213abbf976f245f696442d827b2149e0ccaa1fe95d08
4
+ data.tar.gz: b1360ec675a7267f41ce6d2d385f2a5c5cae8cb87c93a958c79b8c326b4a635e
5
5
  SHA512:
6
- metadata.gz: 5cb73c903cddc2898212b09cc314f9cf35df9f099e8f21eba27df660b2d20ae78c6a828ab29e32a46e433e6485031e1609848c6af49fc53307c04651861d90c6
7
- data.tar.gz: 92f7f4ab12057333a45089f8734c081dab440f22d42bbb6c72de0057e24cfb444089b72ffe1d3c2207ddd70e8d13ae16c88170807dbd6e68a5fd319ed65d0a84
6
+ metadata.gz: 48d8ef1d01c5cfd04fc2c40effca3c53f29bb2b3deaecb8f240a545829425e279274e570e9ace27948a4ec738da115ed5c69cef4418e2023aa8dc99eedf240e2
7
+ data.tar.gz: ec1d9ce4bcb7b62be4f986be8763f31c3879ffc9b1eb800fe676a03df6a93f9313657696486a6a5fe993784fd8c5f601ed398d4c052b350fc02dde2d86f4624b
data/.rubocop.yml CHANGED
@@ -10,10 +10,15 @@ Metrics/BlockLength:
10
10
  Layout/LineLength:
11
11
  Max: 80
12
12
 
13
+ Lint/EmptyClass:
14
+ Enabled: false
15
+
13
16
  Naming/FileName:
14
17
  Exclude:
15
18
  - lib/shark-on-lambda.rb
16
19
  - spec/shark-on-lambda_spec.rb
20
+ Naming/VariableNumber:
21
+ EnforcedStyle: snake_case
17
22
 
18
23
  # TODO: Add documentation and remove the Style/Documentation exception.
19
24
  Style/Documentation:
@@ -2,6 +2,10 @@
2
2
 
3
3
  #### Unreleased
4
4
 
5
+ #### 2.1.0
6
+ - [Fix] `SharkOnLambda::BaseController#render` does not set content type `application/vnd.api+json`
7
+ - [Fix] `:jsonapi` Renderer sets content type `application/vnd.api+json` correctly
8
+
5
9
  #### 2.0.0
6
10
  - [Deprecate] Requiring `shark-on-lambda` is marked as deprecated in favour of requiring `shark_on_lambda`.
7
11
  - [Break] `SharkOnLambda::Dispatcher` was removed in favour of routing via `ActionDispatch::Routing`.
@@ -24,7 +28,7 @@
24
28
  - [Break] Remove the `ApiGateway` namespace, move all items from that namespace up by one level.
25
29
  - [Break] Remove build rake tasks.
26
30
  - [Added `SharkOnLambda::LambdaLogger`](https://www.pivotaltracker.com/story/show/169573932)
27
- - Added support for Rack-compatible middleware.
31
+ - Added support for Rack-compatible middleware.
28
32
  - `SharkOnLambda::BaseController` now acts more like `ActionController::BaseController`.
29
33
  - Support `ActiveModel::Errors` nested validation errors.
30
34
  - Added `SharkOnLambda::RSpec::Helpers` and `SharkOnLambda::RSpec::JsonapiHelpers`.
@@ -4,7 +4,7 @@ require 'active_support/core_ext/string'
4
4
  require 'active_support/deprecation'
5
5
 
6
6
  deprecation_message = <<-MESSAGE.squish
7
- Requiring `shark-on-lambda` is deprecated and will be removed in version 3.0.
7
+ Requiring `shark-on-lambda` is deprecated and will be removed in version 3.
8
8
  Please require `shark_on_lambda` instead.
9
9
  MESSAGE
10
10
  ActiveSupport::Deprecation.warn(deprecation_message, caller(2))
@@ -22,7 +22,7 @@ module SharkOnLambda
22
22
  end
23
23
 
24
24
  ActionController::Renderers.add :jsonapi do |object, options|
25
- response.set_header('content-type', 'application/vnd.api+json')
25
+ response.content_type = 'application/vnd.api+json; charset=utf-8'
26
26
  return { data: {} }.to_json if object.nil?
27
27
 
28
28
  jsonapi_renderer = JsonapiRenderer.new(object)
@@ -52,15 +52,6 @@ module SharkOnLambda
52
52
  self.response_body = no_body? ? nil : { data: {} }.to_json
53
53
  end
54
54
 
55
- def render(object, options = {})
56
- options.merge!(
57
- jsonapi: object,
58
- content_type: 'application/vnd.api+json'
59
- )
60
-
61
- super(options)
62
- end
63
-
64
55
  private
65
56
 
66
57
  def no_body?
@@ -36,7 +36,7 @@ module SharkOnLambda
36
36
  end
37
37
  class_name_parts = message.to_s.split(/\s+/)
38
38
  class_name_parts.map! { |word| word.gsub(/[^a-z]/i, '').capitalize }
39
- class_name = class_name_parts.join('')
39
+ class_name = class_name_parts.join
40
40
  const_set(class_name, error_class)
41
41
 
42
42
  [status_code, error_class]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SharkOnLambda
4
- VERSION = '2.0.0'
4
+ VERSION = '2.1.0'
5
5
  end
@@ -48,7 +48,7 @@ Gem::Specification.new do |spec|
48
48
  spec.add_development_dependency 'pry-byebug'
49
49
  spec.add_development_dependency 'rake'
50
50
  spec.add_development_dependency 'rspec'
51
- spec.add_development_dependency 'rubocop'
51
+ spec.add_development_dependency 'rubocop', '1.11.0'
52
52
  spec.add_development_dependency 'simplecov'
53
53
  spec.add_development_dependency 'yard'
54
54
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shark-on-lambda
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Huy Dinh
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-09-26 00:00:00.000000000 Z
11
+ date: 2021-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack
@@ -208,16 +208,16 @@ dependencies:
208
208
  name: rubocop
209
209
  requirement: !ruby/object:Gem::Requirement
210
210
  requirements:
211
- - - ">="
211
+ - - '='
212
212
  - !ruby/object:Gem::Version
213
- version: '0'
213
+ version: 1.11.0
214
214
  type: :development
215
215
  prerelease: false
216
216
  version_requirements: !ruby/object:Gem::Requirement
217
217
  requirements:
218
- - - ">="
218
+ - - '='
219
219
  - !ruby/object:Gem::Version
220
- version: '0'
220
+ version: 1.11.0
221
221
  - !ruby/object:Gem::Dependency
222
222
  name: simplecov
223
223
  requirement: !ruby/object:Gem::Requirement
@@ -259,13 +259,13 @@ files:
259
259
  - ".gitignore"
260
260
  - ".rspec"
261
261
  - ".rubocop.yml"
262
+ - CHANGELOG.md
262
263
  - CODE_OF_CONDUCT.md
263
264
  - LICENSE.txt
264
265
  - README.md
265
266
  - Rakefile
266
267
  - bin/console
267
268
  - bin/setup
268
- - changelog.md
269
269
  - doc/upgrade-from-0.6.x-to-1.x.md
270
270
  - gems.rb
271
271
  - lib/shark-on-lambda.rb