lhc 7.0.0.beta1 → 7.0.0
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 +10 -7
- data/lib/lhc/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bbf8c19f3a1808c9ee8ae502cc835ec24a6b75ac
|
4
|
+
data.tar.gz: 3d12a0c83e3498c49cd8b498b26c4bf6fab05789
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75b261d1b95a04a77ca8eb5913b5285d3e6e3780562ff9a3f37e985dca9f4c52dd1dc97bec71e5eec97e15406d645ea908c7802ac9e2b9834611ae81d5510f65
|
7
|
+
data.tar.gz: 6e95f8c8754241b62f91d37e46f02eb823aef6b14a6fdd8ef1b5d2c3aba7da4c92ae2312018be9733567c07e60a5a088c3bdb60b5a552214458c87016af50093
|
data/lib/lhc/endpoint.rb
CHANGED
@@ -55,7 +55,16 @@ class LHC::Endpoint
|
|
55
55
|
match_data = match_data(url)
|
56
56
|
return false if match_data.nil?
|
57
57
|
|
58
|
-
match_data.values.
|
58
|
+
first = match_data.values.first
|
59
|
+
last = match_data.values.last
|
60
|
+
url_format = File.extname(url)
|
61
|
+
|
62
|
+
# eliminate false positives in form:
|
63
|
+
# http://host/feedbacks matches {+service}/{entry_id}/feedbacks (service: http:/, entry_id: host)
|
64
|
+
first.match(%{https?:/$}).nil? &&
|
65
|
+
# eliminates false positives in form:
|
66
|
+
# http://host/entries/123.json matches {+service}/entries/{id} (service: http://host, id: 123.json)
|
67
|
+
(url_format.blank? || !last.ends_with?(url_format))
|
59
68
|
end
|
60
69
|
|
61
70
|
# Extracts the values from url and
|
@@ -96,12 +105,6 @@ class LHC::Endpoint
|
|
96
105
|
|
97
106
|
private
|
98
107
|
|
99
|
-
# Ensure there are no false positives in the template matching
|
100
|
-
def valid_value?(value)
|
101
|
-
value.match(%{https?:/$}).nil? &&
|
102
|
-
value.match(/.*\.json/).nil?
|
103
|
-
end
|
104
|
-
|
105
108
|
def match_data(url)
|
106
109
|
parsed = URI.parse(url)
|
107
110
|
parsed.query = parsed.fragment = nil
|
data/lib/lhc/version.rb
CHANGED
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: 7.0.0
|
4
|
+
version: 7.0.0
|
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: 2018-01-
|
11
|
+
date: 2018-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|
@@ -353,9 +353,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
353
353
|
version: 2.0.0
|
354
354
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
355
355
|
requirements:
|
356
|
-
- - "
|
356
|
+
- - ">="
|
357
357
|
- !ruby/object:Gem::Version
|
358
|
-
version:
|
358
|
+
version: '0'
|
359
359
|
requirements:
|
360
360
|
- Ruby >= 2.0.0
|
361
361
|
rubyforge_project:
|