imperituroard 0.3.1 → 0.3.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a9ba1bf7f94a89e810bae8f664f1e689e6fe6b1
|
4
|
+
data.tar.gz: 95581f121eeee4c82c736ffc68c0fdf2a79f8957
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15bed0107947bbd3a31ed87d7bc1117844b8bebe3043ce781a76246983ca9c20aa975a55f029f18732525b101bd97d35fc04ad1bf4209af16317b23c29bf38aa
|
7
|
+
data.tar.gz: 842547ef619f8a3dbc57756fd04d17b02352885c5ad90e6e2df79539fffd7bbc38f35ce9ac3683d0a878ebd1b91b320a5c3a4c5e2586e8d4d27c412eb2e5e654
|
@@ -50,11 +50,12 @@ class HuaIot
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def get_token(app_id, secret)
|
53
|
-
internal_func.
|
53
|
+
internal_func.printer_texter("get_token: start. Step1, iput: app_id: #{app_id.to_s}, #{secret.to_s}", "debug")
|
54
54
|
out_resp = {}
|
55
55
|
begin
|
56
56
|
path = "/iocm/app/sec/v1.1.0/login"
|
57
57
|
url_string = "https://" + platformip + ":" + platformport + path
|
58
|
+
internal_func.printer_texter("get_token: start. Step2, url_string: #{url_string}", "debug")
|
58
59
|
uri = URI.parse url_string
|
59
60
|
https = Net::HTTP.new(uri.host, uri.port)
|
60
61
|
https.use_ssl = true
|
@@ -66,6 +67,7 @@ class HuaIot
|
|
66
67
|
:appId => app_id,
|
67
68
|
:secret => secret
|
68
69
|
}
|
70
|
+
internal_func.printer_texter("get_token: start. Step3, data: #{data.to_s}", "debug")
|
69
71
|
request.content_type = 'application/x-www-form-urlencoded'
|
70
72
|
request.body = URI.encode_www_form(data)
|
71
73
|
res = https.request(request)
|
@@ -74,18 +76,19 @@ class HuaIot
|
|
74
76
|
out_resp = {:code => 500, :message => "failed get token"}
|
75
77
|
end
|
76
78
|
jjj = {:procedure => "get_token", :answ => out_resp}
|
77
|
-
internal_func.printer_texter(jjj)
|
79
|
+
internal_func.printer_texter(jjj, "debug")
|
78
80
|
out_resp
|
79
81
|
end
|
80
82
|
|
81
83
|
|
82
84
|
def token_logout(token)
|
83
85
|
|
84
|
-
internal_func.printer_texter("token_logout token: #{token}")
|
86
|
+
internal_func.printer_texter("token_logout Step1 token: #{token}", "debug")
|
85
87
|
out_resp = {}
|
86
88
|
begin
|
87
89
|
path = "/iocm/app/sec/v1.1.0/logout"
|
88
90
|
url_string = "https://" + platformip + ":" + platformport + path
|
91
|
+
internal_func.printer_texter("token_logout Step2 url_string: #{url_string}", "debug")
|
89
92
|
uri = URI.parse url_string
|
90
93
|
https = Net::HTTP.new(uri.host, uri.port)
|
91
94
|
https.use_ssl = true
|
@@ -96,6 +99,7 @@ class HuaIot
|
|
96
99
|
data = {
|
97
100
|
:accessToken => token
|
98
101
|
}
|
102
|
+
internal_func.printer_texter("token_logout Step3 data: #{data.to_s}", "debug")
|
99
103
|
request.content_type = 'application/json'
|
100
104
|
request.body = URI.encode_www_form(data)
|
101
105
|
res = https.request(request)
|
@@ -104,7 +108,7 @@ class HuaIot
|
|
104
108
|
out_resp = {:code => 500, :message => "failed logout token"}
|
105
109
|
end
|
106
110
|
jjj = {:procedure => "token_logout", :answ => out_resp}
|
107
|
-
internal_func.printer_texter(jjj)
|
111
|
+
internal_func.printer_texter(jjj, "debug")
|
108
112
|
out_resp
|
109
113
|
end
|
110
114
|
|
@@ -3,8 +3,8 @@ $LOAD_PATH.unshift File.expand_path("../projects/iot", __dir__)
|
|
3
3
|
class InternalFunc
|
4
4
|
|
5
5
|
|
6
|
-
def printer_texter(text)
|
7
|
-
mess = {:sdk=> "imperituroard", :sdk_version=> "0.3.
|
6
|
+
def printer_texter(text, log_level)
|
7
|
+
mess = {:sdk=> "imperituroard", :sdk_version=> "0.3.2", :message => text}
|
8
8
|
p mess
|
9
9
|
end
|
10
10
|
|
@@ -12,4 +12,5 @@ class InternalFunc
|
|
12
12
|
def test()
|
13
13
|
p "eeeeeeeeeeeeeeeeeeeeeeee"
|
14
14
|
end
|
15
|
+
|
15
16
|
end
|
@@ -38,7 +38,7 @@ class MongoIot
|
|
38
38
|
rescue
|
39
39
|
out_resp = {:code => 507, :result => "audit_logger: Unknown SDK error"}
|
40
40
|
end
|
41
|
-
internal_func.printer_texter(out_resp)
|
41
|
+
internal_func.printer_texter(out_resp, "debug")
|
42
42
|
out_resp
|
43
43
|
end
|
44
44
|
|
@@ -72,7 +72,7 @@ class MongoIot
|
|
72
72
|
rescue
|
73
73
|
out_resp = {:code => 507, :result => "get_profiles_by_login: Unknown SDK error"}
|
74
74
|
end
|
75
|
-
internal_func.printer_texter(out_resp)
|
75
|
+
internal_func.printer_texter(out_resp, "debug")
|
76
76
|
out_resp
|
77
77
|
end
|
78
78
|
|
@@ -94,7 +94,7 @@ class MongoIot
|
|
94
94
|
rescue
|
95
95
|
out_resp = {:code => 507, :result => "get_imei_info_from_db: Unknown SDK error"}
|
96
96
|
end
|
97
|
-
internal_func.printer_texter(out_resp)
|
97
|
+
internal_func.printer_texter(out_resp, "debug")
|
98
98
|
out_resp
|
99
99
|
end
|
100
100
|
|
@@ -162,7 +162,7 @@ class MongoIot
|
|
162
162
|
else
|
163
163
|
out_resp = {:code => 500, :result => "check_login_profile_permiss: Access denied. Login not found"}
|
164
164
|
end
|
165
|
-
internal_func.printer_texter(out_resp)
|
165
|
+
internal_func.printer_texter(out_resp, "debug")
|
166
166
|
out_resp
|
167
167
|
end
|
168
168
|
|
@@ -191,7 +191,7 @@ class MongoIot
|
|
191
191
|
else
|
192
192
|
out_resp = {:code => 500, :result => "check_login_prof_perm_id_one: Login not found"}
|
193
193
|
end
|
194
|
-
internal_func.printer_texter(out_resp)
|
194
|
+
internal_func.printer_texter(out_resp, "debug")
|
195
195
|
out_resp
|
196
196
|
end
|
197
197
|
|
@@ -214,7 +214,7 @@ class MongoIot
|
|
214
214
|
p res_exists
|
215
215
|
out_resp = {:code => 200, :result => "check_imei_exists: Request completed successfully",
|
216
216
|
:body => {:exists => res_exists, :not_exists => not_ex}}
|
217
|
-
internal_func.printer_texter(out_resp)
|
217
|
+
internal_func.printer_texter(out_resp, "debug")
|
218
218
|
out_resp
|
219
219
|
end
|
220
220
|
|
@@ -311,7 +311,7 @@ class MongoIot
|
|
311
311
|
rescue
|
312
312
|
out_resp = {:code => 507, :result => "get_profile_name_from_imei: Unknown SDK error"}
|
313
313
|
end
|
314
|
-
internal_func.printer_texter(out_resp)
|
314
|
+
internal_func.printer_texter(out_resp, "debug")
|
315
315
|
out_resp
|
316
316
|
end
|
317
317
|
|
@@ -329,7 +329,7 @@ class MongoIot
|
|
329
329
|
rescue
|
330
330
|
out_resp = {:code => 507, :result => "device_remove_single_mongo: Unknown SDK error"}
|
331
331
|
end
|
332
|
-
internal_func.printer_texter(out_resp)
|
332
|
+
internal_func.printer_texter(out_resp, "debug")
|
333
333
|
out_resp
|
334
334
|
end
|
335
335
|
|
@@ -346,7 +346,7 @@ class MongoIot
|
|
346
346
|
rescue
|
347
347
|
out_resp = {:code => 507, :result => "device_modify_attr_mongo: Unknown SDK error"}
|
348
348
|
end
|
349
|
-
internal_func.printer_texter(out_resp)
|
349
|
+
internal_func.printer_texter(out_resp, "debug")
|
350
350
|
out_resp
|
351
351
|
end
|
352
352
|
|
@@ -381,7 +381,7 @@ class MongoIot
|
|
381
381
|
rescue
|
382
382
|
out_resp = {:code => 500, :result => "get_iot_oceanconnect_credent: Process failed"}
|
383
383
|
end
|
384
|
-
internal_func.printer_texter(out_resp)
|
384
|
+
internal_func.printer_texter(out_resp, "debug")
|
385
385
|
out_resp
|
386
386
|
end
|
387
387
|
|