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

- old
+ new

@@ -538,11 +538,11 @@ collection = client[:device_types] collection.find({"model" => device_model}).each {|row| result_ps.append(row) } dattaa = result_ps[0] - if dattaa!=nil + if dattaa != nil out_resp = {:code => 200, :result => "get_device_type_info_by_model: Request completed successfully", :body => dattaa} else out_resp = {:code => 404, :result => "get_device_type_info_by_model: Device info not found", :body => {"model" => device_model, "ManufacturerID" => "unknown", "ManufacturerNAME" => "unknown", "device_type" => "unknown"}} end rescue @@ -564,24 +564,24 @@ collection.find({"model" => device_model}).each {|row| result_ps.append(row) } dattaa = result_ps[0] if dattaa!=nil - out_resp = {:code => 200, :result => "get_device_type_info_by_model: Request completed successfully", :body => dattaa} + out_resp = {:code => 200, :result => "get_device_type_info_universal: Request completed successfully", :body => dattaa} else - out_resp = {:code => 404, :result => "get_device_type_info_by_model: Device info not found", :body => {"model" => device_model, "ManufacturerID" => "unknown", "ManufacturerNAME" => "unknown", "device_type" => "unknown"}} + out_resp = {:code => 404, :result => "get_device_type_info_universal: Device info not found", :body => {"model" => device_model, "ManufacturerID" => "unknown", "ManufacturerNAME" => "unknown", "device_type" => "unknown"}} end else result_ps2 = [] collection = client[:device_types] collection.find({"type_id" => device_model.to_i}).each {|row| result_ps2.append(row) } dattaa = result_ps2[0] if dattaa!=nil - out_resp = {:code => 200, :result => "get_device_type_info_by_model: Request completed successfully", :body => dattaa} + out_resp = {:code => 200, :result => "get_device_type_info_universal: Request completed successfully", :body => dattaa} else - out_resp = {:code => 404, :result => "get_device_type_info_by_model: Device info not found", :body => {"model" => device_model, "ManufacturerID" => "unknown", "ManufacturerNAME" => "unknown", "device_type" => "unknown"}} + out_resp = {:code => 404, :result => "get_device_type_info_universal: Device info not found", :body => {"model" => device_model, "ManufacturerID" => "unknown", "ManufacturerNAME" => "unknown", "device_type" => "unknown"}} end end rescue out_resp = {:code => 500, :result => "get_device_type_info_universal: procedure error", :body => {"model" => device_model, "ManufacturerID" => "unknown", "ManufacturerNAME" => "unknown", "device_type" => "unknown"}}