imperituroard 1.1.9 → 1.1.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/.DS_Store +0 -0
- data/lib/imperituroard.rb +11 -5
- data/lib/imperituroard/.DS_Store +0 -0
- data/lib/imperituroard/add_functions/logger/any_functions.rb +4 -2
- data/lib/imperituroard/platforms/iwag/get_iwag_data.rb +90 -0
- data/lib/imperituroard/platforms/iwag/iwag_database_worker.rb +24 -0
- data/lib/imperituroard/projects/iot/internal_functions.rb +5 -4
- data/lib/imperituroard/projects/mhub.rb +74 -7
- data/lib/imperituroard/projects/mhub/sk.rb +10 -15
- data/lib/imperituroard/projects/mhub/subs/dabrab/dabrab_platform.rb +5 -4
- data/lib/imperituroard/projects/mhub/subs/dabrab/dabrab_proced.rb +23 -21
- data/lib/imperituroard/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06a24d95016bbc1c495cb86ef3f2cbebd39bfa21
|
4
|
+
data.tar.gz: 647278e86d5ec1f44cf808e8c3a63f7f1c4c7b64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74ae2cf7887f78b327956031bf5babab5ab78477b094b1f866ec6b43fd00796cf1a766cf21980507152434aafd9918917b3877f7adb62d15c7edee812c4deafa
|
7
|
+
data.tar.gz: 144a7e259528a7fa57a6f4f81a558e0604d1957cf294cf7479d8bfa35b896849bc216180180c6e418bc8672d031674d97d6f9c1ff729b2adbc1f37a98be66624
|
data/lib/.DS_Store
CHANGED
Binary file
|
data/lib/imperituroard.rb
CHANGED
@@ -311,19 +311,21 @@ class Mhub_2
|
|
311
311
|
:internal_func,
|
312
312
|
:dabrab_connecter,
|
313
313
|
:static_callback,
|
314
|
-
:crm_connector
|
314
|
+
:crm_connector,
|
315
|
+
:log_level
|
315
316
|
|
316
|
-
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, sms_alphaname)
|
317
|
+
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, sms_alphaname, log_level)
|
317
318
|
@sk_url = sk_url_simple
|
318
319
|
@sk_login = sk_login
|
319
320
|
@sk_password = sk_password
|
321
|
+
@log_level = log_level
|
320
322
|
@internal_func = InternalFunc.new
|
321
|
-
@mhub_connector = Sksk_2.new(sk_url_simple, sk_login, sk_password, sk_url_broadcast, telegram_api_url, telegram_chat_id)
|
323
|
+
@mhub_connector = Sksk_2.new(sk_url_simple, sk_login, sk_password, sk_url_broadcast, telegram_api_url, telegram_chat_id, log_level)
|
322
324
|
@internal_func = InternalFunc.new
|
323
325
|
@dabrab_connecter = Dabrab.new
|
324
326
|
@static_callback = static_callback
|
325
|
-
@crm_connector = Crm_2.new(crm_callback_url, crm_login, crm_password, telegram_api_url, telegram_chat_id)
|
326
|
-
@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, sms_alphaname)
|
327
|
+
@crm_connector = Crm_2.new(crm_callback_url, crm_login, crm_password, telegram_api_url, telegram_chat_id, log_level)
|
328
|
+
@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, sms_alphaname, log_level)
|
327
329
|
end
|
328
330
|
|
329
331
|
#{"destinations"=>[{"to"=>{"phoneNumber"=>"375297116638", "emailAddress"=>nil}}],
|
@@ -339,6 +341,10 @@ class Mhub_2
|
|
339
341
|
mhub_connector.get_send_message_2(params, ip_src, ip_real, ip_vip)
|
340
342
|
end
|
341
343
|
|
344
|
+
def get_send_message_mass(params, ip_src, ip_real, ip_vip)
|
345
|
+
mhub_connector.get_send_message_mass_2(params, ip_src, ip_real, ip_vip)
|
346
|
+
end
|
347
|
+
|
342
348
|
def recieve_delivery_report(params, ip_src, ip_real, ip_vip)
|
343
349
|
mhub_connector.rec_deliv_report_2(params, ip_src, ip_real, ip_vip)
|
344
350
|
end
|
data/lib/imperituroard/.DS_Store
CHANGED
Binary file
|
@@ -14,8 +14,10 @@ class LogAddFunctions_2
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def printer_texter(text, log_level)
|
17
|
-
|
18
|
-
|
17
|
+
if log_level == debug
|
18
|
+
mess = {:datetime => datetimenow, :sdk => "imperituroard", :sdk_version => Imperituroard::VERSION, :message => text}
|
19
|
+
p mess
|
20
|
+
end
|
19
21
|
end
|
20
22
|
|
21
23
|
|
@@ -0,0 +1,90 @@
|
|
1
|
+
require 'net/ssh'
|
2
|
+
|
3
|
+
class IwagRequester
|
4
|
+
|
5
|
+
attr_accessor :iwag_host, :iwag_login, :iwag_password
|
6
|
+
|
7
|
+
def initialize(iwag_host, iwag_login, iwag_password)
|
8
|
+
@iwag_host = iwag_host
|
9
|
+
@iwag_login = iwag_login
|
10
|
+
@iwag_password = iwag_password
|
11
|
+
end
|
12
|
+
|
13
|
+
def mac_parse(mac)
|
14
|
+
a = mac.upcase
|
15
|
+
pos = a[0] + a[1]
|
16
|
+
if pos == "01"
|
17
|
+
subscribers_mac = a[2] + a[3] + ":" + a[5] + a[6] + ":" + a[7] + a[8] + ":" + a[10] + a[11] + ":" + a[12] + a[13] + ":" + a[15] + a[16]
|
18
|
+
else
|
19
|
+
subscribers_mac = a[0] + a[1] + ":" + a[2] + a[3] + ":" + a[5] + a[6] + ":" + a[7] + a[8] + ":" + a[10] + a[11] + ":" + a[12] + a[13]
|
20
|
+
end
|
21
|
+
subscribers_mac
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
def iwag_get_dhcp_binding_ssh(bind_ip)
|
26
|
+
mac = "Unknown"
|
27
|
+
accessinterface = "Unknown"
|
28
|
+
hostname = "Unknown"
|
29
|
+
ssid = "Unknown"
|
30
|
+
iwag_thr = Thread.new do
|
31
|
+
Net::SSH.start(iwag_host, iwag_login, :password => iwag_password) do |session|
|
32
|
+
answ_bind = session.exec!("show ip dhcp binding #{bind_ip}")
|
33
|
+
regexp_main = /\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}\s{1,20}(\w{2,4}.\w{2,4}.\w{2,4}.\w{2,4})|\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}\s{1,20}(\w{4}.\w{4}.\w{4})/
|
34
|
+
#regexp_main = /\r\n(\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3})\s+(\S{13,18})\s+Sep 18 2020 07:44 PM\s+Automatic\s+Active\s+Tunnel201\r\n/
|
35
|
+
ggg7 = answ_bind.match(regexp_main)
|
36
|
+
begin
|
37
|
+
if ggg7[1] != nil
|
38
|
+
mac = mac_parse(ggg7[1])
|
39
|
+
else
|
40
|
+
mac = mac_parse(ggg7[2])
|
41
|
+
end
|
42
|
+
rescue
|
43
|
+
mac = "Unknown"
|
44
|
+
end
|
45
|
+
regexp_remote_id = /Remote id :\s(\S{2,100})/
|
46
|
+
regexp_tunnel = /Active\s{2,40}(\S{2,40})|Selecting\s{2,40}(\S{2,40})/
|
47
|
+
regexp_curcuit_id = /Circuit id :\s(\S{2,100})/
|
48
|
+
ggg9 = answ_bind.match(regexp_tunnel)
|
49
|
+
|
50
|
+
begin
|
51
|
+
if ggg9[1] != nil
|
52
|
+
accessinterface = ggg9[1]
|
53
|
+
else
|
54
|
+
accessinterface = ggg9[2]
|
55
|
+
end
|
56
|
+
rescue
|
57
|
+
accessinterface = "Unknown"
|
58
|
+
end
|
59
|
+
ggg8 = answ_bind.match(regexp_remote_id)
|
60
|
+
ggg10 = answ_bind.match(regexp_curcuit_id)
|
61
|
+
begin
|
62
|
+
a1 = ggg8[1].split(":")
|
63
|
+
hostname = a1[0]
|
64
|
+
ssid = a1[1]
|
65
|
+
rescue
|
66
|
+
begin
|
67
|
+
if ggg8[1] != nil
|
68
|
+
if ggg8[1].include?("wireless_public_interface")
|
69
|
+
hostname = ggg10[1]
|
70
|
+
ssid = "Unknown"
|
71
|
+
else
|
72
|
+
hostname = ggg8[1]
|
73
|
+
ssid = "Unknown"
|
74
|
+
end
|
75
|
+
else
|
76
|
+
ssid = "Unknown"
|
77
|
+
hostname = "Unknown"
|
78
|
+
end
|
79
|
+
rescue
|
80
|
+
ssid = "Unknown"
|
81
|
+
hostname = "Unknown"
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
iwag_thr.join
|
87
|
+
{"mac": mac, "iwaginterface": accessinterface, "aphostname": hostname, "SSID": ssid}
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
class IwagDbCache
|
4
|
+
|
5
|
+
attr_accessor :db_host, :db_login, :db_password
|
6
|
+
|
7
|
+
def initialize(db_host, db_login, db_password)
|
8
|
+
@db_host = db_host
|
9
|
+
@db_login = db_login
|
10
|
+
@db_password = db_password
|
11
|
+
end
|
12
|
+
|
13
|
+
def check_db_exists(ip)
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
def insert_new_cache()
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
|
23
|
+
end
|
24
|
+
|
@@ -21,8 +21,10 @@ class InternalFunc
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def printer_texter(text, log_level)
|
24
|
-
|
25
|
-
|
24
|
+
if log_level == "debug"
|
25
|
+
mess = {:datetime => datetimenow, :sdk => "imperituroard", :sdk_version => Imperituroard::VERSION, :message => text}
|
26
|
+
p mess
|
27
|
+
end
|
26
28
|
end
|
27
29
|
|
28
30
|
def prof_id_list_transform_mongo(id_list)
|
@@ -176,7 +178,7 @@ class InternalFunc
|
|
176
178
|
end
|
177
179
|
end
|
178
180
|
out_data = res
|
179
|
-
printer_texter({:out_data => out_data, :inp_fun => inp_fun, :fun => "delete_key_hash"
|
181
|
+
printer_texter({:out_data => out_data, :inp_fun => inp_fun, :fun => "delete_key_hash"}, "debug")
|
180
182
|
out_data
|
181
183
|
end
|
182
184
|
|
@@ -191,7 +193,6 @@ class InternalFunc
|
|
191
193
|
end
|
192
194
|
|
193
195
|
|
194
|
-
|
195
196
|
def test()
|
196
197
|
p "eeeeeeeeeeeeeeeeeeeeeeee"
|
197
198
|
end
|
@@ -24,19 +24,21 @@ class MhubFunctions_2
|
|
24
24
|
:static_callback,
|
25
25
|
:crm_connector,
|
26
26
|
:telegram_connector,
|
27
|
-
:sms_alphaname
|
27
|
+
:sms_alphaname,
|
28
|
+
:log_level
|
28
29
|
|
29
|
-
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, sms_alphaname)
|
30
|
+
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, sms_alphaname, log_level)
|
30
31
|
@sk_url = sk_url_simple
|
31
32
|
@sk_login = sk_login
|
32
33
|
@sk_password = sk_password
|
34
|
+
@log_level = log_level
|
33
35
|
@internal_func = InternalFunc.new
|
34
|
-
@mhub_connector = Sksk_2.new(sk_url_simple, sk_login, sk_password, sk_url_broadcast, telegram_api_url, telegram_chat_id)
|
36
|
+
@mhub_connector = Sksk_2.new(sk_url_simple, sk_login, sk_password, sk_url_broadcast, telegram_api_url, telegram_chat_id, log_level)
|
35
37
|
@internal_func = InternalFunc.new
|
36
38
|
@dabrab_connecter = Dabrab.new
|
37
39
|
@telegram_connector = Telegram_2.new(telegram_api_url, telegram_chat_id)
|
38
40
|
@static_callback = static_callback
|
39
|
-
@crm_connector = Crm_2.new(crm_callback_url, crm_login, crm_password, telegram_api_url, telegram_chat_id)
|
41
|
+
@crm_connector = Crm_2.new(crm_callback_url, crm_login, crm_password, telegram_api_url, telegram_chat_id, log_level)
|
40
42
|
@sms_alphaname = sms_alphaname
|
41
43
|
end
|
42
44
|
|
@@ -58,6 +60,7 @@ class MhubFunctions_2
|
|
58
60
|
output_params = {}
|
59
61
|
hub_resp = {}
|
60
62
|
null_statement = [nil, "nil", "", "null"]
|
63
|
+
mes_data = {}
|
61
64
|
|
62
65
|
begin
|
63
66
|
|
@@ -89,10 +92,16 @@ class MhubFunctions_2
|
|
89
92
|
# output_params = {"code": 503, "result": "Invalid recipients", "answer": {}, "sender": {"ip_src": ip_src, "ip_real": ip_real, "ip_vip": ip_vip}}
|
90
93
|
# end
|
91
94
|
|
95
|
+
p params
|
92
96
|
if params["destinations"].length >= 1
|
97
|
+
p params["destinations"]
|
93
98
|
|
99
|
+
p "eeee"
|
94
100
|
msisdn2 = dabrab_connecter.num_formatter(params["destinations"], params["notifyUrl"].split(":")[2])
|
95
101
|
|
102
|
+
splitted_parts = msisdn2.each_slice(1).to_a
|
103
|
+
|
104
|
+
|
96
105
|
if null_statement.include?(params["viber"]) && !null_statement.include?(params["sms"])
|
97
106
|
hub_resp = mhub_connector.sk_send_sms_list(msisdn2, static_callback, params["sms"]["text"], sms_alphaname)
|
98
107
|
elsif !null_statement.include?(params["viber"]) && null_statement.include?(params["sms"])
|
@@ -104,12 +113,16 @@ class MhubFunctions_2
|
|
104
113
|
else
|
105
114
|
output_params = {"code": 502, "result": "Invalid input data st2", "body": {"answer": {}, "sender": {"ip_src": ip_src, "ip_real": ip_real, "ip_vip": ip_vip}}}
|
106
115
|
end
|
116
|
+
mes_data = dabrab_connecter.send_responce_formatter(hub_resp)
|
117
|
+
|
118
|
+
|
107
119
|
else
|
108
120
|
output_params = {"code": 503, "result": "Invalid recipients", "body": {"answer": {}, "sender": {"ip_src": ip_src, "ip_real": ip_real, "ip_vip": ip_vip}}}
|
109
121
|
end
|
110
122
|
|
111
|
-
|
123
|
+
|
112
124
|
p hub_resp
|
125
|
+
p mes_data
|
113
126
|
|
114
127
|
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}}}
|
115
128
|
|
@@ -118,7 +131,61 @@ class MhubFunctions_2
|
|
118
131
|
telegram_connector.telegram_message(output_params)
|
119
132
|
end
|
120
133
|
|
121
|
-
internal_func.printer_texter({:input => input_params, :output => output_params, :hub_resp => hub_resp, :procedure => "Mhub_2.get_send_message"},
|
134
|
+
internal_func.printer_texter({:input => input_params, :output => output_params, :hub_resp => hub_resp, :procedure => "Mhub_2.get_send_message"}, log_level)
|
135
|
+
output_params
|
136
|
+
|
137
|
+
end
|
138
|
+
|
139
|
+
|
140
|
+
#for bank dabrabyt for massive nums
|
141
|
+
def get_send_message_mass_2(params, ip_src, ip_real, ip_vip)
|
142
|
+
|
143
|
+
input_params = {:params => params}
|
144
|
+
output_params = {}
|
145
|
+
|
146
|
+
null_statement = [nil, "nil", "", "null"]
|
147
|
+
mes_data_answ = []
|
148
|
+
|
149
|
+
begin
|
150
|
+
internal_func.printer_texter({:input => params, :procedure => "Mhub_2.get_send_message_mass_2"}, log_level)
|
151
|
+
if params["destinations"].length >= 1
|
152
|
+
msisdn2 = dabrab_connecter.num_formatter(params["destinations"], params["notifyUrl"].split(":")[2])
|
153
|
+
splitted_parts = msisdn2.each_slice(100).to_a
|
154
|
+
for part_list in splitted_parts
|
155
|
+
|
156
|
+
internal_func.printer_texter({:input => part_list, :procedure => "Mhub_2.get_send_message_mass_2"}, log_level)
|
157
|
+
|
158
|
+
hub_resp = {}
|
159
|
+
|
160
|
+
if null_statement.include?(params["viber"]) && !null_statement.include?(params["sms"])
|
161
|
+
hub_resp = mhub_connector.sk_send_sms_list(part_list, static_callback, params["sms"]["text"], sms_alphaname)
|
162
|
+
elsif !null_statement.include?(params["viber"]) && null_statement.include?(params["sms"])
|
163
|
+
hub_resp = mhub_connector.sk_send_viber_list(part_list, static_callback, params["viber"]["text"])
|
164
|
+
elsif !null_statement.include?(params["viber"]) && !null_statement.include?(params["sms"])
|
165
|
+
hub_resp = mhub_connector.sk_send_viber_sms_list(part_list, static_callback, params["sms"]["text"], params["viber"]["text"], sms_alphaname)
|
166
|
+
else
|
167
|
+
output_params = {"code": 502, "result": "Invalid input data st2", "body": {"answer": {}, "sender": {"ip_src": ip_src, "ip_real": ip_real, "ip_vip": ip_vip}}}
|
168
|
+
end
|
169
|
+
mes_data = dabrab_connecter.send_responce_formatter(hub_resp)
|
170
|
+
|
171
|
+
internal_func.printer_texter({:input => mes_data, :procedure => "Mhub_2.get_send_message_mass_2"}, log_level)
|
172
|
+
|
173
|
+
mes_data_answ = mes_data_answ + mes_data[:body][:mess_to_recip][:messages]
|
174
|
+
|
175
|
+
end
|
176
|
+
|
177
|
+
else
|
178
|
+
output_params = {"code": 503, "result": "Invalid recipients", "body": {"answer": {}, "sender": {"ip_src": ip_src, "ip_real": ip_real, "ip_vip": ip_vip}}}
|
179
|
+
end
|
180
|
+
|
181
|
+
output_params = {"code": 200, "result": "Data processed", "body": {"answer": {"bulkId": "00000000-0000-0000-0000-000000000000", "messages": mes_data_answ}, "sender": {"ip_src": ip_src, "ip_real": ip_real, "ip_vip": ip_vip}}}
|
182
|
+
|
183
|
+
rescue
|
184
|
+
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}}}
|
185
|
+
telegram_connector.telegram_message(output_params)
|
186
|
+
end
|
187
|
+
|
188
|
+
internal_func.printer_texter({:input => input_params, :output => output_params, :hub_resp => {}, :procedure => "Mhub_2.get_send_message"}, log_level)
|
122
189
|
output_params
|
123
190
|
|
124
191
|
end
|
@@ -142,7 +209,7 @@ class MhubFunctions_2
|
|
142
209
|
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}}}
|
143
210
|
telegram_connector.telegram_message(output_params)
|
144
211
|
end
|
145
|
-
internal_func.printer_texter({:input => input_params, :output => output_params, :hub_resp => hub_resp, :procedure => "Mhub_2.recieve_delivery_report"},
|
212
|
+
internal_func.printer_texter({:input => input_params, :output => output_params, :hub_resp => hub_resp, :procedure => "Mhub_2.recieve_delivery_report"}, log_level)
|
146
213
|
output_params
|
147
214
|
end
|
148
215
|
|
@@ -3,12 +3,13 @@ require 'imperituroard/projects/mhub/subs/dabrab/dabrab_proced'
|
|
3
3
|
|
4
4
|
class Sksk_2
|
5
5
|
|
6
|
-
attr_accessor :sk_url, :sk_url_broadcast, :sk_login, :sk_password, :internal_func, :telegram_connector, :dabrab_add_func
|
6
|
+
attr_accessor :sk_url, :sk_url_broadcast, :sk_login, :sk_password, :internal_func, :telegram_connector, :dabrab_add_func, :log_level
|
7
7
|
|
8
|
-
def initialize(sk_url, sk_login, sk_password, sk_url_broadcast, telegram_api_url, telegram_chat_id)
|
8
|
+
def initialize(sk_url, sk_login, sk_password, sk_url_broadcast, telegram_api_url, telegram_chat_id, log_level)
|
9
9
|
@sk_url = sk_url
|
10
10
|
@sk_login = sk_login
|
11
11
|
@sk_password = sk_password
|
12
|
+
@log_level = log_level
|
12
13
|
@internal_func = InternalFunc.new
|
13
14
|
@sk_url_broadcast = sk_url_broadcast
|
14
15
|
@telegram_connector = Telegram_2.new(telegram_api_url, telegram_chat_id)
|
@@ -72,7 +73,7 @@ class Sksk_2
|
|
72
73
|
output_params = {:code => 500, :result => "Sksk_2.sk_send_sms_one: Something wrong", :body => {:request_message => request_message}}
|
73
74
|
telegram_connector.telegram_message(output_params)
|
74
75
|
end
|
75
|
-
internal_func.printer_texter({:input => input_params, :output => output_params, :procedure => "Sksk_1.sk_send_sms_one"},
|
76
|
+
internal_func.printer_texter({:input => input_params, :output => output_params, :procedure => "Sksk_1.sk_send_sms_one"}, log_level)
|
76
77
|
output_params
|
77
78
|
end
|
78
79
|
|
@@ -131,12 +132,11 @@ class Sksk_2
|
|
131
132
|
|
132
133
|
thr_sk_send_viber_one.join
|
133
134
|
|
134
|
-
|
135
135
|
rescue
|
136
136
|
output_params = {:code => 500, :result => "Sksk_2.sk_send_viber_one: Something wrong"}
|
137
137
|
telegram_connector.telegram_message(output_params)
|
138
138
|
end
|
139
|
-
internal_func.printer_texter({:input => input_params, :output => output_params, :procedure => "Sksk_2.sk_send_viber_one"},
|
139
|
+
internal_func.printer_texter({:input => input_params, :output => output_params, :procedure => "Sksk_2.sk_send_viber_one"}, log_level)
|
140
140
|
output_params
|
141
141
|
end
|
142
142
|
|
@@ -198,7 +198,6 @@ class Sksk_2
|
|
198
198
|
else
|
199
199
|
output_params = {:code => 508, :result => "Sksk_2.sk_send_viber_sms_one: Something wrong with dabrabyt_text_field_parse"}
|
200
200
|
end
|
201
|
-
|
202
201
|
end
|
203
202
|
|
204
203
|
thr_sk_send_viber_sms_one.join
|
@@ -207,7 +206,7 @@ class Sksk_2
|
|
207
206
|
output_params = {:code => 500, :result => "Sksk_2.sk_send_viber_sms_one: Something wrong"}
|
208
207
|
telegram_connector.telegram_message(output_params)
|
209
208
|
end
|
210
|
-
internal_func.printer_texter({:input => input_params, :output => output_params, :procedure => "Sksk_2.sk_send_viber_sms_one"},
|
209
|
+
internal_func.printer_texter({:input => input_params, :output => output_params, :procedure => "Sksk_2.sk_send_viber_sms_one"}, log_level)
|
211
210
|
output_params
|
212
211
|
|
213
212
|
end
|
@@ -269,7 +268,7 @@ class Sksk_2
|
|
269
268
|
output_params = {:code => 500, :result => "Sksk_2.sk_send_sms_list: Something wrong"}
|
270
269
|
telegram_connector.telegram_message(output_params)
|
271
270
|
end
|
272
|
-
internal_func.printer_texter({:input => input_params, :output => output_params, :procedure => "Sksk_2.sk_send_sms_list"},
|
271
|
+
internal_func.printer_texter({:input => input_params, :output => output_params, :procedure => "Sksk_2.sk_send_sms_list"}, log_level)
|
273
272
|
output_params
|
274
273
|
end
|
275
274
|
|
@@ -332,7 +331,7 @@ class Sksk_2
|
|
332
331
|
output_params = {:code => 500, :result => "Sksk_2.sk_send_viber_list: Something wrong"}
|
333
332
|
telegram_connector.telegram_message(output_params)
|
334
333
|
end
|
335
|
-
internal_func.printer_texter({:input => input_params, :output => output_params, :procedure => "Sksk_2.sk_send_viber_list"},
|
334
|
+
internal_func.printer_texter({:input => input_params, :output => output_params, :procedure => "Sksk_2.sk_send_viber_list"}, log_level)
|
336
335
|
output_params
|
337
336
|
end
|
338
337
|
|
@@ -345,6 +344,7 @@ class Sksk_2
|
|
345
344
|
begin
|
346
345
|
thr_sk_send_viber_sms_list = Thread.new do
|
347
346
|
|
347
|
+
|
348
348
|
viber_mess_ans = dabrab_add_func.dabrabyt_text_field_parse(viber_text)
|
349
349
|
|
350
350
|
if viber_mess_ans[:code] == 200
|
@@ -359,7 +359,6 @@ class Sksk_2
|
|
359
359
|
|
360
360
|
req.basic_auth sk_login, sk_password
|
361
361
|
|
362
|
-
|
363
362
|
req["Content-Type"] = "application/json"
|
364
363
|
req["Accept"] = "application/json"
|
365
364
|
|
@@ -390,20 +389,16 @@ class Sksk_2
|
|
390
389
|
:body => {:request_message => request_message,
|
391
390
|
:res_code => res.code,
|
392
391
|
:res_body => JSON.parse(res.body.to_s)}}
|
393
|
-
|
394
392
|
else
|
395
393
|
output_params = {:code => 508, :result => "Sksk_2.sk_send_viber_sms_list: Something wrong with dabrabyt_text_field_parse"}
|
396
394
|
end
|
397
|
-
|
398
395
|
end
|
399
|
-
|
400
396
|
thr_sk_send_viber_sms_list.join
|
401
|
-
|
402
397
|
rescue
|
403
398
|
output_params = {:code => 500, :result => "Sksk_2.sk_send_viber_sms_list: Something wrong"}
|
404
399
|
telegram_connector.telegram_message(output_params)
|
405
400
|
end
|
406
|
-
internal_func.printer_texter({:input => input_params, :output => output_params, :procedure => "Sksk_2.sk_send_viber_sms_list"},
|
401
|
+
internal_func.printer_texter({:input => input_params, :output => output_params, :procedure => "Sksk_2.sk_send_viber_sms_list"}, log_level)
|
407
402
|
output_params
|
408
403
|
end
|
409
404
|
|
@@ -3,11 +3,12 @@ require 'imperituroard/projects/iot/internal_functions'
|
|
3
3
|
|
4
4
|
class Crm_2
|
5
5
|
|
6
|
-
attr_accessor :crm_callback_url, :crm_login, :crm_password, :internal_func, :telegram_connector
|
6
|
+
attr_accessor :crm_callback_url, :crm_login, :crm_password, :internal_func, :telegram_connector, :log_level
|
7
7
|
|
8
|
-
def initialize(crm_callback_url, crm_login, crm_password, telegram_api_url, telegram_chat_id)
|
8
|
+
def initialize(crm_callback_url, crm_login, crm_password, telegram_api_url, telegram_chat_id, log_level)
|
9
9
|
@crm_callback_url = crm_callback_url
|
10
10
|
@crm_login = crm_login
|
11
|
+
@log_level = log_level
|
11
12
|
@crm_password = crm_password
|
12
13
|
@internal_func = InternalFunc.new
|
13
14
|
@telegram_connector = Telegram_2.new(telegram_api_url, telegram_chat_id)
|
@@ -44,7 +45,7 @@ class Crm_2
|
|
44
45
|
:body => {:request_message => crm_payload,
|
45
46
|
:res_code => res.code,
|
46
47
|
:res_body => JSON.parse(res.body.to_s)}}
|
47
|
-
p res.body
|
48
|
+
#p res.body
|
48
49
|
end
|
49
50
|
thr_crm_status_2.join
|
50
51
|
|
@@ -52,7 +53,7 @@ class Crm_2
|
|
52
53
|
output_params = {:code => 500, :result => "Crm_2.crm_status_2: Something wrong", :body => {:request_message => request_message}}
|
53
54
|
telegram_connector.telegram_message(output_params)
|
54
55
|
end
|
55
|
-
internal_func.printer_texter({:input => input_params, :output => output_params, :procedure => "Crm_2.crm_status_2"},
|
56
|
+
internal_func.printer_texter({:input => input_params, :output => output_params, :procedure => "Crm_2.crm_status_2"}, log_level)
|
56
57
|
output_params
|
57
58
|
|
58
59
|
end
|
@@ -30,9 +30,9 @@ class Dabrab
|
|
30
30
|
image_dat = stri.scan(regexp_image1)
|
31
31
|
|
32
32
|
|
33
|
-
p button_url_dat
|
34
|
-
p button_text_dat
|
35
|
-
p image_dat
|
33
|
+
#p button_url_dat
|
34
|
+
#p button_text_dat
|
35
|
+
#p image_dat
|
36
36
|
|
37
37
|
begin
|
38
38
|
if button_url_dat != [] && button_url_dat != nil && button_url_dat != ""
|
@@ -90,19 +90,20 @@ class Dabrab
|
|
90
90
|
scheme = 0
|
91
91
|
end
|
92
92
|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
93
|
+
case scheme
|
94
|
+
when 0
|
95
|
+
sk_format = {"text": text, "ttl": 60}
|
96
|
+
when 1
|
97
|
+
sk_format = {"text": text, "ttl": 60, "caption": button_text, "action": button_url}
|
98
|
+
when 2
|
99
|
+
sk_format = {"text": text, "ttl": 60, "caption": button_text, "action": button_url, "img": image}
|
100
|
+
when 3
|
101
|
+
sk_format = {"img": image, "ttl": 60}
|
102
|
+
else
|
103
|
+
nil
|
103
104
|
end
|
104
105
|
|
105
|
-
p sk_format
|
106
|
+
#p sk_format
|
106
107
|
|
107
108
|
output_answer ={:code => 200, :result => "Success", :body => {:to_sk_format => sk_format, :button_url => button_url, :image => image, :button_text => button_text, :text => text, :scheme => scheme, :scheme_dic => scheme_dic[scheme]}}
|
108
109
|
rescue
|
@@ -125,11 +126,12 @@ class Dabrab
|
|
125
126
|
#"extra_id": extra_id
|
126
127
|
})
|
127
128
|
rescue
|
128
|
-
|
129
|
+
nil
|
130
|
+
#p "failed: #{g.to_s}"
|
129
131
|
end
|
130
132
|
|
131
133
|
end
|
132
|
-
p converted_msisdn_list
|
134
|
+
#p converted_msisdn_list
|
133
135
|
converted_msisdn_list
|
134
136
|
|
135
137
|
end
|
@@ -155,8 +157,8 @@ class Dabrab
|
|
155
157
|
]
|
156
158
|
}
|
157
159
|
|
158
|
-
p "send_responce_formatter(hub_answer)"
|
159
|
-
p hub_answer
|
160
|
+
#p "send_responce_formatter(hub_answer)"
|
161
|
+
#p hub_answer
|
160
162
|
|
161
163
|
for a in hub_answer[:body][:res_body]["messages"]
|
162
164
|
status1 = {}
|
@@ -181,7 +183,7 @@ class Dabrab
|
|
181
183
|
messages_sect.append(status1)
|
182
184
|
end
|
183
185
|
|
184
|
-
p messages_sect
|
186
|
+
#p messages_sect
|
185
187
|
|
186
188
|
mess_to_recip = {"bulkId": "00000000-0000-0000-0000-000000000000", "messages": messages_sect}
|
187
189
|
{:code => 200, :result => "Data processed", :body => {:mess_to_recip => mess_to_recip}}
|
@@ -190,8 +192,8 @@ class Dabrab
|
|
190
192
|
|
191
193
|
def delivery_report_transform(hub_report)
|
192
194
|
#{"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"}}
|
193
|
-
|
194
|
-
|
195
|
+
#p hub_report
|
196
|
+
#p "hub_report"
|
195
197
|
data_for_status = {
|
196
198
|
23011 => {:status_id => 5, :status_grid => 3, :status_grname => "DELIVERED", :status_name => "DELIVERED_TO_HANDSET", :status_descr => "Message delivered by SMS",
|
197
199
|
:error_id => 0, :error_grid => 0, :error_grname => "Ok", :error_name => "NO_ERROR", :error_descr => "No Error", :error_permanent => false
|
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.1.
|
4
|
+
version: 1.1.10
|
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-09-
|
11
|
+
date: 2020-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -207,6 +207,8 @@ files:
|
|
207
207
|
- lib/imperituroard/platforms/cps/cps_multiple_thread_req.rb
|
208
208
|
- lib/imperituroard/platforms/cps/qps_connector.rb
|
209
209
|
- lib/imperituroard/platforms/cps/request_formatter.rb
|
210
|
+
- lib/imperituroard/platforms/iwag/get_iwag_data.rb
|
211
|
+
- lib/imperituroard/platforms/iwag/iwag_database_worker.rb
|
210
212
|
- lib/imperituroard/platforms/public/telegram.rb
|
211
213
|
- lib/imperituroard/platforms/staros/get_data_ssh.rb
|
212
214
|
- lib/imperituroard/platforms/staros/staros_automation.rb
|