lib/imperituroard/projects/iot/hua_oceanconnect_adapter.rb in imperituroard-0.1.9 vs lib/imperituroard/projects/iot/hua_oceanconnect_adapter.rb in imperituroard-0.2.0
- old
+ new
@@ -112,20 +112,23 @@
#2.2.44 Querying the Device ID
def querying_device_id(app_id, secret, node_id)
token = get_token(app_id, secret)[:body]["accessToken"]
path = "/iocm/app/dm/v1.1.0/queryDeviceIdByNodeId?nodeId=" + node_id
p path
+ p path
url_string = "https://" + platformip + ":" + platformport + path
+ p url_string
uri = URI.parse url_string
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
https.cert = OpenSSL::X509::Certificate.new( File.read(cert_file) )
https.key = OpenSSL::PKey::RSA.new( File.read(key_file))
https.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new( uri.path)
request.content_type = 'application/json'
request['Authorization'] = 'Bearer ' + token
request['app_key'] = app_id
+ p request.body
res = https.request(request)
p res.body.to_s
{:code => res.code, :message => res.message, :body => JSON.parse(res.body.to_s)}
end
\ No newline at end of file