jets 1.9.28 → 1.9.29
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/CHANGELOG.md +4 -0
- data/lib/jets/controller/callbacks.rb +8 -0
- data/lib/jets/resource.rb +14 -1
- data/lib/jets/resource/api_gateway/method.rb +1 -1
- data/lib/jets/resource/api_gateway/resource.rb +2 -2
- data/lib/jets/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 79e4c2c7bfc0d49e93f4f16272d4d4208e59d408a29ec26be8ff904ccebe1d2f
|
4
|
+
data.tar.gz: bca0a08b1917fee8fad565dc6cc5bd59774388f737a3377f0961e4fed8cbc549
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6c2b17a8da82d9e6056950d5d0b97a83b3da6db4e10d3e4f5ca35917de4e69654e06fa336c792037bcb93d88314ed6a611aa726ecef537ef544e69876198de2
|
7
|
+
data.tar.gz: 98d1cb7545111c8c2c763ee216cf5ac5faf550e73ecb7f26472ffb9e292342e9ef8b993355658eb45fa193a1f42ba99c3db604c73f574b5134c71797a97f5770
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,10 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
This project *loosely tries* to adhere to [Semantic Versioning](http://semver.org/).
|
5
5
|
|
6
|
+
## [1.9.29]
|
7
|
+
- #303 API Gateway: Do not generate resource names longer than 62 characters
|
8
|
+
- #304 Add skip\_before\_action and skip\_after\_action method callbacks
|
9
|
+
|
6
10
|
## [1.9.28]
|
7
11
|
- #302 improve jets call guesser, do a simple detection at the start
|
8
12
|
|
@@ -16,6 +16,10 @@ class Jets::Controller
|
|
16
16
|
self.before_actions = [[meth, options]] + self.before_actions
|
17
17
|
end
|
18
18
|
|
19
|
+
def skip_before_action(meth)
|
20
|
+
self.before_actions = self.before_actions.reject { |el| el.first.to_s == meth.to_s }
|
21
|
+
end
|
22
|
+
|
19
23
|
alias_method :append_before_action, :before_action
|
20
24
|
|
21
25
|
def after_action(meth, options={})
|
@@ -26,6 +30,10 @@ class Jets::Controller
|
|
26
30
|
self.after_actions = [[meth, options]] + self.after_actions
|
27
31
|
end
|
28
32
|
|
33
|
+
def skip_after_action(meth)
|
34
|
+
self.after_actions = self.after_actions.reject { |el| el.first.to_s == meth.to_s }
|
35
|
+
end
|
36
|
+
|
29
37
|
alias_method :append_after_action, :after_action
|
30
38
|
end
|
31
39
|
end # included
|
data/lib/jets/resource.rb
CHANGED
@@ -21,7 +21,20 @@ class Jets::Resource
|
|
21
21
|
id = template.keys.first
|
22
22
|
# replace possible {namespace} in the logical id
|
23
23
|
id = replacer.replace_value(id)
|
24
|
-
Jets::Camelizer.camelize(id)
|
24
|
+
id = Jets::Camelizer.camelize(id)
|
25
|
+
|
26
|
+
Jets::Resource.truncate_id(id)
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.truncate_id(id)
|
30
|
+
# Api Gateway resource name has a limit of 64 characters.
|
31
|
+
# Yet it throws not found when ID is longer than 62 characters and I don't know why.
|
32
|
+
# To keep it safe, let's stick to the 62 characters limit.
|
33
|
+
if id.size > 62
|
34
|
+
"#{id[0..55]}#{Digest::MD5.hexdigest(id)[0..5]}"
|
35
|
+
else
|
36
|
+
id
|
37
|
+
end
|
25
38
|
end
|
26
39
|
|
27
40
|
def type
|
@@ -28,7 +28,7 @@ module Jets::Resource::ApiGateway
|
|
28
28
|
if @path == ''
|
29
29
|
"RootResourceId"
|
30
30
|
else
|
31
|
-
"#{path_logical_id(@path)}ApiResource"
|
31
|
+
Jets::Resource.truncate_id "#{path_logical_id(@path)}ApiResource"
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
@@ -41,7 +41,7 @@ module Jets::Resource::ApiGateway
|
|
41
41
|
if @path.include?('/') # posts/:id or posts/:id/edit
|
42
42
|
parent_path = @path.split('/')[0..-2].join('/')
|
43
43
|
parent_logical_id = path_logical_id(parent_path)
|
44
|
-
"!Ref #{parent_logical_id}ApiResource"
|
44
|
+
"!Ref " + Jets::Resource.truncate_id("#{parent_logical_id}ApiResource")
|
45
45
|
else
|
46
46
|
"!GetAtt #{RestApi.logical_id(@internal)}.RootResourceId"
|
47
47
|
end
|
data/lib/jets/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.9.
|
4
|
+
version: 1.9.29
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tung Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-07-
|
11
|
+
date: 2019-07-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionmailer
|