lhc 3.3.0 → 3.4.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/request.rb +6 -1
- data/lib/lhc/version.rb +1 -1
- data/spec/request/url_patterns_spec.rb +5 -0
- 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: eb463da7364d39d932831f54620966aa82caafa6
|
4
|
+
data.tar.gz: 2af2b5e6e49064dc6cc6f116f1d4605496dd1dce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 723ca264ea852ba2c36f5a76c6775f0943a1a44395567b1701e40e54be6a4784b3d6b10a3c5b76727864987926d394b2ec2506066f633c57d63db6bab5e63947
|
7
|
+
data.tar.gz: d18edd4d615302b5c39c61c8d148b0880dcec0cd8e0be14fb0e151a87f90e9bed9dc75863d6955588810c2e84d3e61da068441c23c337885fae1d16550943af0
|
data/lib/lhc/request.rb
CHANGED
@@ -83,7 +83,12 @@ class LHC::Request
|
|
83
83
|
# Generates URL from a URL template
|
84
84
|
def generate_url_from_template!
|
85
85
|
endpoint = LHC::Endpoint.new(options[:url])
|
86
|
-
options[:
|
86
|
+
params = if options[:body] && options[:body].length && (options[:headers] || {}).fetch('Content-Type', nil) == 'application/json'
|
87
|
+
JSON.parse(options[:body]).merge(options[:params] || {}).deep_symbolize_keys
|
88
|
+
else
|
89
|
+
options[:params]
|
90
|
+
end
|
91
|
+
options[:url] = endpoint.compile(params)
|
87
92
|
endpoint.remove_interpolated_params!(options[:params])
|
88
93
|
end
|
89
94
|
|
data/lib/lhc/version.rb
CHANGED
@@ -16,4 +16,9 @@ describe LHC::Request do
|
|
16
16
|
stub_request(:get, 'http://datastore:8080/v2/feedbacks/123')
|
17
17
|
LHC.get('http://datastore:8080/v2/feedbacks/:id', params:{id: 123})
|
18
18
|
end
|
19
|
+
|
20
|
+
it 'considers body when compiling urls' do
|
21
|
+
stub_request(:post, "http://datastore:8080/v2/places/123")
|
22
|
+
LHC.json.post('http://datastore:8080/v2/places/:id', body: {id: 123}.to_json)
|
23
|
+
end
|
19
24
|
end
|
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.
|
4
|
+
version: 3.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- local.ch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|