lib/lelylan/client/physical.rb in lelylan-rb-0.0.3 vs lib/lelylan/client/physical.rb in lelylan-rb-0.0.4
- old
+ new
@@ -21,13 +21,21 @@
def physical_properties(uri, secret, params)
params[:nonce] = SecureRandom.uuid if not params[:nonce]
digest = OpenSSL::Digest::Digest.new('sha1')
signature = OpenSSL::HMAC.hexdigest(digest, secret, params.to_json.to_s)
- headers = { 'X-Physical-Signature' => signature, 'Content-Type' => 'application/json' }
+ headers = { 'X-Physical-Signature' => signature }
- request = Faraday.new
+ request = Faraday.new do |builder|
+ builder.request :json
+ builder.use Faraday::Response::RaiseHttpError
+ builder.use FaradayMiddleware::Mashify
+ builder.use FaradayMiddleware::ParseJson
+ builder.adapter(adapter)
+ end
+
response = request.put(uri, params, headers)
+
response.body
end
end
end
end