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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e68ebb38114ba76d726e65f348946433c1ab94a18fcc20a3b41c00d07bf4b738
4
- data.tar.gz: 9ed57062704dcc6a3b220dcb53140b8c474794b6af887ea2f5bbbc1611b04baf
3
+ metadata.gz: ec7d824cf97fc0b087d9f9294e06b82612b74220d2c9960766d83330d56ed1e5
4
+ data.tar.gz: 334ede61a8065c965dfd26654cb759ff0a9548231cedc057ec97f3647a5f9476
5
5
  SHA512:
6
- metadata.gz: '03397de5e0773e962c6503ac01e9f8e312e2ab16d9e2642cbdc10965167e1bbb21500a17cede64fabc16757e3b890abaaaf229154b5059292a3fea5eb950747b'
7
- data.tar.gz: 91f2df019a74bf1eb58e37580efc70c4479f38eb31a01762fe7fc5c70373444ea5525d8656dfa14a7d8cf789d417789597ff75a0ab54fa4bbd98dc273bb6216c
6
+ metadata.gz: da1e51625ff33aecce4324ef811cfc5d65e445fd3062ee80a9f810f697a0ca25468170ffa12dceba8c46a02db7a8b80f3d562041e33de888f3a4d13c8d64abf2
7
+ data.tar.gz: 9300d6917c93634d4a7059579ea20568bcb2c350306ac37c614d188046be94e4587cf50d133a129376c35c140ee5807c245dac180f0a0445690210348510c94a
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.5
1
+ 0.0.6
@@ -3,7 +3,27 @@
3
3
  module Aserto
4
4
  module ResourceMapper
5
5
  class << self
6
- def execute(_request)
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aserto
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aserto