imperituroard 1.0.1 → 1.0.2

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: 7f4803bd76c090876b654425c6a5a76237ce07da
4
- data.tar.gz: afc8920cded7afea1bab18ebc83ab992915f1329
3
+ metadata.gz: e940fef724694620f92446e776b76f186aefb9f2
4
+ data.tar.gz: 7684c9da421ec5e068e1992aa69d9908d8617398
5
5
  SHA512:
6
- metadata.gz: fa6fd8bb0af774f0acd9a01cd74bb1851f5c437eb06c981a86767d1c0151261f3b62f4bba1624d835bc2902147229d2828f9a1ff8291134ada8786cc3a8acebc
7
- data.tar.gz: 19874621621215547e23187b1643f3422d44228d071e357fada3b91e7f0cb35f76e4df8c4b5c5c28bd6194a06f9a9c8f17106a3bc19b6ee5e4c5e0871a7b3ced
6
+ metadata.gz: 192b9dc5e4d12006aa68c10cd50455edffb5c6d0ed0452022437653c7780c506e40a99bf2a084c1ce264fd4f5214e8511e37f4e8c32e505a8b54638be9422bab
7
+ data.tar.gz: 65d41e4c02a8f54585dd6652e9637e60b0b60204788d7e0bcfd50ed7632ee3c9959dc7f50a26745189a11cf8104f1859843d67cedb0ed47602df6463a3d8b559
@@ -74,6 +74,11 @@ class HuaIot
74
74
  request.body = URI.encode_www_form(data)
75
75
  res = https.request(request)
76
76
  out_resp = {:code => res.code, :message => res.message, :body => JSON.parse(res.body.to_s)}
77
+ fff = {:func => "get_token",
78
+ :iot_fun => "",
79
+ :req_header => {:content_type => 'application/x-www-form-urlencoded'
80
+ }}
81
+ client_iot_mongo.audit_iot_logger(fff, url_string, data, out_resp)
77
82
  rescue
78
83
  out_resp = {:code => 500, :message => "failed get token"}
79
84
  end
@@ -106,6 +111,10 @@ class HuaIot
106
111
  request.body = URI.encode_www_form(data)
107
112
  res = https.request(request)
108
113
  out_resp = {:code => res.code, :message => res.message, :body => JSON.parse(res.body.to_s)}
114
+ fff = {:func => "token_logout",
115
+ :iot_fun => "logout"
116
+ }
117
+ client_iot_mongo.audit_iot_logger(fff, url_string, data, out_resp)
109
118
  rescue
110
119
  out_resp = {:code => 500, :message => "failed logout token"}
111
120
  end
@@ -131,7 +140,6 @@ class HuaIot
131
140
  request['app_key'] = app_id
132
141
  request.body = {nodeId: node_id}.to_json
133
142
  res = https.request(request)
134
- p res.body.to_s
135
143
  {:code => res.code, :message => res.message, :body => JSON.parse(res.body.to_s)}
136
144
  end
137
145
 
@@ -220,15 +228,11 @@ class HuaIot
220
228
  request['Authorization'] = 'Bearer ' + token
221
229
  request['app_key'] = app_id
222
230
  res = https.request(request)
223
- p "res.code"
224
- p res.code
225
- p res.body
226
231
  if res.body != nil
227
232
  out_resp = {:code => res.code, :message => res.message, :body => {:answ => JSON.parse(res.body.to_s)}}
228
233
  else
229
234
  out_resp = {:code => res.code, :message => res.message, :body => {:answ => "no data"}}
230
235
  end
231
-
232
236
  fff = {:func => "dev_delete",
233
237
  :iot_fun => "2.2.12",
234
238
  :req_header => {:authorization => 'Bearer ' + token,
@@ -239,7 +243,6 @@ class HuaIot
239
243
  rescue
240
244
  out_resp = {:code => 500, :message => "dev_delete: Unknown IOT error"}
241
245
  end
242
- p out_resp
243
246
  out_resp
244
247
  end
245
248
 
@@ -310,6 +313,7 @@ class HuaIot
310
313
 
311
314
  #2.9.6 Querying Directly Connected Devices and Their Mounted Devices in Batches
312
315
  def querying_device_direct_conn(app_id, secret, dev_list)
316
+ output_str = {}
313
317
  token = get_token(app_id, secret)[:body]["accessToken"]
314
318
  path = "/iocm/app/dm/v1.1.0/queryDevicesByIds"
315
319
  url_string = "https://" + platformip + ":" + platformport + path
@@ -323,9 +327,18 @@ class HuaIot
323
327
  request.content_type = 'application/json'
324
328
  request['Authorization'] = 'Bearer ' + token
325
329
  request['app_key'] = app_id
326
- request.body = {deviceIds: dev_list}.to_json
330
+ req_body = {deviceIds: dev_list}
331
+ request.body = req_body.to_json
327
332
  res = https.request(request)
328
- {:code => res.code, :message => res.message, :body => JSON.parse(res.body.to_s)}
333
+ output_str = {:code => res.code, :message => res.message, :body => JSON.parse(res.body.to_s)}
334
+ fff = {:func => "querying_device_direct_conn",
335
+ :iot_fun => "2.9.6",
336
+ :req_header => {:authorization => 'Bearer ' + token,
337
+ :content_type => 'application/json',
338
+ :app_key => app_id
339
+ }}
340
+ client_iot_mongo.audit_iot_logger(fff, url_string, req_body, output_str)
341
+ output_str
329
342
  end
330
343
 
331
344
 
@@ -390,7 +403,8 @@ class HuaIot
390
403
  request.content_type = 'application/json'
391
404
  request['Authorization'] = 'Bearer ' + token
392
405
  request['app_key'] = app_id
393
- request.body = {location: address}.to_json
406
+ req_b = {location: address}
407
+ request.body = req_b.to_json
394
408
  res = https.request(request)
395
409
  p res.code
396
410
  p res.body
@@ -399,6 +413,13 @@ class HuaIot
399
413
  else
400
414
  out_resp = {:code => res.code, :message => res.message, :body => {:answ => "no data"}}
401
415
  end
416
+ fff = {:func => "dev_modify_location_v2",
417
+ :iot_fun => "2.2.11",
418
+ :req_header => {:authorization => 'Bearer ' + token,
419
+ :content_type => 'application/json',
420
+ :app_key => app_id
421
+ }}
422
+ client_iot_mongo.audit_iot_logger(fff, url_string, req_b, out_resp)
402
423
  rescue
403
424
  out_resp = {:code => 500, :message => "dev_modify_location_v2: Unknown IOT error"}
404
425
  end
@@ -1,3 +1,3 @@
1
1
  module Imperituroard
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: imperituroard
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dzmitry Buynovskiy
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-07 00:00:00.000000000 Z
11
+ date: 2020-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler