lib/lelylan/client/physical.rb in lelylan-rb-0.0.4 vs lib/lelylan/client/physical.rb in lelylan-rb-0.0.5
- old
+ new
@@ -17,25 +17,20 @@
# params - An object containing the JSON params to send.
#
# Returns Hashie The JSON resource.
#
def physical_properties(uri, secret, params)
- params[:nonce] = SecureRandom.uuid if not params[:nonce]
+ headers = { 'X-Physical-Secret' => secret }
- digest = OpenSSL::Digest::Digest.new('sha1')
- signature = OpenSSL::HMAC.hexdigest(digest, secret, params.to_json.to_s)
- headers = { 'X-Physical-Signature' => signature }
-
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