lib/imperituroard/projects/iot/hua_oceanconnect_adapter.rb in imperituroard-0.4.7 vs lib/imperituroard/projects/iot/hua_oceanconnect_adapter.rb in imperituroard-0.4.8
- old
+ new
@@ -211,10 +211,11 @@
request = Net::HTTP::Delete.new(uri.path)
request.content_type = 'application/json'
request['Authorization'] = 'Bearer ' + token
request['app_key'] = app_id
res = https.request(request)
+ p "res.code"
p res.code
p res.body
if res.body != nil
out_resp = {:code => res.code, :message => res.message, :body => {:answ => JSON.parse(res.body.to_s)}}
else
@@ -507,11 +508,10 @@
p uri.host
p uri.port
p uri.path
-
cert_file = "/Users/imperituroard/Desktop/cert.crt"
key_file = "/Users/imperituroard/Desktop/key.pem"
p https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
@@ -524,21 +524,18 @@
data = {
:appId => "bCRahH5zSi9SNmyfqv3BkJABAq8a",
:secret => "ppeMsOq6zdb2fSUH4GoRooS_FgEa"
}
-
#request['app_key'] = 'ppeMsOq6zdb2fSUH4GoRooS_FgEa'
#request['Authorization'] = 'Bearer ppeMsOq6zdb2fSUH4GoRooS_FgEa'
request.content_type = 'application/x-www-form-urlencoded'
#p request.body = req
request.body = URI.encode_www_form(data)
res = https.request(request)
p res.code
p res.message
-
p parse_token(res.body)
-
end
# App ID
# password O2k2aMStOweZOeSoVDYjI3c6uaMa
\ No newline at end of file