imperituroard 1.1.11 → 1.1.17

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: 28a8ed8a7d0e3e2896f7c67a7d63911c82e4c263
4
- data.tar.gz: df3d6c2b96ac564a4feee8e9df5ac6c884b46187
3
+ metadata.gz: 015a5d3136b3e47eab433636dd7b9e0fc4b70fdb
4
+ data.tar.gz: 90d1189ffd4fdcb5a2458dda0752d5e0b10342c7
5
5
  SHA512:
6
- metadata.gz: 65ae8bf70ab9db28066ac1b566612d975ec165b4fa34b2fb58fb3bb7ec50defe7c5192fa0d88ff3a89f3d5d7022be8a81c0965e2638a2ffb77810a13c9759e57
7
- data.tar.gz: 85e98458692adc97a666e40c7b26287f9e1985011d3d81acf57a8f5fb7ce4df19c2430727d85cf78bdd1f450b90f43506f56e42124c87353455ea13c7ddedca9
6
+ metadata.gz: e55cf9eafb144b4426c61ef65f72d715b8240195af65b173ec09d350a6dead6bff75a9487d8e519ff2ed7dd68047ebffa91f29c54595c37cf03cdd9e7be6a995
7
+ data.tar.gz: 6df5079662a650f243107f6bc4a22da04054097f4211c514833c349ace9d4312cec8c2c9df9b3f13f7b3f76f03c61ecdf4e074c81e349361a44cef246a32f233
@@ -322,7 +322,7 @@ class Mhub_2
322
322
  @internal_func = InternalFunc.new
323
323
  @mhub_connector = Sksk_2.new(sk_url_simple, sk_login, sk_password, sk_url_broadcast, telegram_api_url, telegram_chat_id, log_level)
324
324
  @internal_func = InternalFunc.new
325
- @dabrab_connecter = Dabrab.new
325
+ @dabrab_connecter = Dabrab.new(log_level)
326
326
  @static_callback = static_callback
327
327
  @crm_connector = Crm_2.new(crm_callback_url, crm_login, crm_password, telegram_api_url, telegram_chat_id, log_level)
328
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)
@@ -341,12 +341,12 @@ 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, 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)
344
+ def get_send_message_mass(params, ip_src, ip_real, ip_vip, slice_number=100, time_pause_minutes=5, viberttl=60, params_manual_set=0, smsttl=60)
345
+ mhub_connector.get_send_message_mass_2(params, ip_src, ip_real, ip_vip, slice_number, time_pause_minutes, viberttl, params_manual_set, smsttl)
346
346
  end
347
347
 
348
- def recieve_delivery_report(params, ip_src, ip_real, ip_vip)
349
- mhub_connector.rec_deliv_report_2(params, ip_src, ip_real, ip_vip)
348
+ def recieve_delivery_report(params, ip_src, ip_real, ip_vip, crm_slice_num)
349
+ mhub_connector.rec_deliv_report_2(params, ip_src, ip_real, ip_vip, crm_slice_num)
350
350
  end
351
351
 
352
352
  end
@@ -35,7 +35,7 @@ class MhubFunctions_2
35
35
  @internal_func = InternalFunc.new
36
36
  @mhub_connector = Sksk_2.new(sk_url_simple, sk_login, sk_password, sk_url_broadcast, telegram_api_url, telegram_chat_id, log_level)
37
37
  @internal_func = InternalFunc.new
38
- @dabrab_connecter = Dabrab.new
38
+ @dabrab_connecter = Dabrab.new(log_level)
39
39
  @telegram_connector = Telegram_2.new(telegram_api_url, telegram_chat_id)
40
40
  @static_callback = static_callback
41
41
  @crm_connector = Crm_2.new(crm_callback_url, crm_login, crm_password, telegram_api_url, telegram_chat_id, log_level)
@@ -129,7 +129,16 @@ class MhubFunctions_2
129
129
 
130
130
 
131
131
  #for bank dabrabyt for massive nums
132
- def get_send_message_mass_2(params, ip_src, ip_real, ip_vip, slice_number, time_pause_minutes)
132
+ def get_send_message_mass_2(params,
133
+ ip_src,
134
+ ip_real,
135
+ ip_vip,
136
+ slice_number,
137
+ time_pause_minutes,
138
+ viberttl,
139
+ params_manual_set,
140
+ smsttl
141
+ )
133
142
 
134
143
  input_params = {:params => params}
135
144
  output_params = {}
@@ -148,12 +157,29 @@ class MhubFunctions_2
148
157
 
149
158
  hub_resp = {}
150
159
 
151
- if null_statement.include?(params["viber"]) && !null_statement.include?(params["sms"])
152
- hub_resp = mhub_connector.sk_send_sms_list(part_list, static_callback, params["sms"]["text"], sms_alphaname, time_pause_minutes)
153
- elsif !null_statement.include?(params["viber"]) && null_statement.include?(params["sms"])
154
- hub_resp = mhub_connector.sk_send_viber_list(part_list, static_callback, params["viber"]["text"], time_pause_minutes)
155
- elsif !null_statement.include?(params["viber"]) && !null_statement.include?(params["sms"])
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)
160
+
161
+ viber_param = params["viber"]
162
+ sms_param = params["sms"]
163
+
164
+ if params_manual_set != 0
165
+ begin
166
+ if params_manual_set[:viber] == 0
167
+ viber_param = nil
168
+ end
169
+ if params_manual_set[:sms] == 0
170
+ sms_param = nil
171
+ end
172
+ rescue
173
+ nil
174
+ end
175
+ end
176
+
177
+ if null_statement.include?(viber_param) && !null_statement.include?(sms_param)
178
+ hub_resp = mhub_connector.sk_send_sms_list(part_list, static_callback, params["sms"]["text"], sms_alphaname, time_pause_minutes, smsttl)
179
+ elsif !null_statement.include?(viber_param) && null_statement.include?(sms_param)
180
+ hub_resp = mhub_connector.sk_send_viber_list(part_list, static_callback, params["viber"]["text"], time_pause_minutes, viberttl)
181
+ elsif !null_statement.include?(viber_param) && !null_statement.include?(sms_param)
182
+ hub_resp = mhub_connector.sk_send_viber_sms_list(part_list, static_callback, params["sms"]["text"], params["viber"]["text"], sms_alphaname, time_pause_minutes, viberttl, smsttl)
157
183
  else
158
184
  output_params = {"code": 502, "result": "Invalid input data st2", "body": {"answer": {}, "sender": {"ip_src": ip_src, "ip_real": ip_real, "ip_vip": ip_vip}}}
159
185
  end
@@ -183,14 +209,14 @@ class MhubFunctions_2
183
209
 
184
210
 
185
211
  #for bank dabrabyt
186
- def rec_deliv_report_2(params, ip_src, ip_real, ip_vip)
212
+ def rec_deliv_report_2(params, ip_src, ip_real, ip_vip, crm_slice_num=2)
187
213
  input_params = {:params => params, :ip_src => ip_src, :ip_real => ip_real, :ip_vip => ip_vip}
188
214
  output_params = {}
189
215
  hub_resp = {}
190
216
 
191
217
  begin
192
218
  mes_report = dabrab_connecter.delivery_report_transform(params)[:body][:report_to_recip]
193
- result = crm_connector.crm_status_2(mes_report)
219
+ result = crm_connector.crm_status_2(mes_report, crm_slice_num)
194
220
  if result[:body][:res_body]["GetReportsResult"]==""
195
221
  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}}}
196
222
  else
@@ -14,7 +14,7 @@ class Sksk_2
14
14
  @internal_func = InternalFunc.new
15
15
  @sk_url_broadcast = sk_url_broadcast
16
16
  @telegram_connector = Telegram_2.new(telegram_api_url, telegram_chat_id)
17
- @dabrab_add_func = Dabrab.new
17
+ @dabrab_add_func = Dabrab.new(log_level)
18
18
  end
19
19
 
20
20
 
@@ -148,7 +148,7 @@ class Sksk_2
148
148
  output_params
149
149
  end
150
150
 
151
- def sk_send_viber_sms_one(msisdn, callback_url, sms_text, viber_txt, alphaname)
151
+ def sk_send_viber_sms_one(msisdn, callback_url, sms_text, viber_txt, alphaname, smsttl=600)
152
152
 
153
153
  input_params = {:msisdn => msisdn, :callback_url => callback_url, :sms_text => sms_text, :viber_txt => viber_txt, :alphaname => alphaname}
154
154
  output_params = {}
@@ -188,7 +188,7 @@ class Sksk_2
188
188
  "sms": {
189
189
  "text": sms_text,
190
190
  "alpha_name": alphaname,
191
- "ttl": 600
191
+ "ttl": smsttl
192
192
  },
193
193
  "viber": viber_mess_ans[:body][:to_sk_format]
194
194
  }
@@ -220,7 +220,7 @@ class Sksk_2
220
220
  end
221
221
 
222
222
 
223
- def sk_send_sms_list(msisdn_list, callback_url, text, alphaname, time_pause_minutes=1)
223
+ def sk_send_sms_list(msisdn_list, callback_url, text, alphaname, time_pause_minutes=1, smsttl)
224
224
 
225
225
  input_params = {:msisdn_list => msisdn_list, :callback_url => callback_url, :text => text, :alphaname => alphaname}
226
226
  output_params = {}
@@ -256,7 +256,7 @@ class Sksk_2
256
256
  "sms": {
257
257
  "alpha_name": alphaname,
258
258
  "text": text,
259
- "ttl": 60
259
+ "ttl": smsttl
260
260
  }
261
261
  }
262
262
  }
@@ -282,7 +282,10 @@ class Sksk_2
282
282
  end
283
283
 
284
284
 
285
- def sk_send_viber_list(msisdn_list, callback_url, text, time_pause_minutes)
285
+ def sk_send_viber_list(msisdn_list, callback_url, text, time_pause_minutes, viberttl)
286
+
287
+ internal_func.printer_texter({:input => "Fun started", :output => {}, :procedure => "Sksk_2.sk_send_viber_list"}, log_level)
288
+
286
289
 
287
290
  input_params = {:msisdn_list => msisdn_list, :callback_url => callback_url, :text => text}
288
291
  output_params = {}
@@ -292,7 +295,7 @@ class Sksk_2
292
295
 
293
296
  thr_sk_send_viber_list = Thread.new do
294
297
 
295
- viber_mess_ans = dabrab_add_func.dabrabyt_text_field_parse(text)
298
+ viber_mess_ans = dabrab_add_func.dabrabyt_text_field_parse(text, viberttl)
296
299
 
297
300
  if viber_mess_ans[:code] == 200
298
301
  uri = URI(sk_url_broadcast)
@@ -346,7 +349,7 @@ class Sksk_2
346
349
  end
347
350
 
348
351
 
349
- def sk_send_viber_sms_list(msisdn_list, callback_url, sms_text, viber_text, alphaname, time_pause_minutes)
352
+ def sk_send_viber_sms_list(msisdn_list, callback_url, sms_text, viber_text, alphaname, time_pause_minutes, viberttl, smsttl)
350
353
  input_params = {:msisdn_list => msisdn_list, :callback_url => callback_url, :sms_text => sms_text, :viber_text => viber_text, :alphaname => alphaname}
351
354
  output_params = {}
352
355
  request_message = {}
@@ -355,7 +358,7 @@ class Sksk_2
355
358
  thr_sk_send_viber_sms_list = Thread.new do
356
359
 
357
360
 
358
- viber_mess_ans = dabrab_add_func.dabrabyt_text_field_parse(viber_text)
361
+ viber_mess_ans = dabrab_add_func.dabrabyt_text_field_parse(viber_text, viberttl)
359
362
 
360
363
  if viber_mess_ans[:code] == 200
361
364
 
@@ -388,7 +391,7 @@ class Sksk_2
388
391
  "sms": {
389
392
  "alpha_name": alphaname,
390
393
  "text": sms_text,
391
- "ttl": 60
394
+ "ttl": smsttl
392
395
  },
393
396
  "viber": viber_mess_ans[:body][:to_sk_format]
394
397
  }
@@ -14,7 +14,7 @@ class Crm_2
14
14
  @telegram_connector = Telegram_2.new(telegram_api_url, telegram_chat_id)
15
15
  end
16
16
 
17
- def crm_status_2(crm_payload)
17
+ def crm_status_2(crm_payload, slice_num)
18
18
 
19
19
  input_params = {:crm_payload => crm_payload}
20
20
  output_params = {}
@@ -22,29 +22,50 @@ class Crm_2
22
22
 
23
23
  begin
24
24
 
25
+ internal_func.printer_texter({:input => "Start process", :procedure => "Crm_2.crm_status_2"}, log_level)
26
+
27
+
25
28
  thr_crm_status_2 = Thread.new do
26
- uri = URI(crm_callback_url)
27
- #8 - client id
28
29
 
