tomogram_routing 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tomogram_routing/tomogram.rb +11 -2
- data/lib/tomogram_routing/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3abd7983bdf67aa0314618cc9690576dc4daf407
|
4
|
+
data.tar.gz: cbad40f31afad50c16bc533affbe3f44bca63edd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 896bfa61bb0a81b93796d1333494e0456852691a59715c11f2d14ec5e77624095387b08e46c6c44e8d8d9798ea344c919988fb6f793b2b30873fddbb983e29f6
|
7
|
+
data.tar.gz: dc2f4a2805945ac1218181edceb70d29a1030459cac975572124800b3aa963f7af132bda9f6399eb218fd21182472906a132ff68875d4ed8553cbd160fd8f5ae
|
@@ -9,8 +9,8 @@ module TomogramRouting
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def find_request(method:, path:)
|
12
|
+
path = find_request_path(method: method, path: path)
|
12
13
|
find do |doc|
|
13
|
-
path = find_request_path(method: method, path: path)
|
14
14
|
doc['path'] == path && doc['method'] == method
|
15
15
|
end
|
16
16
|
end
|
@@ -20,7 +20,7 @@ module TomogramRouting
|
|
20
20
|
def find_request_path(method:, path:)
|
21
21
|
return '' unless path && path.size > 0
|
22
22
|
|
23
|
-
path =
|
23
|
+
path = normalize_path(path)
|
24
24
|
|
25
25
|
action = search_for_an_exact_match(method, path, self)
|
26
26
|
return action['path'] if action
|
@@ -31,11 +31,20 @@ module TomogramRouting
|
|
31
31
|
''
|
32
32
|
end
|
33
33
|
|
34
|
+
def normalize_path(path)
|
35
|
+
path = cut_off_query_params(path)
|
36
|
+
remove_the_slash_at_the_end2(path)
|
37
|
+
end
|
38
|
+
|
34
39
|
def remove_the_slash_at_the_end2(path)
|
35
40
|
return path[0..-2] if path[-1] == '/'
|
36
41
|
path
|
37
42
|
end
|
38
43
|
|
44
|
+
def cut_off_query_params(path)
|
45
|
+
path.gsub(/\?.*\z/, '')
|
46
|
+
end
|
47
|
+
|
39
48
|
def search_for_an_exact_match(method, path, documentation)
|
40
49
|
documentation.find do |action|
|
41
50
|
action['path'] == path && action['method'] == method
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tomogram_routing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- d.efimov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|