lib/imperituroard.rb in imperituroard-0.2.3 vs lib/imperituroard.rb in imperituroard-0.2.4
- old
+ new
@@ -459,60 +459,60 @@
begin
for g in device_list
p g
- prof_name1 = mongo_client.get_profile_name_from_imei(g[:imei])
+ prof_name1 = mongo_client.get_profile_name_from_imei(g["imei"])
p prof_name1
if prof_name1[:code]==200
p prof_name1
permiss1 = mongo_client.check_login_profile_permiss(login, prof_name1[:body]["profile"])
p "permiss1"
p permiss1
if permiss1[:code]==200
- if g[:attributes].key?(:profile)
- permiss2 = mongo_client.check_login_profile_permiss(login, g[:attributes][:profile])[:code]
+ if g["attributes"].key?("profile")
+ permiss2 = mongo_client.check_login_profile_permiss(login, g["attributes"]["profile"])[:code]
if permiss2==200
- attr = g[:attributes]
+ attr = g["attributes"]
#mod_attr = {}
- if attr.key?(:profile)
- if attr[:profile].is_a? Integer
+ if attr.key?("profile")
+ if attr["profile"].is_a? Integer
p "Ok"
else
- p new = mongo_client.get_profile_id_by_name(attr[:profile])
- attr[:profile] = new["profile_id"]
+ p new = mongo_client.get_profile_id_by_name(attr["profile"])
+ attr["profile"] = new["profile_id"]
end
end
p attr
- mongo_client.device_modify_any_attr_mongo(g[:imei], attr)
+ mongo_client.device_modify_any_attr_mongo(g["imei"], attr)
- processed.append(g[:imei])
+ processed.append(g["imei"])
else
- not_processed.append({:imei=>g[:imei], :description=> "New profile permission error", :error=>permiss2 })
+ not_processed.append({:imei=>g["imei"], :description=> "New profile permission error", :error=>permiss2 })
end
else
- attr = g[:attributes]
- mongo_client.device_modify_any_attr_mongo(g[:imei], attr)
+ attr = g["attributes"]
+ mongo_client.device_modify_any_attr_mongo(g["imei"], attr)
- processed.append(g[:imei])
+ processed.append(g["imei"])
end
else
- not_processed.append({:imei=>g[:imei], :description=> "Old profile permission error", :error=>permiss1 })
+ not_processed.append({:imei=>g["imei"], :description=> "Old profile permission error", :error=>permiss1 })
end
else
- not_processed.append({:imei=>g[:imei],:error=>prof_name1})
+ not_processed.append({:imei=>g["imei"],:error=>prof_name1})
end
end
resp_out = {:code => 200, :result => "Request completed successfully", :body => {:imei_processed => processed, :error_list => not_processed}}