lib/imperituroard/projects/iot/hua_oceanconnect_adapter.rb in imperituroard-1.0.7 vs lib/imperituroard/projects/iot/hua_oceanconnect_adapter.rb in imperituroard-1.0.8

- old
+ new

@@ -52,10 +52,13 @@ end def get_token(app_id, secret) internal_func.printer_texter("get_token: start. Step1, iput: app_id: #{app_id.to_s}, secret: #{secret.to_s}", "debug") out_resp = {} + fff = {} + data = {} + url_string = "" begin path = "/iocm/app/sec/v1.1.0/login" url_string = "https://" + platformip + ":" + platformport + path internal_func.printer_texter("get_token: start. Step2, url_string: #{url_string}", "debug") uri = URI.parse url_string @@ -71,30 +74,36 @@ } internal_func.printer_texter("get_token: start. Step3, data: #{data.to_s}", "debug") request.content_type = 'application/x-www-form-urlencoded' request.body = URI.encode_www_form(data) res = https.request(request) + p res.code + p res.message + p res.body.to_s out_resp = {:code => res.code, :message => res.message, :body => JSON.parse(res.body.to_s)} fff = {:func => "get_token", :iot_fun => "", :req_header => {:content_type => 'application/x-www-form-urlencoded', :platform => "Huawei oceanconnect" }} - client_iot_mongo.audit_iot_logger(fff, url_string, data, out_resp) rescue out_resp = {:code => 500, :message => "failed get token"} end + client_iot_mongo.audit_iot_logger(fff, url_string, data, out_resp) jjj = {:procedure => "get_token", :answ => out_resp} internal_func.printer_texter(jjj, "debug") out_resp end def token_logout(token) internal_func.printer_texter("token_logout Step1 token: #{token}", "debug") out_resp = {} + fff = {} + data = {} + url_string = "" begin path = "/iocm/app/sec/v1.1.0/logout" url_string = "https://" + platformip + ":" + platformport + path internal_func.printer_texter("token_logout Step2 url_string: #{url_string}", "debug") uri = URI.parse url_string @@ -114,13 +123,17 @@ out_resp = {:code => res.code, :message => res.message, :body => JSON.parse(res.body.to_s)} fff = {:func => "token_logout", :iot_fun => "logout", :platform => "Huawei oceanconnect" } - client_iot_mongo.audit_iot_logger(fff, url_string, data, out_resp) + p res.code + p res.message + p res.body.to_s + rescue out_resp = {:code => 500, :message => "failed logout token"} end + client_iot_mongo.audit_iot_logger(fff, url_string, data, out_resp) jjj = {:procedure => "token_logout", :answ => out_resp} internal_func.printer_texter(jjj, "debug") out_resp end \ No newline at end of file