imperituroard 1.0.9 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dae0092e4f87b047adb62157ee51cb3e917bc3d7
|
4
|
+
data.tar.gz: be638036010d680252df866b5b09fb49bddd6628
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a0e130dbe846d930dfe7da4a6290f76e4c1f6326e944ea4dbc693bafe90b9087ee4915e0e08dd83c346fb35c6a0ea68ce88ce5f690db27e47ab6b82e1ffaa3c6
|
7
|
+
data.tar.gz: f9c6ffd509148ae09d85fc4aac1439686612283d735fc020f3e45d76fd62e94d41b938d6a033fd93be6e2221612009b66d8a8da948e64fd32e0ee0c252baa93f
|
@@ -133,10 +133,11 @@ class IotFunctions_2
|
|
133
133
|
|
134
134
|
if aaa.key?("type") && !aaa.key?("device_type")
|
135
135
|
aaa["device_type"] = aaa["type"]
|
136
|
-
|
137
|
-
aaa["type"] = aaa["device_type"]
|
136
|
+
aaa = internal_func.delete_key_hash(aaa, "type")
|
138
137
|
end
|
139
138
|
|
139
|
+
aaa = internal_func.hash_val_to_string(aaa)
|
140
|
+
|
140
141
|
if credentials[:code] == 200
|
141
142
|
|
142
143
|
begin
|
@@ -145,6 +146,8 @@ class IotFunctions_2
|
|
145
146
|
#get {"model"=>"BGT_PPMC", "ManufacturerID"=>"unknown", "ManufacturerNAME"=>"unknown", "device_type"=>"unknown"}
|
146
147
|
#from database
|
147
148
|
model_data = mongo_client.get_device_type_info_universal(aaa["device_type"])
|
149
|
+
profile_data = mongo_client.get_profile_universal(aaa["profile"])
|
150
|
+
p profile_data
|
148
151
|
p model_data
|
149
152
|
p "model_data"
|
150
153
|
resss = hua_aceanconnect_connector.add_new_device_on_huawei(credentials[:body][:app_id],
|
@@ -165,6 +168,8 @@ class IotFunctions_2
|
|
165
168
|
s1 = aaa
|
166
169
|
s1[:huadata] = resss
|
167
170
|
s1[:created] = DateTime.now
|
171
|
+
s1["device_type"] = model_data[:body]["model"]
|
172
|
+
s1["profile"] = profile_data["profile_id"]
|
168
173
|
added_on_iot_platf.append(s1)
|
169
174
|
end
|
170
175
|
else
|
@@ -163,6 +163,30 @@ class InternalFunc
|
|
163
163
|
v3.uniq - v2.uniq - v1.uniq
|
164
164
|
end
|
165
165
|
|
166
|
+
|
167
|
+
#delete one key from hash
|
168
|
+
def delete_key_hash(hash_f, delete_key)
|
169
|
+
res = {}
|
170
|
+
hash_f.each do |ggg|
|
171
|
+
if ggg[0].to_s != delete_key.to_s
|
172
|
+
res[ggg[0]] = ggg[1]
|
173
|
+
end
|
174
|
+
end
|
175
|
+
res
|
176
|
+
end
|
177
|
+
|
178
|
+
|
179
|
+
#process hash array. Transform keys to string keys
|
180
|
+
def hash_val_to_string(hash_full)
|
181
|
+
resp = {}
|
182
|
+
hash_full.each do |hsh|
|
183
|
+
resp[hsh[0].to_s] = hsh[1]
|
184
|
+
end
|
185
|
+
resp
|
186
|
+
end
|
187
|
+
|
188
|
+
|
189
|
+
|
166
190
|
def test()
|
167
191
|
p "eeeeeeeeeeeeeeeeeeeeeeee"
|
168
192
|
end
|