lhc 3.3.0 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4bd80d03c65bd862b57ce1124558e137284a3d23
4
- data.tar.gz: 4329e5c72edb5119904420d08faaf971190d45e8
3
+ metadata.gz: eb463da7364d39d932831f54620966aa82caafa6
4
+ data.tar.gz: 2af2b5e6e49064dc6cc6f116f1d4605496dd1dce
5
5
  SHA512:
6
- metadata.gz: 3129c6d7886946887fb0574d356a405c8e2b5e5f92cafc063582dad73307a62f1d2bc1210e8e570bbe7b22568ac52f1c23392cc88d9e9cb20dbcf3c2eaa2d10b
7
- data.tar.gz: 4c484cdc38c4f0efa2b37ab8b455c49fde466d62ed4e69653c2ad3528ec09a1bf0225f4ffb4489ff2ba3bee5c23552fb050b8963e2eda771d56975048b0a55f1
6
+ metadata.gz: 723ca264ea852ba2c36f5a76c6775f0943a1a44395567b1701e40e54be6a4784b3d6b10a3c5b76727864987926d394b2ec2506066f633c57d63db6bab5e63947
7
+ data.tar.gz: d18edd4d615302b5c39c61c8d148b0880dcec0cd8e0be14fb0e151a87f90e9bed9dc75863d6955588810c2e84d3e61da068441c23c337885fae1d16550943af0
@@ -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[:url] = endpoint.compile(options[:params])
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
 
@@ -1,3 +1,3 @@
1
1
  module LHC
2
- VERSION = "3.3.0"
2
+ VERSION = "3.4.0"
3
3
  end
@@ -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.3.0
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-14 00:00:00.000000000 Z
11
+ date: 2015-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus