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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f32ae25ee97d149c5b7b0febf45613ded6af8e05
4
- data.tar.gz: 932ddc3ae33e26592247508e82f73d75c27b5789
3
+ metadata.gz: 3abd7983bdf67aa0314618cc9690576dc4daf407
4
+ data.tar.gz: cbad40f31afad50c16bc533affbe3f44bca63edd
5
5
  SHA512:
6
- metadata.gz: b4737b8edf5ce4949f5a21cba95c8ed89a7b689216d199348b47d563b551c9a828c70623f85cd10f786a926a0971a5496999f8f394cf6bde9581966c9352f818
7
- data.tar.gz: 37214e3d205f4e5bc6a2f6ddafde93299e7ea1549da4cb7b113a19406a98a0bea42c60efbc138ae9c9041a3e1763e12f1c0d0d1d674ca35f87c7ad53815cdf89
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 = remove_the_slash_at_the_end2(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
@@ -1,3 +1,3 @@
1
1
  module TomogramRouting
2
- VERSION = '0.1.3'.freeze
2
+ VERSION = '0.1.4'.freeze
3
3
  end
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.3
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-02-09 00:00:00.000000000 Z
11
+ date: 2017-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json