lhc 5.0.2 → 5.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lhc/endpoint.rb +3 -0
- data/lib/lhc/version.rb +1 -1
- data/spec/endpoint/match_spec.rb +2 -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: b254c12c9236f595f73e159d35b7f13c9e501e3c
|
4
|
+
data.tar.gz: e8ccff4d8334e8e4b87bee5171f2c27ea44a8508
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7e34e0029c58dc0f766a949f21bb771cecc0cd92a5ae8a91e429342c45c7c03df42e3d3df2a164ff08a76321d679c865d25ed12f7eb203093539b7720d36364
|
7
|
+
data.tar.gz: b17640979f7bb7257b94bfc4dfe1b7f5e1f64356772f069d192420ed097c59c5e0b9d0e3bed54fc425dd66f587b8ebda134738f1b9bd94eeee5e46cad79f6945
|
data/lib/lhc/endpoint.rb
CHANGED
@@ -5,6 +5,7 @@ class LHC::Endpoint
|
|
5
5
|
|
6
6
|
PLACEHOLDER ||= %r{:[^\/\.:;\d\&]+}
|
7
7
|
ANYTHING_BUT_SINGLE_SLASH_AND_DOT ||= '([^\/\.]|\/\/)+'.freeze
|
8
|
+
URL_PARAMETERS ||= '(\\?.*)*'
|
8
9
|
|
9
10
|
attr_accessor :url, :options
|
10
11
|
|
@@ -65,6 +66,7 @@ class LHC::Endpoint
|
|
65
66
|
# Example: :datastore/contracts/:id == http://local.ch/contracts/1
|
66
67
|
def self.match?(url, template)
|
67
68
|
regexp = template.gsub PLACEHOLDER, ANYTHING_BUT_SINGLE_SLASH_AND_DOT
|
69
|
+
regexp += URL_PARAMETERS
|
68
70
|
url.match "#{regexp}$"
|
69
71
|
end
|
70
72
|
|
@@ -83,6 +85,7 @@ class LHC::Endpoint
|
|
83
85
|
name = placeholder.gsub(":", '')
|
84
86
|
regexp = regexp.gsub(placeholder, "(?<#{name}>.*)")
|
85
87
|
end
|
88
|
+
regexp += URL_PARAMETERS
|
86
89
|
matchdata = url.match(Regexp.new("^#{regexp}$"))
|
87
90
|
LHC::Endpoint.placeholders(template).each do |placeholder|
|
88
91
|
name = placeholder.gsub(':', '')
|
data/lib/lhc/version.rb
CHANGED
data/spec/endpoint/match_spec.rb
CHANGED
@@ -11,7 +11,8 @@ describe LHC::Endpoint do
|
|
11
11
|
':datastore/addresses/:id' => 'http://local.ch/addresses/123',
|
12
12
|
'http://local.ch/addresses/:id' => 'http://local.ch/addresses/123',
|
13
13
|
':datastore/customers/:id/addresses' => 'http://local.ch:80/server/rest/v1/customers/123/addresses',
|
14
|
-
':datastore/entries/:id.json' => 'http://local.ch/entries/123.json'
|
14
|
+
':datastore/entries/:id.json' => 'http://local.ch/entries/123.json',
|
15
|
+
':datastore/places/:place_id/feedbacks' => 'http://local.ch/places/1/feedbacks?limit=10&offset=0'
|
15
16
|
}.each do |template, url|
|
16
17
|
expect(
|
17
18
|
LHC::Endpoint.match?(url, template)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lhc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0.
|
4
|
+
version: 5.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- https://github.com/local-ch/lhc/contributors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-05-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|