aserto 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/aserto/resource_mapper.rb +21 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec7d824cf97fc0b087d9f9294e06b82612b74220d2c9960766d83330d56ed1e5
|
4
|
+
data.tar.gz: 334ede61a8065c965dfd26654cb759ff0a9548231cedc057ec97f3647a5f9476
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da1e51625ff33aecce4324ef811cfc5d65e445fd3062ee80a9f810f697a0ca25468170ffa12dceba8c46a02db7a8b80f3d562041e33de888f3a4d13c8d64abf2
|
7
|
+
data.tar.gz: 9300d6917c93634d4a7059579ea20568bcb2c350306ac37c614d188046be94e4587cf50d133a129376c35c140ee5807c245dac180f0a0445690210348510c94a
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.6
|
@@ -3,7 +3,27 @@
|
|
3
3
|
module Aserto
|
4
4
|
module ResourceMapper
|
5
5
|
class << self
|
6
|
-
def execute(
|
6
|
+
def execute(request)
|
7
|
+
if defined? ::Rails
|
8
|
+
params = request.params
|
9
|
+
return {} unless params.is_a?(Hash) && !params.empty?
|
10
|
+
|
11
|
+
require_relative "rails/utils"
|
12
|
+
|
13
|
+
route = Aserto::Rails::Utils.route(request)
|
14
|
+
path = route[:path] if route
|
15
|
+
return {} unless path
|
16
|
+
|
17
|
+
fields = path.split("/")
|
18
|
+
.select { |part| part.starts_with?(":") }
|
19
|
+
.map { |field| field.sub(":", "") }
|
20
|
+
return {} if fields.empty?
|
21
|
+
|
22
|
+
require "google/protobuf/well_known_types"
|
23
|
+
return Google::Protobuf::Struct.from_hash(fields.to_h { |field| [field, params[field]] })
|
24
|
+
|
25
|
+
end
|
26
|
+
|
7
27
|
{}
|
8
28
|
end
|
9
29
|
end
|