29
- https = Net::HTTP.new(uri.host, uri.port)
30
- https.use_ssl = true
31
- https.verify_mode = OpenSSL::SSL::VERIFY_NONE
32
- req = Net::HTTP::Post.new(uri.path, initheader = {:"Content-Type" => 'application/json'})
30
+ partnnn = crm_payload[:results].each_slice(slice_num).to_a
31
+
32
+ partnnn.each { |one_part_reports|
33
+
34
+ crm_payload2 = {:results => one_part_reports }
35
+
36
+
37
+ uri = URI(crm_callback_url)
38
+ #8 - client id
39
+
40
+ https = Net::HTTP.new(uri.host, uri.port)
41
+ https.use_ssl = true
42
+ https.verify_mode = OpenSSL::SSL::VERIFY_NONE
43
+ req = Net::HTTP::Post.new(uri.path, initheader = {:"Content-Type" => 'application/json'})
44
+
45
+ req.basic_auth crm_login, crm_password
46
+
47
+ req["Content-Type"] = "application/json"
48
+ req["Accept"] = "application/json"
49
+
50
+ internal_func.printer_texter({:input => {:crm_payload2 => crm_payload2}, :procedure => "Crm_2.crm_status_2"}, log_level)
51
+
52
+
53
+ req.body = crm_payload2.to_json
33
54
 
34
- req.basic_auth crm_login, crm_password
55
+ internal_func.printer_texter({:input => "Before send request to crm", :procedure => "Crm_2.crm_status_2"}, log_level)
35
56
 
36
- req["Content-Type"] = "application/json"
37
- req["Accept"] = "application/json"
57
+ res = https.request(req)
38
58
 
39
- req.body = crm_payload.to_json
40
- res = https.request(req)
59
+ internal_func.printer_texter({:input => "After send request to crm", :procedure => "Crm_2.crm_status_2"}, log_level)
60
+ internal_func.printer_texter({:input => {:res_code => res.code, :res_body => res.body.to_s}, :procedure => "Crm_2.crm_status_2"}, log_level)
41
61
 
62
+ }
42
63
 
43
64
  output_params = {:code => 200,
44
65
  :result => "Crm_2.crm_status_2: Request processed",
45
66
  :body => {:request_message => crm_payload,
46
- :res_code => res.code,
47
- :res_body => JSON.parse(res.body.to_s)}}
67
+ :res_code => "200",
68
+ :res_body => ""}}
48
69
  #p res.body
49
70
  end
50
71
  thr_crm_status_2.join
@@ -1,6 +1,15 @@
1
+ require 'imperituroard/projects/iot/internal_functions'
2
+
1
3
  class Dabrab
2
4
 
3
- def dabrabyt_text_field_parse(stri)
5
+ attr_accessor :internal_func, :log_level
6
+
7
+ def initialize(log_level)
8
+ @internal_func = InternalFunc.new
9
+ @log_level = log_level
10
+ end
11
+
12
+ def dabrabyt_text_field_parse(stri, viberttl)
4
13
  button_url = ""
5
14
  image = ""
6
15
  button_text = ""
@@ -92,13 +101,13 @@ class Dabrab
92
101
 
93
102
  case scheme
94
103
  when 0
95
- sk_format = {"text": text, "ttl": 60}
104
+ sk_format = {"text": text, "ttl": viberttl}
96
105
  when 1
97
- sk_format = {"text": text, "ttl": 60, "caption": button_text, "action": button_url}
106
+ sk_format = {"text": text, "ttl": viberttl, "caption": button_text, "action": button_url}
98
107
  when 2
99
- sk_format = {"text": text, "ttl": 60, "caption": button_text, "action": button_url, "img": image}
108
+ sk_format = {"text": text, "ttl": viberttl, "caption": button_text, "action": button_url, "img": image}
100
109
  when 3
101
- sk_format = {"img": image, "ttl": 60}
110
+ sk_format = {"img": image, "ttl": viberttl}
102
111
  else
103
112
  nil
104
113
  end
@@ -191,72 +200,77 @@ class Dabrab
191
200
 
192
201
 
193
202
  def delivery_report_transform(hub_report_in)
203
+
204
+ internal_func.printer_texter({:input => "Start delivery_report_transform", :procedure => "Dabrab.delivery_report_transform"}, log_level)
205
+
194
206
  #{"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
207
  #p hub_report
196
208
  #p "hub_report"
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")
209
+ report_to_recip = []
210
+
211
+ data_for_status = {
212
+ 23011 => {:status_id => 5, :status_grid => 3, :status_grname => "DELIVERED", :status_name => "DELIVERED_TO_HANDSET", :status_descr => "Message delivered by SMS",
213
+ :error_id => 0, :error_grid => 0, :error_grname => "Ok", :error_name => "NO_ERROR", :error_descr => "No Error", :error_permanent => false
214
+ },
215
+ 23033 => {:status_id => 5, :status_grid => 3, :status_grname => "DELIVERED", :status_name => "DELIVERED_TO_HANDSET", :status_descr => "Message delivered by Viber",
216
+ :error_id => 0, :error_grid => 0, :error_grname => "Ok", :error_name => "NO_ERROR", :error_descr => "No Error", :error_permanent => false
217
+ },
218
+ 35015 => {:status_id => 15, :status_grid => 4, :status_grname => "EXPIRED", :status_name => "EXPIRED_EXPIRED", :status_descr => "SMS Message TTL EXPIRED",
219
+ :error_id => 6, :error_grid => 1, :error_grname => "HANDSET_ERRORS", :error_name => "EC_ABSENT_SUBSCRIBER_SM", :error_descr => "Subscriber is absent", :error_permanent => false
220
+ }, #message SMS expired
221
+ 36463 => {:status_id => 15, :status_grid => 4, :status_grname => "EXPIRED", :status_name => "EXPIRED_EXPIRED", :status_descr => "Viber Message TTL EXPIRED",
222
+ :error_id => 6, :error_grid => 1, :error_grname => "HANDSET_ERRORS", :error_name => "EC_ABSENT_SUBSCRIBER_SM", :error_descr => "Subscriber is absent.", :error_permanent => false
223
+ }, #message Viber expired
224
+ 36010 => {:status_id => 4, :status_grid => 2, :status_grname => "UNDELIVERABLE", :status_name => "UNDELIVERABLE_REJECTED_OPERATOR", :status_descr => "SMS. Subscriber not exists",
225
+ :error_id => 6, :error_grid => 1, :error_grname => "HANDSET_ERRORS", :error_name => "EC_UNKNOWN_SUBSCRIBER", :error_descr => "Subscriber not found.", :error_permanent => true
226
+ }, #SMS subscriber not exists
227
+ 36131 => {:status_id => 4, :status_grid => 2, :status_grname => "UNDELIVERABLE", :status_name => "UNDELIVERABLE_REJECTED_OPERATOR", :status_descr => "SMS. Unknown subscriber",
228
+ :error_id => 6, :error_grid => 1, :error_grname => "HANDSET_ERRORS", :error_name => "EC_UNKNOWN_SUBSCRIBER", :error_descr => "Subscriber not found.", :error_permanent => true
229
+ }, #SMS unknown subscriber
230
+ 36505 => {:status_id => 4, :status_grid => 2, :status_grname => "UNDELIVERABLE", :status_name => "UNDELIVERABLE_REJECTED_OPERATOR", :status_descr => "Viber. Subscriber not exists",
231
+ :error_id => 6, :error_grid => 1, :error_grname => "HANDSET_ERRORS", :error_name => "EC_UNKNOWN_SUBSCRIBER", :error_descr => "Subscriber not found.", :error_permanent => true
232
+ } #Viber subscriber not exists
233
+ }
234
+
235
+ if hub_report_in.key?("msg_status") && !hub_report_in.key?("_json") && !hub_report_in["report"].key?("_json")
236
+ internal_func.printer_texter({:input => "One message delivery_report_transform", :procedure => "Dabrab.delivery_report_transform"}, log_level)
237
+
224
238
  hub_report = hub_report_in
225
239
 
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]] != ""
240
+ 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"]] != ""
241
+
227
242
  report_to_recip.push({
228
243
 
229
244
  "bulkId": "00000000-0000-0000-0000-000000000000",
230
- "messageId": hub_report[:report][:message_id],
231
- "to": hub_report[:report][:number],
245
+ "messageId": hub_report["report"]["message_id"],
246
+ "to": hub_report["report"]["number"],
232
247
  # "sentAt": "2020-05-05T20:00:00.000+0000",
233
248
  # "doneAt": "2020-05-05T20:00:00.000+0000",
234
249
  "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]
250
+ "groupId": data_for_status[hub_report["msg_status"]][:status_grid],
251
+ "groupName": data_for_status[hub_report["msg_status"]][:status_grname],
252
+ "id": data_for_status[hub_report["msg_status"]][:status_id],
253
+ "name": data_for_status[hub_report["msg_status"]][:status_name],
254
+ "description": data_for_status[hub_report["msg_status"]][:status_descr]
240
255
  },
241
256
  "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]
257
+ "groupId": data_for_status[hub_report["msg_status"]][:error_grid],
258
+ "groupName": data_for_status[hub_report["msg_status"]][:error_grname],
259
+ "id": data_for_status[hub_report["msg_status"]][:error_id],
260
+ "name": data_for_status[hub_report["msg_status"]][:error_name],
261
+ "description": data_for_status[hub_report["msg_status"]][:error_descr],
262
+ "permanent": data_for_status[hub_report["msg_status"]][:error_permanent]
248
263
  }
249
264
  })
250
265
 
251
266
 
252
267
  else
253
- report_to_recip["results"].app
254
268
 
255
269
  report_to_recip.push({
256
270
 
257
271
  "bulkId": "00000000-0000-0000-0000-000000000000",
258
- "messageId": hub_report[:report][:message_id],
259
- "to": hub_report[:report][:number],
272
+ "messageId": hub_report["report"]["message_id"],
273
+ "to": hub_report["report"]["number"],
260
274
  # "sentAt": "2020-05-05T20:00:00.000+0000",
261
275
  # "doneAt": "2020-05-05T20:00:00.000+0000",
262
276
  "status": {
@@ -282,40 +296,44 @@ class Dabrab
282
296
 
283
297
  hub_report_in["_json"].each {|hub_report2|
284
298
 
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]] != ""
299
+ internal_func.printer_texter({:input => "Start Mass message delivery_report_transform", :procedure => "Dabrab.delivery_report_transform"}, log_level)
300
+
301
+ internal_func.printer_texter({:input => {:hub_report2 => hub_report2}, :procedure => "Dabrab.delivery_report_transform"}, log_level)
302
+
303
+
304
+ if data_for_status[hub_report2["msg_status"]] != nil && data_for_status[hub_report2["msg_status"]] != {} && data_for_status[hub_report2["msg_status"]] != [] && data_for_status[hub_report2["msg_status"]] != ""
286
305
  report_to_recip.push({
287
306
 
288
307
  "bulkId": "00000000-0000-0000-0000-000000000000",
289
- "messageId": hub_report2[:message_id],
290
- "to": hub_report2[:number],
308
+ "messageId": hub_report2["message_id"],
309
+ "to": hub_report2["number"],
291
310
  # "sentAt": "2020-05-05T20:00:00.000+0000",
292
311
  # "doneAt": "2020-05-05T20:00:00.000+0000",
293
312
  "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]
313
+ "groupId": data_for_status[hub_report2["msg_status"]][:status_grid],
314
+ "groupName": data_for_status[hub_report2["msg_status"]][:status_grname],
315
+ "id": data_for_status[hub_report2["msg_status"]][:status_id],
316
+ "name": data_for_status[hub_report2["msg_status"]][:status_name],
317
+ "description": data_for_status[hub_report2["msg_status"]][:status_descr]
299
318
  },
300
319
  "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]
320
+ "groupId": data_for_status[hub_report2["msg_status"]][:error_grid],
321
+ "groupName": data_for_status[hub_report2["msg_status"]][:error_grname],
322
+ "id": data_for_status[hub_report2["msg_status"]][:error_id],
323
+ "name": data_for_status[hub_report2["msg_status"]][:error_name],
324
+ "description": data_for_status[hub_report2["msg_status"]][:error_descr],
325
+ "permanent": data_for_status[hub_report2["msg_status"]][:error_permanent]
307
326
  }
308
327
  })
309
328
 
310
329
 
311
330
  else
312
- report_to_recip["results"].app
313
331
 
314
332
  report_to_recip.push({
315
333
 
316
334
  "bulkId": "00000000-0000-0000-0000-000000000000",
317
- "messageId": hub_report2[:message_id],
318
- "to": hub_report2[:number],
335
+ "messageId": hub_report2["message_id"],
336
+ "to": hub_report2["number"],
319
337
  # "sentAt": "2020-05-05T20:00:00.000+0000",
320
338
  # "doneAt": "2020-05-05T20:00:00.000+0000",
321
339
  "status": {
@@ -337,7 +355,6 @@ class Dabrab
337
355
  end
338
356
 
339
357
  }
340
-
341
358
  end
342
359
 
343
360
  {:code => 200, :result => "Data processed", :body => {:report_to_recip => {"results": report_to_recip}}}
@@ -1,4 +1,4 @@
1
1
  module Imperituroard
2
- VERSION = "1.1.11"
2
+ VERSION = "1.1.17"
3
3
  end
4
4
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: imperituroard
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.11
4
+ version: 1.1.17
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-19 00:00:00.000000000 Z
11
+ date: 2020-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler