imperituroard 1.0.7 → 1.0.8

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: 4f4aba43e40c3e31b5d3336e6dd8233ced0fdc47
4
- data.tar.gz: 14a08ce0ee5ee4af6f0af163c4eb148e1c18274b
3
+ metadata.gz: 5e7e99efd1a73f476d513d802842f3f0433cd5be
4
+ data.tar.gz: 760abd30d5d6ea6419c0f4195c08b9dca3d73537
5
5
  SHA512:
6
- metadata.gz: bbb81cd14c71ebe0693054322a33f8ad93096cada10528eb7665d8f822ec53430f42f81ccbaeb632bc7f41441509fda8dc2d0b69b54de6cdea11abe5034ac306
7
- data.tar.gz: 6d9f3d756baaa25e8eacbb630822b1c26449d677caaa3dc0d47e8c79c1e514dfe6321c5370922f7b41da86ca466437f03ee1f2d45fffca990a73a4941053feff
6
+ metadata.gz: 6f8d0903a392cf44f300612e621ea34647cf5158c67dbd2f0fa75c7470e867e48a3d94b0676f666ed50ea6e9b40d6702467ac9a05ea9737831fe9cf024e8903f
7
+ data.tar.gz: 24741e66dc260aaef273175b302f840a89b4ffb7b25395e73bc1d087661f89cd54130e7c49076d4572c782a4a574adfff19c495f099ce1ac044c004d435c78dd
@@ -141,6 +141,8 @@ class IotFunctions_2
141
141
  #get {"model"=>"BGT_PPMC", "ManufacturerID"=>"unknown", "ManufacturerNAME"=>"unknown", "device_type"=>"unknown"}
142
142
  #from database
143
143
  model_data = mongo_client.get_device_type_info_universal(aaa["device_type"])
144
+ p model_data
145
+ p "model_data"
144
146
  resss = hua_aceanconnect_connector.add_new_device_on_huawei(credentials[:body][:app_id],
145
147
  credentials[:body][:secret],
146
148
  aaa["imei"],
@@ -1059,11 +1061,12 @@ class IotFunctions_2
1059
1061
  if resss[:body].key?("error_code") && resss[:body]["error_code"] != 200
1060
1062
  not_processed_list.append({:imei => curr_dev["imei"], :error => resss})
1061
1063
  else
1064
+ p resss
1062
1065
  new_id_iot = resss[:body]
1063
1066
  new_profile_id = prof_new_id
1064
1067
  now_date = DateTime.now
1065
1068
  #finished success. update database
1066
- attribute = {profile: new_profile_id, device_type: model_data[:body]["model"], huadata: {body: new_id_iot}, updated: now_date}
1069
+ attribute = {profile: new_profile_id, device_type: model_data[:body]["model"], huadata: resss, updated: now_date}
1067
1070
  answ_mongo = mongo_client.modify_attr_mongo_universal(curr_dev["imei"].to_i, attribute)
1068
1071
  if answ_mongo[:code] != 200
1069
1072
  not_processed_list.append({:imei => curr_dev["imei"], :error => "Critical error. Mongo not updated", :mongo_err => answ_mongo})
@@ -54,6 +54,9 @@ class HuaIot
54
54
  def get_token(app_id, secret)
55
55
  internal_func.printer_texter("get_token: start. Step1, iput: app_id: #{app_id.to_s}, secret: #{secret.to_s}", "debug")
56
56
  out_resp = {}
57
+ fff = {}
58
+ data = {}
59
+ url_string = ""
57
60
  begin
58
61
  path = "/iocm/app/sec/v1.1.0/login"
59
62
  url_string = "https://" + platformip + ":" + platformport + path
@@ -73,16 +76,19 @@ class HuaIot
73
76
  request.content_type = 'application/x-www-form-urlencoded'
74
77
  request.body = URI.encode_www_form(data)
75
78
  res = https.request(request)
79
+ p res.code
80
+ p res.message
81
+ p res.body.to_s
76
82
  out_resp = {:code => res.code, :message => res.message, :body => JSON.parse(res.body.to_s)}
77
83
  fff = {:func => "get_token",
78
84
  :iot_fun => "",
79
85
  :req_header => {:content_type => 'application/x-www-form-urlencoded',
80
86
  :platform => "Huawei oceanconnect"
81
87
  }}
82
- client_iot_mongo.audit_iot_logger(fff, url_string, data, out_resp)
83
88
  rescue
84
89
  out_resp = {:code => 500, :message => "failed get token"}
85
90
  end
91
+ client_iot_mongo.audit_iot_logger(fff, url_string, data, out_resp)
86
92
  jjj = {:procedure => "get_token", :answ => out_resp}
87
93
  internal_func.printer_texter(jjj, "debug")
88
94
  out_resp
@@ -93,6 +99,9 @@ class HuaIot
93
99
 
94
100
  internal_func.printer_texter("token_logout Step1 token: #{token}", "debug")
95
101
  out_resp = {}
102
+ fff = {}
103
+ data = {}
104
+ url_string = ""
96
105
  begin
97
106
  path = "/iocm/app/sec/v1.1.0/logout"
98
107
  url_string = "https://" + platformip + ":" + platformport + path
@@ -116,10 +125,14 @@ class HuaIot
116
125
  :iot_fun => "logout",
117
126
  :platform => "Huawei oceanconnect"
118
127
  }
119
- client_iot_mongo.audit_iot_logger(fff, url_string, data, out_resp)
128
+ p res.code
129
+ p res.message
130
+ p res.body.to_s
131
+
120
132
  rescue
121
133
  out_resp = {:code => 500, :message => "failed logout token"}
122
134
  end
135
+ client_iot_mongo.audit_iot_logger(fff, url_string, data, out_resp)
123
136
  jjj = {:procedure => "token_logout", :answ => out_resp}
124
137
  internal_func.printer_texter(jjj, "debug")
125
138
  out_resp
@@ -540,7 +540,7 @@ class MongoIot
540
540
  result_ps.append(row)
541
541
  }
542
542
  dattaa = result_ps[0]
543
- if dattaa!=nil
543
+ if dattaa != nil
544
544
  out_resp = {:code => 200, :result => "get_device_type_info_by_model: Request completed successfully", :body => dattaa}
545
545
  else
546
546
  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"}}
@@ -566,9 +566,9 @@ class MongoIot
566
566
  }
567
567
  dattaa = result_ps[0]
568
568
  if dattaa!=nil
569
- out_resp = {:code => 200, :result => "get_device_type_info_by_model: Request completed successfully", :body => dattaa}
569
+ out_resp = {:code => 200, :result => "get_device_type_info_universal: Request completed successfully", :body => dattaa}
570
570
  else
571
- 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"}}
571
+ 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"}}
572
572
  end
573
573
  else
574
574
  result_ps2 = []
@@ -578,9 +578,9 @@ class MongoIot
578
578
  }
579
579
  dattaa = result_ps2[0]
580
580
  if dattaa!=nil
581
- out_resp = {:code => 200, :result => "get_device_type_info_by_model: Request completed successfully", :body => dattaa}
581
+ out_resp = {:code => 200, :result => "get_device_type_info_universal: Request completed successfully", :body => dattaa}
582
582
  else
583
- 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"}}
583
+ 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"}}
584
584
  end
585
585
  end
586
586
 
@@ -1,4 +1,4 @@
1
1
  module Imperituroard
2
- VERSION = "1.0.7"
2
+ VERSION = "1.0.8"
3
3
  end
4
4
 
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.7
4
+ version: 1.0.8
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-08 00:00:00.000000000 Z
11
+ date: 2020-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler