imperituroard 0.5.0 → 0.5.1

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: a7099d271ae8850c9fe1799ef6a1aa26191a8041
4
- data.tar.gz: aa800c9ed06865ae2e11b6e46441208c98763273
3
+ metadata.gz: 52002c225cdd8a15b12f2d30c3bd9abbb7c81cdb
4
+ data.tar.gz: '098b0b33d5bdfb45f0b0912c9f5d882cf06a9278'
5
5
  SHA512:
6
- metadata.gz: 2d81c1af75860e3815ee8e258bdaeacb3ac68f85086ff4a4a5cb20dd1304dbf924a51c9a6458ce15991c4ad6d8fea2f0e67f12d07375ff094a23ce88410caf87
7
- data.tar.gz: 35036f5a002e190af58383c5e85e0d93213954c959de3801ac0a86703419940e4aa0b6c6fd832c0f1850617a9f86c65aa3563e79cd5fa1beb1b62f93e0f9b424
6
+ metadata.gz: 885ae1c34b6f201e8f77a2ea0f0a21852c0b95a37f4c01e9394ad63892264c4070e79ff0d20103b452eb54c2651ed1d1a424182a18feb282973cf697f9f2bb9a
7
+ data.tar.gz: 56cc1e2a934b2cd1b8be4d83794838daa358d27939fb27eb3fda9a463a485639c3409d275a9ef8d8735674f429ceafe521f439015d2d5d5a6d7f3d9bb9c94b55
@@ -36,5 +36,9 @@ Gem::Specification.new do |spec|
36
36
  spec.add_development_dependency "mongo", "2.11.4"
37
37
  spec.add_development_dependency "nokogiri", "1.10.9"
38
38
  spec.add_development_dependency "ipaddr", "1.2.2"
39
+ spec.add_development_dependency "simpleidn", "0.1.1"
40
+ spec.add_development_dependency "net-scp", "3.0.0"
41
+
42
+
39
43
 
40
44
  end
data/lib/imperituroard.rb CHANGED
@@ -3,8 +3,10 @@ $LOAD_PATH.unshift File.expand_path("../projects/wttx", __dir__)
3
3
  $LOAD_PATH.unshift File.expand_path("../projects/mhub", __dir__)
4
4
  $LOAD_PATH.unshift File.expand_path("../projects/mhub/subs/dabrab", __dir__)
5
5
  $LOAD_PATH.unshift File.expand_path("../platforms/cps", __dir__)
6
+ $LOAD_PATH.unshift File.expand_path("../platforms/public", __dir__)
6
7
  $LOAD_PATH.unshift File.expand_path("../projects", __dir__)
7
8
 
9
+
8
10
  require "imperituroard/version"
9
11
  require "imperituroard/projects/wttx/phpipamdb"
10
12
  require "imperituroard/projects/wttx/phpipamcps"
@@ -18,7 +20,9 @@ require 'imperituroard/projects/mhub/subs/dabrab/dabrab_proced'
18
20
  require 'imperituroard/projects/mhub/subs/dabrab/dabrab_platform'
19
21
  require 'imperituroard/projects/mhub'
20
22
  require 'imperituroard/projects/iot'
23
+ require 'imperituroard/projects/dns'
21
24
  require 'imperituroard/platforms/cps/qps_connector'
25
+ require 'imperituroard/platforms/public/telegram'
22
26
  require 'json'
23
27
  require 'ipaddr'
24
28
  require 'date'
@@ -249,6 +253,10 @@ class Iot
249
253
  mongo_client.audit_logger(proc_name, src_ip, input_json, output_json, real_ip)
250
254
  end
251
255
 
256
+ def test111
257
+ iot_connector.test
258
+ end
259
+
252
260
 
253
261
  end
254
262
 
@@ -269,12 +277,12 @@ class Mhub_2
269
277
  @sk_login = sk_login
270
278
  @sk_password = sk_password
271
279
  @internal_func = InternalFunc.new
272
- @mhub_connector = Sksk_1.new(sk_url_simple, sk_login, sk_password, sk_url_broadcast)
280
+ @mhub_connector = Sksk_2.new(sk_url_simple, sk_login, sk_password, sk_url_broadcast, telegram_api_url, telegram_chat_id)
273
281
  @internal_func = InternalFunc.new
274
282
  @dabrab_connecter = Dabrab.new
275
- @add_functions_connector = AdditionalFunc.new(telegram_api_url, telegram_chat_id)
283
+
276
284
  @static_callback = static_callback
277
- @crm_connector = Crm_1.new(crm_callback_url, crm_login, crm_password)
285
+ @crm_connector = Crm_2.new(crm_callback_url, crm_login, crm_password, telegram_api_url, telegram_chat_id)
278
286
  @mhub_connector = MhubFunctions_2.new(sk_url_simple, sk_login, sk_password, telegram_api_url, telegram_chat_id, sk_url_broadcast, static_callback, crm_callback_url, crm_login, crm_password)
279
287
  end
280
288
 
@@ -298,6 +306,8 @@ class Mhub_2
298
306
  mhub_connector.rec_deliv_report_2(params, ip_src, ip_real, ip_vip)
299
307
  end
300
308
 
309
+
310
+
301
311
  end
302
312
 
303
313
 
@@ -319,4 +329,47 @@ class CpsFunctions_2
319
329
  qps_connector.get_subscriber_msisdn(msisdn)
320
330
  end
321
331
 
332
+ end
333
+
334
+
335
+ class Ukaz60Automation_2
336
+
337
+ attr_accessor :dns
338
+
339
+ def initialize(telegram_api_url,
340
+ telegram_chat_id,
341
+ work_directory,
342
+ filename_blocked,
343
+ filename_tmp_blocked,
344
+ ip_for_redirect,
345
+ add_bl_memory_script,
346
+ del_bl_memory_script,
347
+ dns_login,
348
+ dns_password,
349
+ belgim_login,
350
+ belgim_password,
351
+ belgim_url)
352
+ @ukaz69_dns_func = Dns_2.new(telegram_api_url,
353
+ telegram_chat_id,
354
+ work_directory,
355
+ filename_blocked,
356
+ filename_tmp_blocked,
357
+ ip_for_redirect,
358
+ add_bl_memory_script,
359
+ del_bl_memory_script,
360
+ dns_login,
361
+ dns_password,
362
+ belgim_login,
363
+ belgim_password,
364
+ belgim_url)
365
+ end
366
+
367
+
368
+ def test
369
+
370
+ end
371
+
372
+
373
+
374
+
322
375
  end
@@ -0,0 +1,34 @@
1
+
2
+
3
+
4
+ class Telegram_2
5
+
6
+ attr_accessor :telegram_api_url, :telegram_chat_id
7
+
8
+ def initialize(telegram_api_url, telegram_chat_id)
9
+ @telegram_api_url = telegram_api_url
10
+ @telegram_chat_id = telegram_chat_id
11
+ end
12
+
13
+ #procedure for send log to telegram chat
14
+ def telegram_message(message)
15
+ begin
16
+ uri = URI.parse(telegram_api_url)
17
+ https_connector = Net::HTTP.new(uri.host, uri.port)
18
+ https_connector.use_ssl = true
19
+ data = {chat_id: telegram_chat_id, text: message}
20
+ request_mess = Net::HTTP::Post.new(uri.request_uri, {'Content-Type' => 'application/json'})
21
+ request_mess.body = data.to_json
22
+ response_mess = https_connector.request(request_mess)
23
+ body = response_mess.body
24
+ return {:code => 200,
25
+ :result => "Request completed successfully",
26
+ :body => {:telegram_resp => JSON.parse(body.to_s),
27
+ :description => "Telegram message to telegram_chat_id: #{telegram_chat_id.to_s}"}}
28
+ rescue
29
+ return {:code => 507, :result => "Unknown SDK error"}
30
+ end
31
+ end
32
+
33
+
34
+ end
@@ -0,0 +1,44 @@
1
+ require 'imperituroard/projects/dns/ukaz60/dns_update'
2
+
3
+
4
+ class Dns_2
5
+
6
+ attr_accessor :ukaz69_dns_func
7
+
8
+ def initialize(telegram_api_url,
9
+ telegram_chat_id,
10
+ work_directory,
11
+ filename_blocked,
12
+ filename_tmp_blocked,
13
+ ip_for_redirect,
14
+ add_bl_memory_script,
15
+ del_bl_memory_script,
16
+ dns_login,
17
+ dns_password,
18
+ belgim_login,
19
+ belgim_password,
20
+ belgim_url)
21
+
22
+ @ukaz69_dns_func = Ukaz60Dns_2.new(telegram_api_url,
23
+ telegram_chat_id,
24
+ work_directory,
25
+ filename_blocked,
26
+ filename_tmp_blocked,
27
+ ip_for_redirect,
28
+ add_bl_memory_script,
29
+ del_bl_memory_script,
30
+ dns_login,
31
+ dns_password,
32
+ belgim_login,
33
+ belgim_password,
34
+ belgim_url)
35
+ end
36
+
37
+
38
+ def ukaz60_dns_autoupdate()
39
+
40
+ end
41
+
42
+
43
+
44
+ end
@@ -0,0 +1,415 @@
1
+
2
+ require 'imperituroard/platforms/public/telegram'
3
+
4
+ require 'simpleidn'
5
+ require 'net/scp'
6
+ require 'net/ssh'
7
+ require 'ipaddr'
8
+ require 'net/http'
9
+ require 'json'
10
+ require 'date'
11
+
12
+
13
+
14
+ class Ukaz60Dns_2
15
+
16
+
17
+ attr_accessor :telegram_messanger,
18
+ :work_directory,
19
+ :filename_blocked,
20
+ :filename_tmp_blocked,
21
+ :ip_for_redirect,
22
+ :add_bl_memory_script,
23
+ :del_bl_memory_script,
24
+ :dns_login,
25
+ :dns_password,
26
+ :belgim_login,
27
+ :belgim_password,
28
+ :belgim_url,
29
+ :blo,
30
+ :unblo
31
+
32
+ def initialize(telegram_api_url,
33
+ telegram_chat_id,
34
+ work_directory,
35
+ filename_blocked,
36
+ filename_tmp_blocked,
37
+ ip_for_redirect,
38
+ add_bl_memory_script,
39
+ del_bl_memory_script,
40
+ dns_login,
41
+ dns_password,
42
+ belgim_login,
43
+ belgim_password,
44
+ belgim_url
45
+ )
46
+ @telegram_messanger = Telegram_2.new(telegram_api_url, telegram_chat_id)
47
+ @work_directory = work_directory
48
+ @filename_blocked = filename_blocked
49
+ @filename_tmp_blocked = filename_tmp_blocked
50
+ @ip_for_redirect = ip_for_redirect
51
+ @add_bl_memory_script = add_bl_memory_script
52
+ @del_bl_memory_script = del_bl_memory_script
53
+ @blo = 0
54
+ @unblo = 0
55
+ end
56
+
57
+
58
+
59
+ def gen_mem_script()
60
+
61
+ string = File.open(filename_blocked, 'r'){ |file| file.read }
62
+ redns = /local-zone: "(.+)" redirect/
63
+ m111 = string.scan(redns)
64
+
65
+ string = File.open(filename_tmp_blocked, 'r'){ |file| file.read }
66
+ m222 = string.scan(redns)
67
+
68
+
69
+ old = []
70
+ new = []
71
+ diff = []
72
+ diff2 = []
73
+
74
+ for iii in m111
75
+ new.push(iii[0])
76
+ end
77
+
78
+ for jjj in m222
79
+ old.push(jjj[0])
80
+ end
81
+
82
+ def difference(other)
83
+ h = other.each_with_object(Hash.new(0)) { |e,h| h[e] += 1 }
84
+ reject { |e| h[e] > 0 && h[e] -= 1 }
85
+ end
86
+
87
+ for dfdfd in new
88
+ if old.include?(dfdfd)
89
+ else
90
+ diff.push(dfdfd)
91
+ end
92
+ end
93
+
94
+ for dfdfd2 in old
95
+ if new.include?(dfdfd2)
96
+ else
97
+ diff2.push(dfdfd2)
98
+ end
99
+ end
100
+
101
+ file = File.open(add_bl_memory_script, "w")
102
+ for j in diff
103
+ a111 = 'unbound-control local_data ' + j + " A #{ip_for_redirect}"
104
+ a222 = 'unbound-control local_zone ' + j + ' redirect'
105
+ #print a1
106
+ file.puts(a111)
107
+ file.puts(a222)
108
+ end
109
+ file.close
110
+
111
+ file2 = File.open(del_bl_memory_script, "w")
112
+ for j in diff2
113
+ b111 = 'unbound-control local_zone_remove ' + j
114
+ b222 = 'unbound-control local_data_remove ' + j
115
+ #print a1
116
+ file2.puts(b111)
117
+ file2.puts(b222)
118
+ end
119
+ file2.close
120
+
121
+ p diff
122
+ p diff2
123
+
124
+
125
+ if diff != [] && @blo == 0
126
+ telegram_messanger.telegram_message("Domains for blocking: " + diff.to_s)
127
+ @blo = 1
128
+ end
129
+
130
+ if diff2 != [] && @unblo == 0
131
+ telegram_messanger.telegram_message("Domains for unblocking: " + diff2.to_s)
132
+ @unblo = 1
133
+ end
134
+
135
+
136
+ if diff == [] && diff2 == []
137
+ "compared"
138
+ else
139
+ "mismatch"
140
+ end
141
+
142
+ end
143
+
144
+
145
+ def dns_processe
146
+ a = "cruel world"
147
+ f = a.scan(/\w+/)
148
+
149
+ starttime = DateTime.now
150
+
151
+
152
+ comm = `curl -d "name=#{belgim_login}&pass=#{belgim_password}" -H "Content-Type: application/x-www-form-urlencoded" -X POST #{belgim_url}`
153
+
154
+ comm = comm.gsub!("\n","")
155
+
156
+ #p comm
157
+
158
+ #comm = comm.gsub!("\r","")
159
+
160
+ #p comm
161
+
162
+ redns = /<dns>(.{1,100})dns>/
163
+ rednsurl = /<url>(.{1,100})url>/
164
+
165
+ m1 = comm.scan(redns)
166
+ m2 = []
167
+
168
+ f1 = comm.scan(rednsurl)
169
+ f2 =[]
170
+
171
+ results = {}
172
+
173
+ for i in m1
174
+ a1 = i[0]
175
+ elem = a1.gsub!("</","")
176
+
177
+ if elem.include? " "
178
+ elem = elem.gsub!(" ", "")
179
+ end
180
+
181
+
182
+ if elem.match(/а|б|в|г|д|е|ж|ё|Ё|з|и|й|к|л|м|н|о|п|р|с|т|у|ф|х|ц|ч|ш|щ|ь|ы|ъ|э|ю|я|А|Б|В|Г|Д|Е|Ж|З|И|Й|К|Л|М|Н|О|П|Р|С|Т|У|Ф|Х|Ц|Ч|Ш|Щ|Ь|Ы|Ъ|Э|Ю|Я/)
183
+ elem = SimpleIDN.to_ascii(elem)
184
+ end
185
+
186
+ p elem
187
+
188
+ if elem != "-"
189
+
190
+ m2.push(elem)
191
+
192
+ daaa = elem[0]+elem[1]+elem[2]+elem[3]
193
+
194
+ if daaa != "www."
195
+ m2.push("www."+elem)
196
+ end
197
+
198
+ if daaa == "www."
199
+ gar = elem[4..elem.length]
200
+ m2.push(gar)
201
+ end
202
+
203
+ end
204
+
205
+
206
+ end
207
+
208
+ p m2
209
+
210
+
211
+ for s in f1
212
+ a1 = s[0]
213
+
214
+
215
+ elem1 = a1.gsub!("</","")
216
+ elem2 =""
217
+
218
+ if elem1.include? "http://"
219
+ elem1.gsub!("http://", "")
220
+ end
221
+
222
+ if elem1.include? "http:/"
223
+ elem1.gsub!("http:/", "")
224
+ end
225
+
226
+
227
+ if elem1.include? "https://"
228
+ elem1.gsub!("https://", "")
229
+ if elem1.include?("/")
230
+ elem1=elem1.split("/")[0]
231
+ end
232
+ end
233
+
234
+ if elem1.include? " "
235
+ elem1 = elem1.gsub!(" ", "")
236
+ end
237
+
238
+ #p elem1
239
+
240
+ if elem1[elem1.size-1]=="/"
241
+ sss = elem1.size
242
+ elem1 = elem1[0..sss-2]
243
+ end
244
+
245
+ if !elem1.include? "/"
246
+ if elem1.match(/а|б|в|г|д|е|ж|ё|Ё|з|и|й|к|л|м|н|о|п|р|с|т|у|ф|х|ц|ч|ш|щ|ь|ы|ъ|э|ю|я|А|Б|В|Г|Д|Е|Ж|З|И|Й|К|Л|М|Н|О|П|Р|С|Т|У|Ф|Х|Ц|Ч|Ш|Щ|Ь|Ы|Ъ|Э|Ю|Я/)
247
+ elem1 = SimpleIDN.to_ascii(elem1)
248
+ end
249
+
250
+ if elem1 != "-" && elem1 != ""
251
+ m2.push(elem1)
252
+
253
+ p elem1
254
+
255
+
256
+ daaa2 = elem1[0]+elem1[1]+elem1[2]+elem1[3]
257
+
258
+ p daaa2
259
+
260
+
261
+
262
+
263
+ if daaa2 != "www."
264
+ m2.push("www."+elem1)
265
+ end
266
+
267
+ if daaa2 == "www."
268
+ gar1 = elem1[4..elem1.length]
269
+ m2.push(gar1)
270
+ end
271
+
272
+ end
273
+ end
274
+
275
+ end
276
+
277
+ m2 = m2.uniq
278
+
279
+
280
+
281
+ stringnunblo = File.open('/scripts/ruby/dns/nonblocked.conf', 'r'){ |file| file.read }
282
+
283
+ noblocked = stringnunblo.split("\n")
284
+
285
+ m2 = m2 - noblocked
286
+
287
+
288
+ stringnunblo2 = File.open('/scripts/ruby/dns/manualblocked.conf', 'r'){ |file| file.read }
289
+ manualblocked = stringnunblo2.split("\n")
290
+
291
+ m2 = m2 + manualblocked
292
+ m2 = m2.uniq
293
+
294
+ numblocked = m2.length
295
+ manualblockedlen = manualblocked.length
296
+ numblwithoutexcluded = m2.length
297
+ numnoblocked = noblocked.length
298
+
299
+
300
+ results.update({"numblocked" => numblocked, "numblwithoutexcluded"=>numblwithoutexcluded, "numnoblocked"=>numnoblocked, "manualblocked"=>manualblockedlen})
301
+
302
+ File.delete("blocked.conf") if File.exist?("blocked.conf")
303
+ File.delete("blocked_old.conf") if File.exist?("blocked_old.conf")
304
+
305
+ file = File.open("blocked.conf", "w")
306
+ for j in m2
307
+ a1 = 'local-zone: "' + j + '." redirect'
308
+ a2 = "local-data: \"" + j + ". IN A \"#{ip_for_redirect}\""
309
+ #print a1
310
+ file.puts(a1)
311
+ file.puts(a2)
312
+ end
313
+ file.close
314
+
315
+ dnses = [
316
+ "172.30.159.67",
317
+ "172.30.159.68",
318
+ "172.30.161.145",
319
+ "172.30.161.146",
320
+ "172.29.253.33",
321
+ "172.29.253.34",
322
+ "172.28.240.33",
323
+ "172.28.240.34",
324
+ "172.27.234.33",
325
+ "172.27.234.34",
326
+ "172.26.253.33",
327
+ "172.26.253.34",
328
+ "172.25.225.51",
329
+ "172.25.225.52",
330
+ "172.24.214.130",
331
+ "172.24.247.155",
332
+ "172.24.247.157"
333
+ ]
334
+
335
+ dnsnamess = {
336
+ "172.30.159.67" => "min26dns1",
337
+ "172.30.159.68" => "min26dns2",
338
+ "172.30.161.145" => "min26dns3",
339
+ "172.30.161.146" => "min26dns4",
340
+ "172.29.253.33" => "gro26dns1",
341
+ "172.29.253.34" => "gro26dns2",
342
+ "172.28.240.33" => "bre26dns1",
343
+ "172.28.240.34" => "bre26dns2",
344
+ "172.27.234.33" => "gom26dns1",
345
+ "172.27.234.34" => "gom26dns2",
346
+ "172.26.253.33" => "mog26dns1",
347
+ "172.26.253.34" => "mog26dns2",
348
+ "172.25.225.51" => "vit26dns1",
349
+ "172.25.225.52" => "vit26dns2",
350
+ "172.24.214.130" => "minsrv1",
351
+ "172.24.247.155" => "minsrv2",
352
+ "172.24.247.157" => "minsrv3"
353
+ }
354
+
355
+
356
+
357
+ for fa in dnses
358
+
359
+ Net::SCP.download!(fa, dns_login,
360
+ "/usr/local/etc/unbound/blocked.conf", "blocked_old.conf",
361
+ :ssh => { :password => dns_password })
362
+
363
+ ressss = gen_mem_script
364
+
365
+ if ressss == "mismatch"
366
+ Net::SCP.upload!(fa, dns_login,
367
+ "blocked.conf", "/usr/local/etc/unbound/blocked.conf",
368
+ :ssh => { :password => dns_password })
369
+
370
+ results.update({dnsnamess[fa] => "updated"})
371
+
372
+ Net::SCP.upload!(fa, dns_login,
373
+ "add_bl_memory.sh", "/tmp/add_bl_memory.sh",
374
+ :ssh => { :password => dns_password })
375
+
376
+ Net::SCP.upload!(fa, dns_login,
377
+ "del_bl_memory.sh", "/tmp/del_bl_memory.sh",
378
+ :ssh => { :password => dns_password })
379
+
380
+ Net::SSH.start(fa, dns_login, :password => dns_password) do |ssh|
381
+ sleep 4
382
+ result = ssh.exec!("sh /tmp/add_bl_memory.sh")
383
+ result2 = ssh.exec!("sh /tmp/del_bl_memory.sh")
384
+ #puts resul
385
+ #results.update({fa+"_stat" => result+"_"+result2})
386
+ end
387
+
388
+ else
389
+ results.update({dnsnamess[fa] => "compared"})
390
+ end
391
+
392
+ end
393
+
394
+ p results
395
+ p m2
396
+
397
+ endtime =DateTime.now
398
+
399
+ results.update({"scriptstart"=>starttime.to_s, "scriptend"=>endtime.to_s})
400
+
401
+ telegram_messanger.telegram_message(results.to_s)
402
+
403
+
404
+ #File.delete("blocked.conf") if File.exist?("blocked.conf")
405
+ #File.delete("blocked_old.conf") if File.exist?("blocked_old.conf")
406
+ #File.delete("add_bl_memory.sh") if File.exist?("add_bl_memory.sh")
407
+
408
+ end
409
+
410
+
411
+ end
412
+
413
+
414
+
415
+
@@ -975,7 +975,7 @@ class IotFunctions_2
975
975
  end
976
976
 
977
977
 
978
- def test()
978
+ def test
979
979
  #ddd = MongoIot.new(mongoip, mongoport, mongo_database)
980
980
  #ddd.get_profiles_by_login("test")
981
981
 
@@ -984,10 +984,9 @@ class IotFunctions_2
984
984
 
985
985
  #p ddd.get_profile_id_by_name("1341241")
986
986
  #p ddd.get_device_type_info_by_model("BGT_PPMC11")
987
+ p "yyyyy"
987
988
 
988
989
  #fff = HuaIot.new("134.17.93.4", "443", "/Users/imperituroard/Desktop/cert.crt", "/Users/imperituroard/Desktop/key.pem")
989
- p hua_aceanconnect_connector.querying_device_id("Cd1v0k2gTBCbpQlMVlW1FVqOSqga", "eWllZpHgXgvgDAQlJjWs4QXaR94a", "91234")
990
+ p hua_aceanconnect_connector.querying_device_id("Jy5KpoBUOScZEcrO2bRZhzfaIOUa", "VFFWTOb9k3_cQhzrGsRWT4HE8Z0a", "123456789876543")
990
991
  end
991
-
992
-
993
- end
992
+ end
@@ -5,32 +5,14 @@ require 'json'
5
5
 
6
6
  class AdditionalFunc
7
7
 
8
- attr_accessor :telegram_api_url, :telegram_chat_id
8
+ attr_accessor :telegram_api_url, :telegram_chat_id, :telegram_messanger
9
9
 
10
10
  def initialize(telegram_api_url, telegram_chat_id)
11
11
  @telegram_api_url = telegram_api_url
12
12
  @telegram_chat_id = telegram_chat_id
13
+ @telegram_messanger = Telegram_2.new(telegram_api_url, telegram_chat_id)
13
14
  end
14
15
 
15
- #procedure for send log to telegram chat
16
- def telegram_message(message)
17
- begin
18
- uri = URI.parse(telegram_api_url)
19
- https_connector = Net::HTTP.new(uri.host, uri.port)
20
- https_connector.use_ssl = true
21
- data = {chat_id: telegram_chat_id, text: message}
22
- request_mess = Net::HTTP::Post.new(uri.request_uri, {'Content-Type' => 'application/json'})
23
- request_mess.body = data.to_json
24
- response_mess = https_connector.request(request_mess)
25
- body = response_mess.body
26
- return {:code => 200,
27
- :result => "Request completed successfully",
28
- :body => {:telegram_resp => JSON.parse(body.to_s),
29
- :description => "Telegram message to telegram_chat_id: #{telegram_chat_id.to_s}"}}
30
- rescue
31
- return {:code => 507, :result => "Unknown SDK error"}
32
- end
33
- end
34
16
 
35
17
  def answ_dev_query_format_process(dev_list)
36
18
  dataaa_ok = []
@@ -233,7 +233,7 @@ class HuaIot
233
233
  def querying_device_id(app_id, secret, node_id)
234
234
  token = get_token(app_id, secret)[:body]["accessToken"]
235
235
  p token
236
- path = "/iocm/app/dm/v1.1.0/queryDeviceIdByNodeId?nodeId=" + node_id + "&appId=Cd1v0k2gTBCbpQlMVlW1FVqOSqga"
236
+ path = "/iocm/app/dm/v1.1.0/queryDeviceIdByNodeId?nodeId=" + node_id + "&appId=Jy5KpoBUOScZEcrO2bRZhzfaIOUa"
237
237
  p path
