lhc 3.5.3 → 3.5.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: 9f9dd4a891bb2dfe1d92a2645cabc2f62e20f151
4
- data.tar.gz: 79773712ea94e1067655ba8009c585a22a20f58a
3
+ metadata.gz: 8b55a6d77b6a16bb202a4babfc914427d70f092e
4
+ data.tar.gz: c618090650536a4f7fbff41c8b83a59b91108e3f
5
5
  SHA512:
6
- metadata.gz: 7eb974645a68588ffcd873ecbbaa501807de0bb6abd8f5fb0a7a7b419b86169b7c788756ed1260c4ee2015ec5c21b86356124695f0296c9f30f1996f1a3349be
7
- data.tar.gz: 46e449afd28c4d99a45d679e7daadde1ec1edba2bfe57bfdeaf9e2b67916fbee9a57caf3345bd5a8d23d0daa770a4a7f7d6d137c4694df83d1b1fd2a8260c983
6
+ metadata.gz: 036f5aa745a97701ef069a902b9ba7d6b6bb142d72ccfd028ebe91358d68ae23d98b6ea2f70d55c87ba7d064185f7c9b24b99b9a19107e8c00c802ff076fc0e7
7
+ data.tar.gz: 74db7500de0d6a3638c5f96ec918984e4dc9624a2405679fb7936e54178e98d9faa638f41b2fb61ad5bf3fe2c07e7fa1d06c5240a46a1296128209eb03d9525d
@@ -2,8 +2,8 @@
2
2
  # The url can also be an url-template.
3
3
  class LHC::Endpoint
4
4
 
5
- PLACEHOLDER = %r{(?<=^):[^\/]+|(?<=\/):[^\/]+}
6
- ANYTHING_BUT_SINGLE_SLASH = '([^\/]|\/\/)+'.freeze
5
+ PLACEHOLDER = %r{(?<=^):[^\/\.]+|(?<=\/):[^\/\.]+}
6
+ ANYTHING_BUT_SINGLE_SLASH_AND_DOT = '([^\/\.]|\/\/)+'.freeze
7
7
 
8
8
  attr_accessor :url, :options
9
9
 
@@ -63,7 +63,7 @@ class LHC::Endpoint
63
63
  # Returns true if concrete url is covered by the template
64
64
  # Example: :datastore/contracts/:id == http://local.ch/contracts/1
65
65
  def self.match?(url, template)
66
- regexp = template.gsub PLACEHOLDER, ANYTHING_BUT_SINGLE_SLASH
66
+ regexp = template.gsub PLACEHOLDER, ANYTHING_BUT_SINGLE_SLASH_AND_DOT
67
67
  url.match "#{regexp}$"
68
68
  end
69
69
 
@@ -1,3 +1,3 @@
1
1
  module LHC
2
- VERSION = "3.5.3"
2
+ VERSION = "3.5.4"
3
3
  end
@@ -19,5 +19,12 @@ describe LHC::Endpoint do
19
19
  endpoint.compile(find_value)
20
20
  ).to eq "http://datastore/v2"
21
21
  end
22
+
23
+ it 'compiles when templates contain dots' do
24
+ endpoint = described_class.new(':datastore/entries/:id.json')
25
+ expect(
26
+ endpoint.compile(datastore: 'http://datastore', id: 123)
27
+ ).to eq "http://datastore/entries/123.json"
28
+ end
22
29
  end
23
30
  end
@@ -10,7 +10,8 @@ describe LHC::Endpoint do
10
10
  ':datastore/v2/places/:namespace/:id' => 'http://local.ch:8082/v2/places/switzerland/ZW9OJyrbt',
11
11
  ':datastore/addresses/:id' => 'http://local.ch/addresses/123',
12
12
  'http://local.ch/addresses/:id' => 'http://local.ch/addresses/123',
13
- ':datastore/customers/:id/addresses' => 'http://local.ch:80/server/rest/v1/customers/123/addresses'
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
15
  }.each do |template, url|
15
16
  expect(
16
17
  described_class.match?(url, template)
@@ -24,7 +25,8 @@ describe LHC::Endpoint do
24
25
  {
25
26
  ':datastore/v2/places' => 'http://local.ch:8082/v2/places/ZW9OJyrbt4OZE9ueu80w-A',
26
27
  ':datastore/:campaign_id/feedbacks' => 'http://datastore.local.ch/feedbacks',
27
- ':datastore/customers/:id' => 'http://local.ch:80/server/rest/v1/customers/123/addresses'
28
+ ':datastore/customers/:id' => 'http://local.ch:80/server/rest/v1/customers/123/addresses',
29
+ ':datastore/entries/:id' => 'http://local.ch/entries/123.json'
28
30
  }.each do |template, url|
29
31
  expect(
30
32
  described_class.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: 3.5.3
4
+ version: 3.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - local.ch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-17 00:00:00.000000000 Z
11
+ date: 2016-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus