imperituroard 1.1.10 → 1.1.11

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: 06a24d95016bbc1c495cb86ef3f2cbebd39bfa21
4
- data.tar.gz: 647278e86d5ec1f44cf808e8c3a63f7f1c4c7b64
3
+ metadata.gz: 28a8ed8a7d0e3e2896f7c67a7d63911c82e4c263
4
+ data.tar.gz: df3d6c2b96ac564a4feee8e9df5ac6c884b46187
5
5
  SHA512:
6
- metadata.gz: 74ae2cf7887f78b327956031bf5babab5ab78477b094b1f866ec6b43fd00796cf1a766cf21980507152434aafd9918917b3877f7adb62d15c7edee812c4deafa
7
- data.tar.gz: 144a7e259528a7fa57a6f4f81a558e0604d1957cf294cf7479d8bfa35b896849bc216180180c6e418bc8672d031674d97d6f9c1ff729b2adbc1f37a98be66624
6
+ metadata.gz: 65ae8bf70ab9db28066ac1b566612d975ec165b4fa34b2fb58fb3bb7ec50defe7c5192fa0d88ff3a89f3d5d7022be8a81c0965e2638a2ffb77810a13c9759e57
7
+ data.tar.gz: 85e98458692adc97a666e40c7b26287f9e1985011d3d81acf57a8f5fb7ce4df19c2430727d85cf78bdd1f450b90f43506f56e42124c87353455ea13c7ddedca9
@@ -0,0 +1,21 @@
1
+ <component name="ProjectRunConfigurationManager">
2
+ <configuration default="false" name="dabrab_proced" type="RubyRunConfigurationType" factoryName="Ruby">
3
+ <module name="imperituroard" />
4
+ <RUBY_RUN_CONFIG NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
5
+ <RUBY_RUN_CONFIG NAME="WORK DIR" VALUE="$MODULE_DIR$/lib/imperituroard/projects/mhub/subs/dabrab" />
6
+ <RUBY_RUN_CONFIG NAME="SHOULD_USE_SDK" VALUE="false" />
7
+ <RUBY_RUN_CONFIG NAME="ALTERN_SDK_NAME" VALUE="" />
8
+ <RUBY_RUN_CONFIG NAME="myPassParentEnvs" VALUE="true" />
9
+ <envs />
10
+ <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="true" />
11
+ <EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
12
+ <EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
13
+ <COVERAGE_PATTERN ENABLED="true">
14
+ <PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
15
+ </COVERAGE_PATTERN>
16
+ </EXTENSION>
17
+ <RUBY_RUN_CONFIG NAME="SCRIPT_PATH" VALUE="$MODULE_DIR$/lib/imperituroard/projects/mhub/subs/dabrab/dabrab_proced.rb" />
18
+ <RUBY_RUN_CONFIG NAME="SCRIPT_ARGS" VALUE="" />
19
+ <method />
20
+ </configuration>
21
+ </component>
@@ -0,0 +1,21 @@
1
+ <component name="ProjectRunConfigurationManager">
2
+ <configuration default="false" name="test9_dab" type="RubyRunConfigurationType" factoryName="Ruby">
3
+ <module name="imperituroard" />
4
+ <RUBY_RUN_CONFIG NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
5
+ <RUBY_RUN_CONFIG NAME="WORK DIR" VALUE="$MODULE_DIR$/test" />
6
+ <RUBY_RUN_CONFIG NAME="SHOULD_USE_SDK" VALUE="false" />
7
+ <RUBY_RUN_CONFIG NAME="ALTERN_SDK_NAME" VALUE="" />
8
+ <RUBY_RUN_CONFIG NAME="myPassParentEnvs" VALUE="true" />
9
+ <envs />
10
+ <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="true" />
11
+ <EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
12
+ <EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
13
+ <COVERAGE_PATTERN ENABLED="true">
14
+ <PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
15
+ </COVERAGE_PATTERN>
16
+ </EXTENSION>
17
+ <RUBY_RUN_CONFIG NAME="SCRIPT_PATH" VALUE="$MODULE_DIR$/test/test9_dab.rb" />
18
+ <RUBY_RUN_CONFIG NAME="SCRIPT_ARGS" VALUE="" />
19
+ <method />
20
+ </configuration>
21
+ </component>
@@ -314,7 +314,7 @@ class Mhub_2
314
314
  :crm_connector,
315
315
  :log_level
316
316
 
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
+ 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="error")
318
318
  @sk_url = sk_url_simple
319
319
  @sk_login = sk_login
320
320
  @sk_password = sk_password
@@ -341,8 +341,8 @@ class Mhub_2
341
341
  mhub_connector.get_send_message_2(params, ip_src, ip_real, ip_vip)
342
342
  end
343
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)
344
+ def get_send_message_mass(params, ip_src, ip_real, ip_vip, slice_number=100, time_pause_minutes=5)
345
+ mhub_connector.get_send_message_mass_2(params, ip_src, ip_real, ip_vip, slice_number, time_pause_minutes)
346
346
  end
347
347
 
348
348
  def recieve_delivery_report(params, ip_src, ip_real, ip_vip)
@@ -0,0 +1,112 @@
1
+ require 'net-telnet'
2
+ require 'net/ssh'
3
+ require 'date'
4
+
5
+ class CSRtelnet_1
6
+
7
+ attr_accessor :iwag1_host, :iwag_username, :iwag_password
8
+
9
+ def initialize(iwag1_host, iwag_username, iwag_password)
10
+ @iwag1_host = iwag1_host
11
+ @iwag_username = iwag_username
12
+ @iwag_password = iwag_password
13
+ end
14
+
15
+ def get_subs_mac2_1(ipaddress)
16
+
17
+ subscribers_mac = ""
18
+
19
+ #begin
20
+
21
+ dump =""
22
+ connection = Net::Telnet.new( "Host" => iwag1_host, "Timeout" => false, "Prompt" => /.*\#/ ) { |str| }
23
+ connection.login({ "Name" => iwag_username, "Password" => iwag_password, "LoginPrompt" => /Username:/ }) { |str| }
24
+ connection.cmd("show ip dhcp binding #{ipaddress}") {
25
+ |c|
26
+ p c
27
+ dump << c
28
+ }
29
+ connection.close
30
+ as = dump.split("\n")
31
+ p as
32
+ reer = as[4].split(" ")
33
+
34
+ ma = reer[1].to_s.upcase
35
+ pos = ma[0]+ma[1]
36
+ if pos=="01"
37
+ subscribers_mac = ma[2]+ma[3]+":"+ma[5]+ma[6]+":"+ma[7]+ma[8]+":"+ma[10]+ma[11]+":"+ma[12]+ma[13]+":"+ma[15]+ma[16]
38
+ else
39
+ subscribers_mac = ma[0]+ma[1]+":"+ma[2]+ma[3]+":"+ma[5]+ma[6]+":"+ma[7]+ma[8]+":"+ma[10]+ma[11]+":"+ma[12]+ma[13]
40
+ end
41
+
42
+
43
+ #rescue
44
+ # subscribers_mac = "unknown"
45
+ #end
46
+
47
+ return subscribers_mac
48
+
49
+ end
50
+
51
+
52
+ #test function. Not used
53
+ def get_iwag_info_ssh_1(ipaddress)
54
+ p DateTime.now
55
+ Net::SSH.start(iwag1_host, iwag_username, :password => iwag_password) do |ssh|
56
+ result = ssh.exec!("show ip dhcp binding #{ipaddress}\n")
57
+ p result
58
+ end
59
+ p DateTime.now
60
+ end
61
+
62
+
63
+
64
+ def return_iwag_access_interface_1(ipaddress)
65
+ host_iwag = iwag1_host
66
+ username_iwag = iwag_username
67
+ password_iwag = iwag_password
68
+ answer =""
69
+
70
+ dump =""
71
+ begin
72
+ connection = Net::Telnet.new("Host" => host_iwag, "Timeout" => false, "Prompt" => /.*\#/) {|str| print str}
73
+ connection.login({"Name" => username_iwag, "Password" => password_iwag, "LoginPrompt" => /Username:/}) {|str| print str}
74
+ connection.cmd("show ip dhcp binding #{ipaddress}") {
75
+ |c|
76
+ dump << c
77
+ }
78
+ connection.close
79
+ as = dump.split("\n")
80
+
81
+ if as[4] != nil && as[3] != ""
82
+ access_interface = as[4].gsub!(" ", "").split(" ").last
83
+ return access_interface
84
+ else
85
+ answer ="false"
86
+ return answer
87
+ end
88
+ rescue
89
+ begin
90
+ connection = Net::Telnet.new("Host" => host_iwag, "Timeout" => false, "Prompt" => /.*\#/) {|str| print str}
91
+ connection.login({"Name" => username_iwag, "Password" => password_iwag, "LoginPrompt" => /Username:/}) {|str| print str}
92
+ connection.cmd("show ip dhcp binding #{ipaddress}") {
93
+ |c|
94
+ dump << c
95
+ }
96
+ connection.close
97
+ as = dump.split("\n")
98
+ if as[4] != nil && as[3] != ""
99
+ access_interface = as[4].gsub!(" ", "").split(" ").last
100
+ return access_interface
101
+ else
102
+ answer ="false"
103
+ return answer
104
+ end
105
+ rescue
106
+ return "unknown"
107
+ end
108
+ end
109
+ end
110
+
111
+
112
+ end
@@ -92,15 +92,10 @@ class MhubFunctions_2
92
92
  # output_params = {"code": 503, "result": "Invalid recipients", "answer": {}, "sender": {"ip_src": ip_src, "ip_real": ip_real, "ip_vip": ip_vip}}
93
93
  # end
94
94
 
95
- p params
96
95
  if params["destinations"].length >= 1
97
- p params["destinations"]
98
96
 
99
- p "eeee"
100
97
  msisdn2 = dabrab_connecter.num_formatter(params["destinations"], params["notifyUrl"].split(":")[2])
101
98
 
102
- splitted_parts = msisdn2.each_slice(1).to_a
103
-
104
99
 
105
100
  if null_statement.include?(params["viber"]) && !null_statement.include?(params["sms"])
106
101
  hub_resp = mhub_connector.sk_send_sms_list(msisdn2, static_callback, params["sms"]["text"], sms_alphaname)
@@ -120,10 +115,6 @@ class MhubFunctions_2
120
115
  output_params = {"code": 503, "result": "Invalid recipients", "body": {"answer": {}, "sender": {"ip_src": ip_src, "ip_real": ip_real, "ip_vip": ip_vip}}}
121
116
  end
122
117
 
123
-
124
- p hub_resp
125
- p mes_data
126
-
127
118
  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}}}
128
119
 
129
120
  rescue
@@ -138,7 +129,7 @@ class MhubFunctions_2
138
129
 
139
130
 
140
131
  #for bank dabrabyt for massive nums
141
- def get_send_message_mass_2(params, ip_src, ip_real, ip_vip)
132
+ def get_send_message_mass_2(params, ip_src, ip_real, ip_vip, slice_number, time_pause_minutes)
142
133
 
143
134
  input_params = {:params => params}
144
135
  output_params = {}
@@ -150,7 +141,7 @@ class MhubFunctions_2
150
141
  internal_func.printer_texter({:input => params, :procedure => "Mhub_2.get_send_message_mass_2"}, log_level)
151
142
  if params["destinations"].length >= 1
152
143
  msisdn2 = dabrab_connecter.num_formatter(params["destinations"], params["notifyUrl"].split(":")[2])
153
- splitted_parts = msisdn2.each_slice(100).to_a
144
+ splitted_parts = msisdn2.each_slice(slice_number).to_a
154
145
  for part_list in splitted_parts
155
146
 
156
147
  internal_func.printer_texter({:input => part_list, :procedure => "Mhub_2.get_send_message_mass_2"}, log_level)
@@ -158,11 +149,11 @@ class MhubFunctions_2
158
149
  hub_resp = {}
159
150
 
160
151
  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)
152
+ hub_resp = mhub_connector.sk_send_sms_list(part_list, static_callback, params["sms"]["text"], sms_alphaname, time_pause_minutes)
162
153
  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"])
154
+ hub_resp = mhub_connector.sk_send_viber_list(part_list, static_callback, params["viber"]["text"], time_pause_minutes)
164
155
  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)
156
+ hub_resp = mhub_connector.sk_send_viber_sms_list(part_list, static_callback, params["sms"]["text"], params["viber"]["text"], sms_alphaname, time_pause_minutes)
166
157
  else
167
158
  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
159
  end
@@ -213,11 +204,6 @@ class MhubFunctions_2
213
204
  output_params
214
205
  end
215
206
 
216
- def test2
217
- hh = Infobip_1.new
218
- hh.test
219
- end
220
-
221
207
 
222
208
  end
223
209
 
@@ -1,5 +1,6 @@
1
1
  require 'imperituroard/projects/iot/internal_functions'
2
2
  require 'imperituroard/projects/mhub/subs/dabrab/dabrab_proced'
3
+ require 'date'
3
4
 
4
5
  class Sksk_2
5
6
 
@@ -17,6 +18,13 @@ class Sksk_2
17
18
  end
18
19
 
19
20
 
21
+ def get_start_date(addit_min)
22
+ date_b = Time.now
23
+ (date_b + addit_min * 60).strftime("%Y-%m-%d %H:%M:%S")
24
+ end
25
+
26
+
27
+
20
28
  def sk_send_sms_one(msisdn, callback_url, text, alphaname)
21
29
 
22
30
  input_params = {:msisdn => msisdn, :callback_url => callback_url, :text => text, :alphaname => alphaname}
@@ -212,7 +220,7 @@ class Sksk_2
212
220
  end
213
221
 
214
222
 
215
- def sk_send_sms_list(msisdn_list, callback_url, text, alphaname)
223
+ def sk_send_sms_list(msisdn_list, callback_url, text, alphaname, time_pause_minutes=1)
216
224
 
217
225
  input_params = {:msisdn_list => msisdn_list, :callback_url => callback_url, :text => text, :alphaname => alphaname}
218
226
  output_params = {}
@@ -239,6 +247,7 @@ class Sksk_2
239
247
  request_message = {
240
248
  "recipients": msisdn_list,
241
249
  "callback_url": callback_url,
250
+ "start_time": get_start_date(time_pause_minutes),
242
251
  "tag": "Dabrab_custom_api_1",
243
252
  "channels": [
244
253
  "sms"
@@ -273,7 +282,7 @@ class Sksk_2
273
282
  end
274
283
 
275
284
 
276
- def sk_send_viber_list(msisdn_list, callback_url, text)
285
+ def sk_send_viber_list(msisdn_list, callback_url, text, time_pause_minutes)
277
286
 
278
287
  input_params = {:msisdn_list => msisdn_list, :callback_url => callback_url, :text => text}
279
288
  output_params = {}
@@ -304,6 +313,7 @@ class Sksk_2
304
313
  request_message = {
305
314
  "recipients": msisdn_list,
306
315
  "callback_url": callback_url,
316
+ "start_time": get_start_date(time_pause_minutes),
307
317
  "tag": "Dabrab_custom_api_1",
308
318
  "channels": [
309
319
  "viber"
@@ -336,7 +346,7 @@ class Sksk_2
336
346
  end
337
347
 
338
348
 
339
- def sk_send_viber_sms_list(msisdn_list, callback_url, sms_text, viber_text, alphaname)
349
+ def sk_send_viber_sms_list(msisdn_list, callback_url, sms_text, viber_text, alphaname, time_pause_minutes)
340
350
  input_params = {:msisdn_list => msisdn_list, :callback_url => callback_url, :sms_text => sms_text, :viber_text => viber_text, :alphaname => alphaname}
341
351
  output_params = {}
342
352
  request_message = {}
@@ -349,6 +359,8 @@ class Sksk_2
349
359
 
350
360
  if viber_mess_ans[:code] == 200
351
361
 
362
+
363
+
352
364
  uri = URI(sk_url_broadcast)
353
365
  #8 - client id
354
366
 
@@ -366,6 +378,7 @@ class Sksk_2
366
378
  request_message = {
367
379
  "recipients": msisdn_list,
368
380
  "callback_url": callback_url,
381
+ "start_time": get_start_date(time_pause_minutes),
369
382
  "tag": "Dabrab_custom_api_1",
370
383
  "channels": [
371
384
  "viber",
@@ -190,94 +190,157 @@ class Dabrab
190
190
  end
191
191
 
192
192
 
193
- def delivery_report_transform(hub_report)
193
+ def delivery_report_transform(hub_report_in)
194
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"}}
195
195
  #p hub_report
196
196
  #p "hub_report"
197
- data_for_status = {
198
- 23011 => {:status_id => 5, :status_grid => 3, :status_grname => "DELIVERED", :status_name => "DELIVERED_TO_HANDSET", :status_descr => "Message delivered by SMS",
199
- :error_id => 0, :error_grid => 0, :error_grname => "Ok", :error_name => "NO_ERROR", :error_descr => "No Error", :error_permanent => false
200
- },
201
- 23033 => {:status_id => 5, :status_grid => 3, :status_grname => "DELIVERED", :status_name => "DELIVERED_TO_HANDSET", :status_descr => "Message delivered by Viber",
202
- :error_id => 0, :error_grid => 0, :error_grname => "Ok", :error_name => "NO_ERROR", :error_descr => "No Error", :error_permanent => false
203
- },
204
- 35015 => {:status_id => 15, :status_grid => 4, :status_grname => "EXPIRED", :status_name => "EXPIRED_EXPIRED", :status_descr => "SMS Message TTL EXPIRED",
205
- :error_id => 6, :error_grid => 1, :error_grname => "HANDSET_ERRORS", :error_name => "EC_ABSENT_SUBSCRIBER_SM", :error_descr => "Subscriber is absent", :error_permanent => false
206
- }, #message SMS expired
207
- 36463 => {:status_id => 15, :status_grid => 4, :status_grname => "EXPIRED", :status_name => "EXPIRED_EXPIRED", :status_descr => "Viber Message TTL EXPIRED",
208
- :error_id => 6, :error_grid => 1, :error_grname => "HANDSET_ERRORS", :error_name => "EC_ABSENT_SUBSCRIBER_SM", :error_descr => "Subscriber is absent.", :error_permanent => false
209
- }, #message Viber expired
210
- 36010 => {:status_id => 4, :status_grid => 2, :status_grname => "UNDELIVERABLE", :status_name => "UNDELIVERABLE_REJECTED_OPERATOR", :status_descr => "SMS. Subscriber not exists",
211
- :error_id => 6, :error_grid => 1, :error_grname => "HANDSET_ERRORS", :error_name => "EC_UNKNOWN_SUBSCRIBER", :error_descr => "Subscriber not found.", :error_permanent => true
212
- }, #SMS subscriber not exists
213
- 36131 => {:status_id => 4, :status_grid => 2, :status_grname => "UNDELIVERABLE", :status_name => "UNDELIVERABLE_REJECTED_OPERATOR", :status_descr => "SMS. Unknown subscriber",
214
- :error_id => 6, :error_grid => 1, :error_grname => "HANDSET_ERRORS", :error_name => "EC_UNKNOWN_SUBSCRIBER", :error_descr => "Subscriber not found.", :error_permanent => true
215
- }, #SMS unknown subscriber
216
- 36505 => {:status_id => 4, :status_grid => 2, :status_grname => "UNDELIVERABLE", :status_name => "UNDELIVERABLE_REJECTED_OPERATOR", :status_descr => "Viber. Subscriber not exists",
217
- :error_id => 6, :error_grid => 1, :error_grname => "HANDSET_ERRORS", :error_name => "EC_UNKNOWN_SUBSCRIBER", :error_descr => "Subscriber not found.", :error_permanent => true
218
- } #Viber subscriber not exists
219
- }
197
+ report_to_recip =
198
+
199
+ data_for_status = {
200
+ 23011 => {:status_id => 5, :status_grid => 3, :status_grname => "DELIVERED", :status_name => "DELIVERED_TO_HANDSET", :status_descr => "Message delivered by SMS",
201
+ :error_id => 0, :error_grid => 0, :error_grname => "Ok", :error_name => "NO_ERROR", :error_descr => "No Error", :error_permanent => false
202
+ },
203
+ 23033 => {:status_id => 5, :status_grid => 3, :status_grname => "DELIVERED", :status_name => "DELIVERED_TO_HANDSET", :status_descr => "Message delivered by Viber",
204
+ :error_id => 0, :error_grid => 0, :error_grname => "Ok", :error_name => "NO_ERROR", :error_descr => "No Error", :error_permanent => false
205
+ },
206
+ 35015 => {:status_id => 15, :status_grid => 4, :status_grname => "EXPIRED", :status_name => "EXPIRED_EXPIRED", :status_descr => "SMS Message TTL EXPIRED",
207
+ :error_id => 6, :error_grid => 1, :error_grname => "HANDSET_ERRORS", :error_name => "EC_ABSENT_SUBSCRIBER_SM", :error_descr => "Subscriber is absent", :error_permanent => false
208
+ }, #message SMS expired
209
+ 36463 => {:status_id => 15, :status_grid => 4, :status_grname => "EXPIRED", :status_name => "EXPIRED_EXPIRED", :status_descr => "Viber Message TTL EXPIRED",
210
+ :error_id => 6, :error_grid => 1, :error_grname => "HANDSET_ERRORS", :error_name => "EC_ABSENT_SUBSCRIBER_SM", :error_descr => "Subscriber is absent.", :error_permanent => false
211
+ }, #message Viber expired
212
+ 36010 => {:status_id => 4, :status_grid => 2, :status_grname => "UNDELIVERABLE", :status_name => "UNDELIVERABLE_REJECTED_OPERATOR", :status_descr => "SMS. Subscriber not exists",
213
+ :error_id => 6, :error_grid => 1, :error_grname => "HANDSET_ERRORS", :error_name => "EC_UNKNOWN_SUBSCRIBER", :error_descr => "Subscriber not found.", :error_permanent => true
214
+ }, #SMS subscriber not exists
215
+ 36131 => {:status_id => 4, :status_grid => 2, :status_grname => "UNDELIVERABLE", :status_name => "UNDELIVERABLE_REJECTED_OPERATOR", :status_descr => "SMS. Unknown subscriber",
216
+ :error_id => 6, :error_grid => 1, :error_grname => "HANDSET_ERRORS", :error_name => "EC_UNKNOWN_SUBSCRIBER", :error_descr => "Subscriber not found.", :error_permanent => true
217
+ }, #SMS unknown subscriber
218
+ 36505 => {:status_id => 4, :status_grid => 2, :status_grname => "UNDELIVERABLE", :status_name => "UNDELIVERABLE_REJECTED_OPERATOR", :status_descr => "Viber. Subscriber not exists",
219
+ :error_id => 6, :error_grid => 1, :error_grname => "HANDSET_ERRORS", :error_name => "EC_UNKNOWN_SUBSCRIBER", :error_descr => "Subscriber not found.", :error_permanent => true
220
+ } #Viber subscriber not exists
221
+ }
222
+
223
+ if hub_report_in.key?("msg_status")
224
+ hub_report = hub_report_in
225
+
226
+ 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]] != ""
227
+ report_to_recip.push({
228
+
229
+ "bulkId": "00000000-0000-0000-0000-000000000000",
230
+ "messageId": hub_report[:report][:message_id],
231
+ "to": hub_report[:report][:number],
232
+ # "sentAt": "2020-05-05T20:00:00.000+0000",
233
+ # "doneAt": "2020-05-05T20:00:00.000+0000",
234
+ "status": {
235
+ "groupId": data_for_status[hub_report[:msg_status]][:status_grid],
236
+ "groupName": data_for_status[hub_report[:msg_status]][:status_grname],
237
+ "id": data_for_status[hub_report[:msg_status]][:status_id],
238
+ "name": data_for_status[hub_report[:msg_status]][:status_name],
239
+ "description": data_for_status[hub_report[:msg_status]][:status_descr]
240
+ },
241
+ "error": {
242
+ "groupId": data_for_status[hub_report[:msg_status]][:error_grid],
243
+ "groupName": data_for_status[hub_report[:msg_status]][:error_grname],
244
+ "id": data_for_status[hub_report[:msg_status]][:error_id],
245
+ "name": data_for_status[hub_report[:msg_status]][:error_name],
246
+ "description": data_for_status[hub_report[:msg_status]][:error_descr],
247
+ "permanent": data_for_status[hub_report[:msg_status]][:error_permanent]
248
+ }
249
+ })
220
250
 
221
- 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]] != ""
222
- report_to_recip = {
223
- "results": [
224
- {
225
-
226
- "bulkId": "00000000-0000-0000-0000-000000000000",
227
- "messageId": hub_report[:report][:message_id],
228
- "to": hub_report[:report][:number],
229
- # "sentAt": "2020-05-05T20:00:00.000+0000",
230
- # "doneAt": "2020-05-05T20:00:00.000+0000",
231
- "status": {
232
- "groupId": data_for_status[hub_report[:msg_status]][:status_grid],
233
- "groupName": data_for_status[hub_report[:msg_status]][:status_grname],
234
- "id": data_for_status[hub_report[:msg_status]][:status_id],
235
- "name": data_for_status[hub_report[:msg_status]][:status_name],
236
- "description": data_for_status[hub_report[:msg_status]][:status_descr]
237
- },
238
- "error": {
239
- "groupId": data_for_status[hub_report[:msg_status]][:error_grid],
240
- "groupName": data_for_status[hub_report[:msg_status]][:error_grname],
241
- "id": data_for_status[hub_report[:msg_status]][:error_id],
242
- "name": data_for_status[hub_report[:msg_status]][:error_name],
243
- "description": data_for_status[hub_report[:msg_status]][:error_descr],
244
- "permanent": data_for_status[hub_report[:msg_status]][:error_permanent]
245
- }
246
- }
247
- ]
248
- }
251
+
252
+ else
253
+ report_to_recip["results"].app
254
+
255
+ report_to_recip.push({
256
+
257
+ "bulkId": "00000000-0000-0000-0000-000000000000",
258
+ "messageId": hub_report[:report][:message_id],
259
+ "to": hub_report[:report][:number],
260
+ # "sentAt": "2020-05-05T20:00:00.000+0000",
261
+ # "doneAt": "2020-05-05T20:00:00.000+0000",
262
+ "status": {
263
+ "groupId": 2,
264
+ "groupName": "UNDELIVERABLE_NOT_DELIVERED",
265
+ "id": 9,
266
+ "name": "UNDELIVERED",
267
+ "description": "Unknown error"
268
+ },
269
+ "error": {
270
+ "groupId": 1,
271
+ "groupName": "HANDSET_ERRORS",
272
+ "id": 32,
273
+ "name": "EC_SM_DELIVERY_FAILURE",
274
+ "description": "Unknown error",
275
+ "permanent": false
276
+ }
277
+ })
278
+
279
+ end
249
280
 
250
281
  else
251
282
 
252
- report_to_recip = {
253
- "results": [
254
- {
255
-
256
- "bulkId": "00000000-0000-0000-0000-000000000000",
257
- "messageId": hub_report[:report][:message_id],
258
- "to": hub_report[:report][:number],
259
- # "sentAt": "2020-05-05T20:00:00.000+0000",
260
- # "doneAt": "2020-05-05T20:00:00.000+0000",
261
- "status": {
262
- "groupId": 2,
263
- "groupName": "UNDELIVERABLE_NOT_DELIVERED",
264
- "id": 9,
265
- "name": "UNDELIVERED",
266
- "description": "Unknown error"
267
- },
268
- "error": {
269
- "groupId": 1,
270
- "groupName": "HANDSET_ERRORS",
271
- "id": 32,
272
- "name": "EC_SM_DELIVERY_FAILURE",
273
- "description": "Unknown error",
274
- "permanent": false
275
- }
276
- }
277
- ]
283
+ hub_report_in["_json"].each {|hub_report2|
284
+
285
+ 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]] != ""
286
+ report_to_recip.push({
287
+
288
+ "bulkId": "00000000-0000-0000-0000-000000000000",
289
+ "messageId": hub_report2[:message_id],
290
+ "to": hub_report2[:number],
291
+ # "sentAt": "2020-05-05T20:00:00.000+0000",
292
+ # "doneAt": "2020-05-05T20:00:00.000+0000",
293
+ "status": {
294
+ "groupId": data_for_status[hub_report2[:msg_status]][:status_grid],
295
+ "groupName": data_for_status[hub_report2[:msg_status]][:status_grname],
296
+ "id": data_for_status[hub_report2[:msg_status]][:status_id],
297
+ "name": data_for_status[hub_report2[:msg_status]][:status_name],
298
+ "description": data_for_status[hub_report2[:msg_status]][:status_descr]
299
+ },
300
+ "error": {
301
+ "groupId": data_for_status[hub_report2[:msg_status]][:error_grid],
302
+ "groupName": data_for_status[hub_report2[:msg_status]][:error_grname],
303
+ "id": data_for_status[hub_report2[:msg_status]][:error_id],
304
+ "name": data_for_status[hub_report2[:msg_status]][:error_name],
305
+ "description": data_for_status[hub_report2[:msg_status]][:error_descr],
306
+ "permanent": data_for_status[hub_report2[:msg_status]][:error_permanent]
307
+ }
308
+ })
309
+
310
+
311
+ else
312
+ report_to_recip["results"].app
313
+
314
+ report_to_recip.push({
315
+
316
+ "bulkId": "00000000-0000-0000-0000-000000000000",
317
+ "messageId": hub_report2[:message_id],
318
+ "to": hub_report2[:number],
319
+ # "sentAt": "2020-05-05T20:00:00.000+0000",
320
+ # "doneAt": "2020-05-05T20:00:00.000+0000",
321
+ "status": {
322
+ "groupId": 2,
323
+ "groupName": "UNDELIVERABLE_NOT_DELIVERED",
324
+ "id": 9,
325
+ "name": "UNDELIVERED",
326
+ "description": "Unknown error"
327
+ },
328
+ "error": {
329
+ "groupId": 1,
330
+ "groupName": "HANDSET_ERRORS",
331
+ "id": 32,
332
+ "name": "EC_SM_DELIVERY_FAILURE",
333
+ "description": "Unknown error",
334
+ "permanent": false
335
+ }
336
+ })
337
+ end
338
+
278
339
  }
340
+
279
341
  end
280
- {:code => 200, :result => "Data processed", :body => {:report_to_recip => report_to_recip}}
342
+
343
+ {:code => 200, :result => "Data processed", :body => {:report_to_recip => {"results": report_to_recip}}}
281
344
  end
282
345
 
283
346
  end
@@ -45,25 +45,25 @@ class StateWTTX
45
45
  http = Net::HTTP.new(uri.host, uri.port)
46
46
  response = http.request(Net::HTTP::Get.new(uri.request_uri))
47
47
  p content = response.body
48
- p resultcode = response.to_s.include?("OK")
48
+ p result_code = response.to_s.include?("OK")
49
49
  #Rails.logger = Logger.new(STDOUT)
50
50
  #logger.info "WTTX service getrestCPS result code: #{response.to_s}"
51
51
  #logger.info "WTTX service getrestCPS soap body: #{content.to_s}"
52
52
 
53
53
 
54
54
 
55
- if resultcode == false
55
+ if !result_code
56
56
  "false"
57
57
  else
58
- regimsi = /<field code=\"imsi\" value=\"([0-9]{10,15})\"/
59
- regimei = /<field code=\"imei\" value=\"([0-9]{10,17})\"/
58
+ reg_imsi = /<field code=\"imsi\" value=\"([0-9]{10,15})\"/
59
+ reg_imei = /<field code=\"imei\" value=\"([0-9]{10,17})\"/
60
60
 
61
- m1 = regimsi.match(content)
62
- m2 = regimei.match(content)
61
+ m1 = reg_imsi.match(content)
62
+ m2 = reg_imei.match(content)
63
63
  imsi = m1[1]
64
64
  imei = m2[1]
65
65
 
66
- res = resultcode.to_s + " " + imsi + " " + imei
66
+ res = result_code.to_s + " " + imsi + " " + imei
67
67
  p res
68
68
  res
69
69
  end
@@ -1,4 +1,4 @@
1
1
  module Imperituroard
2
- VERSION = "1.1.10"
2
+ VERSION = "1.1.11"
3
3
  end
4
4
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: imperituroard
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.10
4
+ version: 1.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dzmitry Buynovskiy
@@ -187,7 +187,9 @@ extra_rdoc_files: []
187
187
  files:
188
188
  - ".gitignore"
189
189
  - ".idea/runConfigurations/autovpn.xml"
190
+ - ".idea/runConfigurations/dabrab_proced.xml"
190
191
  - ".idea/runConfigurations/hua_oceanconnect_adapter.xml"
192
+ - ".idea/runConfigurations/test9_dab.xml"
191
193
  - ".idea/runConfigurations/version.xml"
192
194
  - ".ruby-gemset"
193
195
  - ".ruby-version"
@@ -209,6 +211,7 @@ files:
209
211
  - lib/imperituroard/platforms/cps/request_formatter.rb
210
212
  - lib/imperituroard/platforms/iwag/get_iwag_data.rb
211
213
  - lib/imperituroard/platforms/iwag/iwag_database_worker.rb
214
+ - lib/imperituroard/platforms/iwag/iwag_telnet_connector.rb
212
215
  - lib/imperituroard/platforms/public/telegram.rb
213
216
  - lib/imperituroard/platforms/staros/get_data_ssh.rb
214
217
  - lib/imperituroard/platforms/staros/staros_automation.rb