238
238
  p path
239
239
  url_string = "https://" + platformip + ":" + platformport + path
@@ -22,19 +22,20 @@ class MhubFunctions_2
22
22
  :internal_func,
23
23
  :dabrab_connecter,
24
24
  :static_callback,
25
- :crm_connector
25
+ :crm_connector,
26
+ :telegram_connector
26
27
 
27
28
  def initialize(sk_url_simple, sk_login, sk_password, telegram_api_url, telegram_chat_id, sk_url_broadcast, static_callback, crm_callback_url, crm_login, crm_password)
28
29
  @sk_url = sk_url_simple
29
30
  @sk_login = sk_login
30
31
  @sk_password = sk_password
31
32
  @internal_func = InternalFunc.new
32
- @mhub_connector = Sksk_1.new(sk_url_simple, sk_login, sk_password, sk_url_broadcast)
33
+ @mhub_connector = Sksk_2.new(sk_url_simple, sk_login, sk_password, sk_url_broadcast, telegram_api_url, telegram_chat_id)
33
34
  @internal_func = InternalFunc.new
34
35
  @dabrab_connecter = Dabrab.new
35
- @add_functions_connector = AdditionalFunc.new(telegram_api_url, telegram_chat_id)
36
+ @telegram_connector = Telegram_2.new(telegram_api_url, telegram_chat_id)
36
37
  @static_callback = static_callback
37
- @crm_connector = Crm_1.new(crm_callback_url, crm_login, crm_password)
38
+ @crm_connector = Crm_2.new(crm_callback_url, crm_login, crm_password, telegram_api_url, telegram_chat_id)
38
39
  end
39
40
 
40
41
 
@@ -110,7 +111,8 @@ class MhubFunctions_2
110
111
  output_params = {"code": 200, "result": "Data processed", "body": {"answer": mes_data[:body][:mess_to_recip], "sender": {"ip_src": ip_src, "ip_real": ip_real, "ip_vip": ip_vip}}}
111
112
 
112
113
  rescue
113
- output_params = {"code": 500, "result": "Unknown SDK error", "body": {"answer": {}, "sender": {"ip_src": ip_src, "ip_real": ip_real, "ip_vip": ip_vip}}}
114
+ output_params = {"code": 500, "result": "MhubFunctions_2.get_send_message_2: Unknown SDK error", "body": {"answer": {}, "sender": {"ip_src": ip_src, "ip_real": ip_real, "ip_vip": ip_vip}}}
115
+ telegram_connector.telegram_message(output_params)
114
116
  end
115
117
 
116
118
  internal_func.printer_texter({:input => input_params, :output => output_params, :hub_resp => hub_resp, :procedure => "Mhub_2.get_send_message"}, "debug")
@@ -123,27 +125,17 @@ class MhubFunctions_2
123
125
  input_params = {:params => params, :ip_src => ip_src, :ip_real => ip_real, :ip_vip => ip_vip}
124
126
  output_params = {}
125
127
  hub_resp = {}
126
- null_statement = [nil, "nil", "", "null"]
127
128
 
128
129
  begin
129
-
130
130
  mes_report = dabrab_connecter.delivery_report_transform(params)[:body][:report_to_recip]
131
-
132
- p "mes_report"
133
- p mes_report
134
- p "mes_report"
135
-
136
131
  result = crm_connector.crm_status_1(mes_report)
137
-
138
132
  output_params = {"code": 200, "result": "Data processed", "body": {"answer": {"code": 200, "status": "Success"}, "sender": {"ip_src": ip_src, "ip_real": ip_real, "ip_vip": ip_vip}}}
139
-
140
133
  rescue
141
- output_params = {"code": 500, "result": "Unknown SDK error", "body": {"answer": {}, "sender": {"ip_src": ip_src, "ip_real": ip_real, "ip_vip": ip_vip}}}
134
+ output_params = {"code": 500, "result": "MhubFunctions_2.rec_deliv_report_2: Unknown SDK error", "body": {"answer": {}, "sender": {"ip_src": ip_src, "ip_real": ip_real, "ip_vip": ip_vip}}}
135
+ telegram_connector.telegram_message(output_params)
142
136
  end
143
-
144
137
  internal_func.printer_texter({:input => input_params, :output => output_params, :hub_resp => hub_resp, :procedure => "Mhub_2.recieve_delivery_report"}, "debug")
145
138
  output_params
146
-
147
139
  end
148
140
 
149
141
 
@@ -153,5 +145,4 @@ class MhubFunctions_2
153
145
  end
154
146
 
155
147
 
156
-
157
148
  end
@@ -1,15 +1,16 @@
1
1
  require 'imperituroard/projects/iot/internal_functions'
2
2
 
3
- class Sksk_1
3
+ class Sksk_2
4
4
 
5
- attr_accessor :sk_url, :sk_url_broadcast, :sk_login, :sk_password, :internal_func
5
+ attr_accessor :sk_url, :sk_url_broadcast, :sk_login, :sk_password, :internal_func, :telegram_connector
6
6
 
7
- def initialize(sk_url, sk_login, sk_password, sk_url_broadcast)
7
+ def initialize(sk_url, sk_login, sk_password, sk_url_broadcast, telegram_api_url, telegram_chat_id)
8
8
  @sk_url = sk_url
9
9
  @sk_login = sk_login
10
10
  @sk_password = sk_password
11
11
  @internal_func = InternalFunc.new
12
12
  @sk_url_broadcast = sk_url_broadcast
13
+ @telegram_connector = Telegram_2.new(telegram_api_url, telegram_chat_id)
13
14
  end
14
15
 
15
16
 
@@ -38,7 +39,7 @@ class Sksk_1
38
39
 
39
40
  request_message = {
40
41
  "phone_number": msisdn,
41
- "extra_id": "4232j4h89932kjhs",
42
+ #"extra_id": "4232j4h89932kjhs",
42
43
  "callback_url": callback_url,
43
44
  #"start_time": "2019-08-16 09:59:10",
44
45
  "tag": "Dabrab_custom_api_1",
@@ -57,7 +58,7 @@ class Sksk_1
57
58
  req.body = request_message.to_json
58
59
  res = https.request(req)
59
60
  output_params = {:code => 200,
60
- :result => "Sksk_1.sk_send_sms_one: Request processed",
61
+ :result => "Sksk_2.sk_send_sms_one: Request processed",
61
62
  :body => {:request_message => request_message,
62
63
  :res_code => res.code,
63
64
  :res_body => JSON.parse(res.body.to_s)}}
@@ -66,7 +67,8 @@ class Sksk_1
66
67
  thr_sk_send_sms_one.join
67
68
 
68
69
  rescue
69
- output_params = {:code => 500, :result => "Sksk_1.sk_send_sms_one: Something wrong", :body => {:request_message => request_message}}
70
+ output_params = {:code => 500, :result => "Sksk_2.sk_send_sms_one: Something wrong", :body => {:request_message => request_message}}
71
+ telegram_connector.telegram_message(output_params)
70
72
  end
71
73
  internal_func.printer_texter({:input => input_params, :output => output_params, :procedure => "Sksk_1.sk_send_sms_one"}, "debug")
72
74
  output_params
@@ -99,7 +101,7 @@ class Sksk_1
99
101
 
100
102
  request_message = {
101
103
  "phone_number": msisdn,
102
- "extra_id": "4232j4h89932kjhs",
104
+ #"extra_id": "4232j4h89932kjhs",
103
105
  "callback_url": callback_url,
104
106
  #"start_time": "2019-08-16 09:59:10",
105
107
  "tag": "Dabrab_custom_api_1",
@@ -119,7 +121,7 @@ class Sksk_1
119
121
  req.body = request_message.to_json
120
122
  res = https.request(req)
121
123
  output_params = {:code => 200,
122
- :result => "Sksk_1.sk_send_viber_one: Request processed",
124
+ :result => "Sksk_2.sk_send_viber_one: Request processed",
123
125
  :body => {:request_message => request_message,
124
126
  :res_code => res.code,
125
127
  :res_body => JSON.parse(res.body.to_s)}}
@@ -130,9 +132,10 @@ class Sksk_1
130
132
 
131
133
 
132
134
  rescue
133
- output_params = {:code => 500, :result => "Sksk_1.sk_send_viber_one: Something wrong"}
135
+ output_params = {:code => 500, :result => "Sksk_2.sk_send_viber_one: Something wrong"}
136
+ telegram_connector.telegram_message(output_params)
134
137
  end
135
- internal_func.printer_texter({:input => input_params, :output => output_params, :procedure => "Sksk_1.sk_send_viber_one"}, "debug")
138
+ internal_func.printer_texter({:input => input_params, :output => output_params, :procedure => "Sksk_2.sk_send_viber_one"}, "debug")
136
139
  output_params
137
140
  end
138
141
 
@@ -161,7 +164,7 @@ class Sksk_1
161
164
 
162
165
  request_message = {
163
166
  "phone_number": msisdn,
164
- "extra_id": "4232j4h89932kjhs",
167
+ #"extra_id": "4232j4h89932kjhs",
165
168
  "callback_url": callback_url,
166
169
  #"start_time": "2019-08-16 09:59:10",
167
170
  "tag": "Dabrab_custom_api_1",
@@ -189,7 +192,7 @@ class Sksk_1
189
192
  res = https.request(req)
190
193
 
191
194
  output_params = {:code => 200,
192
- :result => "Sksk_1.sk_send_viber_sms_one: Request processed",
195
+ :result => "Sksk_2.sk_send_viber_sms_one: Request processed",
193
196
  :body => {:request_message => request_message,
194
197
  :res_code => res.code,
195
198
  :res_body => JSON.parse(res.body.to_s)}}
@@ -199,9 +202,10 @@ class Sksk_1
199
202
  thr_sk_send_viber_sms_one.join
200
203
 
201
204
  rescue
202
- output_params = {:code => 500, :result => "Sksk_1.sk_send_viber_sms_one: Something wrong"}
205
+ output_params = {:code => 500, :result => "Sksk_2.sk_send_viber_sms_one: Something wrong"}
206
+ telegram_connector.telegram_message(output_params)
203
207
  end
204
- internal_func.printer_texter({:input => input_params, :output => output_params, :procedure => "Sksk_1.sk_send_viber_sms_one"}, "debug")
208
+ internal_func.printer_texter({:input => input_params, :output => output_params, :procedure => "Sksk_2.sk_send_viber_sms_one"}, "debug")
205
209
  output_params
206
210
 
207
211
  end
@@ -251,7 +255,7 @@ class Sksk_1
251
255
  res = https.request(req)
252
256
 
253
257
  output_params = {:code => 200,
254
- :result => "Sksk_1.sk_send_sms_list: Request processed",
258
+ :result => "Sksk_2.sk_send_sms_list: Request processed",
255
259
  :body => {:request_message => request_message,
256
260
  :res_code => res.code,
257
261
  :res_body => JSON.parse(res.body.to_s)}}
@@ -260,9 +264,10 @@ class Sksk_1
260
264
  thr_sk_send_sms_list.join
261
265
 
262
266
  rescue
263
- output_params = {:code => 500, :result => "Sksk_1.sk_send_sms_list: Something wrong"}
267
+ output_params = {:code => 500, :result => "Sksk_2.sk_send_sms_list: Something wrong"}
268
+ telegram_connector.telegram_message(output_params)
264
269
  end
265
- internal_func.printer_texter({:input => input_params, :output => output_params, :procedure => "Sksk_1.sk_send_sms_list"}, "debug")
270
+ internal_func.printer_texter({:input => input_params, :output => output_params, :procedure => "Sksk_2.sk_send_sms_list"}, "debug")
266
271
  output_params
267
272
  end
268
273
 
@@ -310,16 +315,17 @@ class Sksk_1
310
315
  res = https.request(req)
311
316
 
312
317
  output_params = {:code => 200,
313
- :result => "Sksk_1.sk_send_viber_list: Request processed",
318
+ :result => "Sksk_2.sk_send_viber_list: Request processed",
314
319
  :body => {:request_message => request_message,
315
320
  :res_code => res.code,
316
321
  :res_body => JSON.parse(res.body.to_s)}}
317
322
  end
318
323
  thr_sk_send_viber_list.join
319
324
  rescue
320
- output_params = {:code => 500, :result => "Sksk_1.sk_send_viber_list: Something wrong"}
325
+ output_params = {:code => 500, :result => "Sksk_2.sk_send_viber_list: Something wrong"}
326
+ telegram_connector.telegram_message(output_params)
321
327
  end
322
- internal_func.printer_texter({:input => input_params, :output => output_params, :procedure => "Sksk_1.sk_send_viber_list"}, "debug")
328
+ internal_func.printer_texter({:input => input_params, :output => output_params, :procedure => "Sksk_2.sk_send_viber_list"}, "debug")
323
329
  output_params
324
330
  end
325
331
 
@@ -371,7 +377,7 @@ class Sksk_1
371
377
  res = https.request(req)
372
378
 
373
379
  output_params = {:code => 200,
374
- :result => "Sksk_1.sk_send_viber_sms_list: Request processed",
380
+ :result => "Sksk_2.sk_send_viber_sms_list: Request processed",
375
381
  :body => {:request_message => request_message,
376
382
  :res_code => res.code,
377
383
  :res_body => JSON.parse(res.body.to_s)}}
@@ -380,9 +386,10 @@ class Sksk_1
380
386
  thr_sk_send_viber_sms_list.join
381
387
 
382
388
  rescue
383
- output_params = {:code => 500, :result => "Sksk_1.sk_send_viber_sms_list: Something wrong"}
389
+ output_params = {:code => 500, :result => "Sksk_2.sk_send_viber_sms_list: Something wrong"}
390
+ telegram_connector.telegram_message(output_params)
384
391
  end
385
- internal_func.printer_texter({:input => input_params, :output => output_params, :procedure => "Sksk_1.sk_send_viber_sms_list"}, "debug")
392
+ internal_func.printer_texter({:input => input_params, :output => output_params, :procedure => "Sksk_2.sk_send_viber_sms_list"}, "debug")
386
393
  output_params
387
394
  end
388
395
 
@@ -1,18 +1,19 @@
1
1
  require 'imperituroard/projects/iot/internal_functions'
2
2
 
3
3
 
4
- class Crm_1
4
+ class Crm_2
5
5
 
6
- attr_accessor :crm_callback_url, :crm_login, :crm_password, :internal_func
6
+ attr_accessor :crm_callback_url, :crm_login, :crm_password, :internal_func, :telegram_connector
7
7
 
8
- def initialize(crm_callback_url, crm_login, crm_password)
8
+ def initialize(crm_callback_url, crm_login, crm_password, telegram_api_url, telegram_chat_id)
9
9
  @crm_callback_url = crm_callback_url
10
10
  @crm_login = crm_login
11
11
  @crm_password = crm_password
12
12
  @internal_func = InternalFunc.new
13
+ @telegram_connector = Telegram_2.new(telegram_api_url, telegram_chat_id)
13
14
  end
14
15
 
15
- def crm_status_1(crm_payload)
16
+ def crm_status_2(crm_payload)
16
17
 
17
18
  input_params = {:crm_payload => crm_payload}
18
19
  output_params = {}
@@ -20,7 +21,7 @@ class Crm_1
20
21
 
21
22
  begin
22
23
 
23
- thr_crm_status_1 = Thread.new do
24
+ thr_crm_status_2 = Thread.new do
24
25
  uri = URI(crm_callback_url)
25
26
  #8 - client id
26
27
 
@@ -37,18 +38,19 @@ class Crm_1
37
38
  req.body = crm_payload.to_json
38
39
  res = https.request(req)
39
40
  output_params = {:code => 200,
40
- :result => "Crm_1.crm_status_1: Request processed",
41
+ :result => "Crm_2.crm_status_2: Request processed",
41
42
  :body => {:request_message => crm_payload,
42
43
  :res_code => res.code,
43
44
  :res_body => JSON.parse(res.body.to_s)}}
44
45
  p res.body
45
46
  end
46
- thr_crm_status_1.join
47
+ thr_crm_status_2.join
47
48
 
48
49
  rescue
49
- output_params = {:code => 500, :result => "Crm_1.crm_status_1: Something wrong", :body => {:request_message => request_message}}
50
+ output_params = {:code => 500, :result => "Crm_2.crm_status_2: Something wrong", :body => {:request_message => request_message}}
51
+ telegram_connector.telegram_message(output_params)
50
52
  end
51
- internal_func.printer_texter({:input => input_params, :output => output_params, :procedure => "Crm_1.crm_status_1"}, "debug")
53
+ internal_func.printer_texter({:input => input_params, :output => output_params, :procedure => "Crm_2.crm_status_2"}, "debug")
52
54
  output_params
53
55
 
54
56
  end
@@ -1,27 +1,26 @@
1
-
2
-
3
-
4
1
  class Dabrab
5
2
 
6
- def num_formatter(infobip_msisdn, extra_id)
7
- #[{"to"=>{"phoneNumber"=>"375297116638", "emailAddress"=>nil}}]
8
- # [{"phone_number": 375298766719}, {"phone_number": 375295730878}]
3
+ def num_formatter(infobip_msisdn, extra_id)
4
+ #[{"to"=>{"phoneNumber"=>"375297116638", "emailAddress"=>nil}}]
5
+ # [{"phone_number": 375298766719}, {"phone_number": 375295730878}]
9
6
 
10
- converted_msisdn_list = []
7
+ converted_msisdn_list = []
8
+
9
+ for g in infobip_msisdn
10
+ begin
11
+ converted_msisdn_list.append({
12
+ "phone_number": g["to"]["phoneNumber"].to_i
13
+ #"extra_id": extra_id
14
+ })
15
+ rescue
16
+ p "failed: #{g.to_s}"
17
+ end
11
18
 
12
- for g in infobip_msisdn
13
- begin
14
- converted_msisdn_list.append({"phone_number": g["to"]["phoneNumber"].to_i, "extra_id": extra_id})
15
- rescue
16
- p "failed: #{g.to_s}"
17
19
  end
20
+ p converted_msisdn_list
21
+ converted_msisdn_list
18
22
 
19
23
  end
20
- p converted_msisdn_list
21
-
22
- converted_msisdn_list
23
-
24
- end
25
24
 
26
25
 
27
26
  def send_responce_formatter(hub_answer)
@@ -45,18 +44,29 @@ end
45
44
  }
46
45
 
47
46
  p "send_responce_formatter(hub_answer)"
48
-
49
47
  p hub_answer
50
48
 
51
49
  for a in hub_answer[:body][:res_body]["messages"]
52
- s1 = {"to": {"phoneNumber": a["phone_number"]}, "status": {"groupId": 1,
53
- "groupName": "PENDING",
54
- "id": 26,
55
- "name": "MESSAGE_ACCEPTED",
56
- "description": "Message sent to next instance"},
57
- "messageId": a["message_id"]}
58
-
59
- messages_sect.append(s1)
50
+ status1 = {}
51
+ if a["processed"] == true && a["accepted"] == true
52
+ status1 = {"to": {"phoneNumber": a["phone_number"]},
53
+ "status": {"groupId": 1,
54
+ "groupName": "PENDING",
55
+ "id": 26,
56
+ "name": "MESSAGE_ACCEPTED",
57
+ "description": "Message sent to next instance"},
58
+ "messageId": a["message_id"]}
59
+ else
60
+ status1 = {"to": {"phoneNumber": a["phone_number"]},
61
+ "status": {"groupId": 5,
62
+ "groupName": "REJECTED",
63
+ "id": 21,
64
+ "name": "REJECTED_SYSTEM_ERROR",
65
+ "description": "Unknown error"},
66
+ "messageId": a["message_id"]}
67
+ end
68
+
69
+ messages_sect.append(status1)
60
70
  end
61
71
 
62
72
  p messages_sect
@@ -66,21 +76,32 @@ end
66
76
  end
67
77
 
68
78
 
69
-
70
79
  def delivery_report_transform(hub_report)
71
80
  #{"number"=>"375297116638", "time"=>1588673492000, "status"=>2, "substatus"=>23, "msg_status"=>23033, "message_id"=>"486649ba-a573-4ee9-8f58-018ed20ca6fd", "extra_id"=>"444/0/ServiceModel/ScGetReports.svc/GetReports", "sent_via"=>"viber", "controller"=>"reports", "action"=>"delivery", "report"=>{"number"=>"375297116638", "time"=>1588673492000, "status"=>2, "substatus"=>23, "msg_status"=>23033, "message_id"=>"486649ba-a573-4ee9-8f58-018ed20ca6fd", "extra_id"=>"444/0/ServiceModel/ScGetReports.svc/GetReports", "sent_via"=>"viber"}}
72
-
73
81
  p hub_report
74
82
  p "hub_report"
75
-
76
83
  data_for_status = {
77
-
78
84
  23011 => {:status_id => 5, :status_grid => 3, :status_grname => "DELIVERED", :status_name => "DELIVERED_TO_HANDSET", :status_descr => "Message delivered by SMS",
79
- :error_id => 0, :error_grid => 0, :error_grname => "Ok", :error_name=> "NO_ERROR", :error_descr => "No Error", :error_permanent => false
85
+ :error_id => 0, :error_grid => 0, :error_grname => "Ok", :error_name => "NO_ERROR", :error_descr => "No Error", :error_permanent => false
80
86
  },
81
87
  23033 => {:status_id => 5, :status_grid => 3, :status_grname => "DELIVERED", :status_name => "DELIVERED_TO_HANDSET", :status_descr => "Message delivered by Viber",
82
- :error_id => 0, :error_grid => 0, :error_grname => "Ok", :error_name=> "NO_ERROR", :error_descr => "No Error", :error_permanent => false
83
- }
88
+ :error_id => 0, :error_grid => 0, :error_grname => "Ok", :error_name => "NO_ERROR", :error_descr => "No Error", :error_permanent => false
89
+ },
90
+ 35015 => {:status_id => 15, :status_grid => 4, :status_grname => "EXPIRED", :status_name => "EXPIRED_EXPIRED", :status_descr => "SMS Message TTL EXPIRED",
91
+ :error_id => 6, :error_grid => 1, :error_grname => "HANDSET_ERRORS", :error_name => "EC_ABSENT_SUBSCRIBER_SM", :error_descr => "Subscriber is absent", :error_permanent => false
92
+ }, #message SMS expired
93
+ 36463 => {:status_id => 15, :status_grid => 4, :status_grname => "EXPIRED", :status_name => "EXPIRED_EXPIRED", :status_descr => "Viber Message TTL EXPIRED",
94
+ :error_id => 6, :error_grid => 1, :error_grname => "HANDSET_ERRORS", :error_name => "EC_ABSENT_SUBSCRIBER_SM", :error_descr => "Subscriber is absent.", :error_permanent => false
95
+ }, #message Viber expired
96
+ 36010 => {:status_id => 4, :status_grid => 2, :status_grname => "UNDELIVERABLE", :status_name => "UNDELIVERABLE_REJECTED_OPERATOR", :status_descr => "SMS. Subscriber not exists",
97
+ :error_id => 6, :error_grid => 1, :error_grname => "HANDSET_ERRORS", :error_name => "EC_UNKNOWN_SUBSCRIBER", :error_descr => "Subscriber not found.", :error_permanent => true
98
+ }, #SMS subscriber not exists
99
+ 36131 => {:status_id => 4, :status_grid => 2, :status_grname => "UNDELIVERABLE", :status_name => "UNDELIVERABLE_REJECTED_OPERATOR", :status_descr => "SMS. Unknown subscriber",
100
+ :error_id => 6, :error_grid => 1, :error_grname => "HANDSET_ERRORS", :error_name => "EC_UNKNOWN_SUBSCRIBER", :error_descr => "Subscriber not found.", :error_permanent => true
101
+ }, #SMS unknown subscriber
102
+ 36505 => {:status_id => 4, :status_grid => 2, :status_grname => "UNDELIVERABLE", :status_name => "UNDELIVERABLE_REJECTED_OPERATOR", :status_descr => "Viber. Subscriber not exists",
103
+ :error_id => 6, :error_grid => 1, :error_grname => "HANDSET_ERRORS", :error_name => "EC_UNKNOWN_SUBSCRIBER", :error_descr => "Subscriber not found.", :error_permanent => true
104
+ } #Viber subscriber not exists
84
105
  }
85
106
 
86
107
  if data_for_status[hub_report[:msg_status]] != nil && data_for_status[hub_report[:msg_status]] != {} && data_for_status[hub_report[:msg_status]] != [] && data_for_status[hub_report[:msg_status]] != ""
@@ -142,10 +163,6 @@ end
142
163
  ]
143
164
  }
144
165
  end
145
-
146
-
147
-
148
-
149
166
  {:code => 200, :result => "Data processed", :body => {:report_to_recip => report_to_recip}}
150
167
  end
151
168
 
@@ -1,3 +1,3 @@
1
1
  module Imperituroard
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
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: 0.5.0
4
+ version: 0.5.1
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-05-12 00:00:00.000000000 Z
11
+ date: 2020-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -136,6 +136,34 @@ dependencies:
136
136
  - - '='
137
137
  - !ruby/object:Gem::Version
138
138
  version: 1.2.2
139
+ - !ruby/object:Gem::Dependency
140
+ name: simpleidn
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - '='
144
+ - !ruby/object:Gem::Version
145
+ version: 0.1.1
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - '='
151
+ - !ruby/object:Gem::Version
152
+ version: 0.1.1
153
+ - !ruby/object:Gem::Dependency
154
+ name: net-scp
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - '='
158
+ - !ruby/object:Gem::Version
159
+ version: 3.0.0
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - '='
165
+ - !ruby/object:Gem::Version
166
+ version: 3.0.0
139
167
  description: Gem from imperituroard for different actions
140
168
  email:
141
169
  - imperituro.ard@gmail.com
@@ -161,6 +189,9 @@ files:
161
189
  - lib/imperituroard/.DS_Store
162
190
  - lib/imperituroard/platforms/cps/qps_connector.rb
163
191
  - lib/imperituroard/platforms/cps/request_formatter.rb
192
+ - lib/imperituroard/platforms/public/telegram.rb
193
+ - lib/imperituroard/projects/dns.rb
194
+ - lib/imperituroard/projects/dns/ukaz60/dns_update.rb
164
195
  - lib/imperituroard/projects/iot.rb
165
196
  - lib/imperituroard/projects/iot/add_functions.rb
166
197
  - lib/imperituroard/projects/iot/hua_oceanconnect_adapter.rb