imperituroard 1.1.13 → 1.1.14

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: f18b3b415b4abd99d7278bc85a36e106b4c7cd06
4
- data.tar.gz: 1836cbde25b99638c57951d554e162177593bc6e
3
+ metadata.gz: 43b90b49ef287bd5255675f8687a9fb6cc036f85
4
+ data.tar.gz: 3e97f122233aa15acaaf07a6bd25b1bc98af1d69
5
5
  SHA512:
6
- metadata.gz: 5d295fb8baa99e0c2a69009432af9bd7ce079826d335e1dbec712eaa997d27b86ac8bfbf5d9d625a78bc5ac5b4bc83a9b866076039dba45b9791f1a3a739e411
7
- data.tar.gz: 6f849cca851ed66cf4fe2c63bc3fd724066f086aef44a6fd744868b3431dccbc78ee67542eac4ced9189f23fe750b76bf120dd8f558d97a7cd83777070031a70
6
+ metadata.gz: 17e89a0109c1f6d8821a39e7e1a8572cf0d8fe3c6795120d3000a2242f6a9e1987bfa6b920d2a8b7b72bd39d74e8d08ec85ca1a2098844231ccaf7f1d3b6e51c
7
+ data.tar.gz: bacdd4a4e1f59f9530daede8cc142672d044fc16a04f8ed5d3a329e4c25007911f39b8b90ee828710743b17da5785473a3cec9f9bd3868d65a0a65c9a1e57152
@@ -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)
@@ -345,8 +345,8 @@ class Mhub_2
345
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
- 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)
@@ -183,14 +183,14 @@ class MhubFunctions_2
183
183
 
184
184
 
185
185
  #for bank dabrabyt
186
- def rec_deliv_report_2(params, ip_src, ip_real, ip_vip)
186
+ def rec_deliv_report_2(params, ip_src, ip_real, ip_vip, crm_slice_num=2)
187
187
  input_params = {:params => params, :ip_src => ip_src, :ip_real => ip_real, :ip_vip => ip_vip}
188
188
  output_params = {}
189
189
  hub_resp = {}
190
190
 
191
191
  begin
192
192
  mes_report = dabrab_connecter.delivery_report_transform(params)[:body][:report_to_recip]
193
- result = crm_connector.crm_status_2(mes_report)
193
+ result = crm_connector.crm_status_2(mes_report, crm_slice_num)
194
194
  if result[:body][:res_body]["GetReportsResult"]==""
195
195
  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
196
  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
 
@@ -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 => JSON.parse(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,5 +1,14 @@
1
+ require 'imperituroard/projects/iot/internal_functions'
2
+
1
3
  class Dabrab
2
4
 
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
+
3
12
  def dabrabyt_text_field_parse(stri)
4
13
  button_url = ""
5
14
  image = ""
@@ -192,6 +201,8 @@ class Dabrab
192
201
 
193
202
  def delivery_report_transform(hub_report_in)
194
203
 
204
+ internal_func.printer_texter({:input => "Start delivery_report_transform", :procedure => "Dabrab.delivery_report_transform"}, log_level)
205
+
195
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"}}
196
207
  #p hub_report
197
208
  #p "hub_report"
@@ -221,7 +232,9 @@ class Dabrab
221
232
  } #Viber subscriber not exists
222
233
  }
223
234
 
224
- if hub_report_in.key?("msg_status")
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
+
225
238
  hub_report = hub_report_in
226
239
 
227
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"]] != ""
@@ -283,6 +296,11 @@ class Dabrab
283
296
 
284
297
  hub_report_in["_json"].each {|hub_report2|
285
298
 
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
+
286
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"]] != ""
287
305
  report_to_recip.push({
288
306
 
@@ -1,4 +1,4 @@
1
1
  module Imperituroard
2
- VERSION = "1.1.13"
2
+ VERSION = "1.1.14"
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.13
4
+ version: 1.1.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dzmitry Buynovskiy