imperituroard 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c7eb357022815af9e5557c552c527afd05085598
4
- data.tar.gz: 11e918ff4c33d5ccb533cde41ef9dc33aaec0b83
3
+ metadata.gz: 031abda94ddb9c334f546e752e5487ef3fbe11c5
4
+ data.tar.gz: 6f06c2ba153d2d24be3ba443cc53dde929e01464
5
5
  SHA512:
6
- metadata.gz: 18d971089a904d1cb2fc40d7c702c9cb293f39562119f98dbc3726151fe72ab372fd69c5142d90124e7377d2524061c3047b0d9ba9b2ce58fb4a615ceade659f
7
- data.tar.gz: 4d825c9af6d2d884840dd609abe8e47f9948e698f3ff5f691afce088a773fd5a713f6740e966a9cb1febfdb776726e604b67bd1573750d97c773af8707b690bf
6
+ metadata.gz: bbbd832d3aa957780397f38b4af5f885328af94c7a7d9e223a7d9e27d4260cbf68127bfb999f8a249d7df29f3bc3e2dfb8cff5e1e93e8512be9a3f65fc5240f0
7
+ data.tar.gz: 29041f775372f52ed01b7c0b5cab8a2b35166e17ee13f64a4e2908a356a163e5306f9897d7050c5c7da3f6779595d1e2caa162f66742b239f1d38b1737d741e3
@@ -20,42 +20,50 @@ class Sksk_1
20
20
  request_message = {}
21
21
 
22
22
  begin
23
- uri = URI(sk_url)
24
- #8 - client id
25
-
26
- https = Net::HTTP.new(uri.host, uri.port)
27
- https.use_ssl=true
28
- https.verify_mode = OpenSSL::SSL::VERIFY_NONE
29
- req = Net::HTTP::Post.new(uri.path, initheader = {:"Content-Type" => 'application/json'})
30
-
31
- req.basic_auth sk_login, sk_password
32
-
33
- request_message = {
34
- "phone_number": msisdn,
35
- "extra_id": "4232j4h89932kjhs",
36
- "callback_url": callback_url,
37
- #"start_time": "2019-08-16 09:59:10",
38
- "tag": "Dabrab_custom_api_1",
39
- "channels": [
40
- "sms"
41
- ],
42
- "channel_options": {
43
- "sms": {
44
- "text": text,
45
- "alpha_name": alphaname,
46
- "ttl": 600
47
- }
48
- }
49
- }
50
-
51
- req.body = request_message.to_json
52
- res = https.request(req)
53
- output_params = {:code => 200,
54
- :result => "Sksk_1.sk_send_sms_one: Request processed",
55
- :body => {:request_message => request_message,
56
- :res_code => res.code,
57
- :res_body => JSON.parse(res.body.to_s)}}
58
- p res.body
23
+
24
+ thr_sk_send_sms_one = Thread.new do
25
+
26
+ uri = URI(sk_url)
27
+ #8 - client id
28
+
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'})
33
+
34
+ req.basic_auth sk_login, sk_password
35
+
36
+ req["Content-Type"] = "application/json"
37
+ req["Accept"] = "application/json"
38
+
39
+ request_message = {
40
+ "phone_number": msisdn,
41
+ "extra_id": "4232j4h89932kjhs",
42
+ "callback_url": callback_url,
43
+ #"start_time": "2019-08-16 09:59:10",
44
+ "tag": "Dabrab_custom_api_1",
45
+ "channels": [
46
+ "sms"
47
+ ],
48
+ "channel_options": {
49
+ "sms": {
50
+ "text": text,
51
+ "alpha_name": alphaname,
52
+ "ttl": 600
53
+ }
54
+ }
55
+ }
56
+
57
+ req.body = request_message.to_json
58
+ res = https.request(req)
59
+ output_params = {:code => 200,
60
+ :result => "Sksk_1.sk_send_sms_one: Request processed",
61
+ :body => {:request_message => request_message,
62
+ :res_code => res.code,
63
+ :res_body => JSON.parse(res.body.to_s)}}
64
+ end
65
+
66
+ thr_sk_send_sms_one.join
59
67
 
60
68
  rescue
61
69
  output_params = {:code => 500, :result => "Sksk_1.sk_send_sms_one: Something wrong", :body => {:request_message => request_message}}
@@ -73,42 +81,53 @@ class Sksk_1
73
81
 
74
82
  begin
75
83
 
76
- uri = URI(sk_url)
77
- #8 - client id
78
-
79
- https = Net::HTTP.new(uri.host, uri.port)
80
- https.use_ssl=true
81
- https.verify_mode = OpenSSL::SSL::VERIFY_NONE
82
- req = Net::HTTP::Post.new(uri.path, initheader = {:"Content-Type" => 'application/json'})
83
-
84
- req.basic_auth sk_login, sk_password
85
-
86
- request_message = {
87
- "phone_number": msisdn,
88
- "extra_id": "4232j4h89932kjhs",
89
- "callback_url": callback_url,
90
- #"start_time": "2019-08-16 09:59:10",
91
- "tag": "Dabrab_custom_api_1",
92
- "channels": [
93
- "viber"
94
- ],
95
- "channel_options": {
96
- "viber": {
97
- "text": text,
98
- "ttl": 60,
99
- # "img": "http://olddogs.org/logo.png",
100
- # "caption": "Old Dogs need you!",
101
- # "action": "http://olddogs.org",
102
- },
103
- }
104
- }
105
- req.body = request_message.to_json
106
- res = https.request(req)
107
- output_params = {:code => 200,
108
- :result => "Sksk_1.sk_send_viber_one: Request processed",
109
- :body => {:request_message => request_message,
110
- :res_code => res.code,
111
- :res_body => JSON.parse(res.body.to_s)}}
84
+ thr_sk_send_viber_one = Thread.new do
85
+
86
+
87
+ uri = URI(sk_url)
88
+ #8 - client id
89
+
90
+ https = Net::HTTP.new(uri.host, uri.port)
91
+ https.use_ssl=true
92
+ https.verify_mode = OpenSSL::SSL::VERIFY_NONE
93
+ req = Net::HTTP::Post.new(uri.path, initheader = {:"Content-Type" => 'application/json'})
94
+
95
+ req.basic_auth sk_login, sk_password
96
+
97
+ req["Content-Type"] = "application/json"
98
+ req["Accept"] = "application/json"
99
+
100
+ request_message = {
101
+ "phone_number": msisdn,
102
+ "extra_id": "4232j4h89932kjhs",
103
+ "callback_url": callback_url,
104
+ #"start_time": "2019-08-16 09:59:10",
105
+ "tag": "Dabrab_custom_api_1",
106
+ "channels": [
107
+ "viber"
108
+ ],
109
+ "channel_options": {
110
+ "viber": {
111
+ "text": text,
112
+ "ttl": 60,
113
+ # "img": "http://olddogs.org/logo.png",
114
+ # "caption": "Old Dogs need you!",
115
+ # "action": "http://olddogs.org",
116
+ },
117
+ }
118
+ }
119
+ req.body = request_message.to_json
120
+ res = https.request(req)
121
+ output_params = {:code => 200,
122
+ :result => "Sksk_1.sk_send_viber_one: Request processed",
123
+ :body => {:request_message => request_message,
124
+ :res_code => res.code,
125
+ :res_body => JSON.parse(res.body.to_s)}}
126
+
127
+ end
128
+
129
+ thr_sk_send_viber_one.join
130
+
112
131
 
113
132
  rescue
114
133
  output_params = {:code => 500, :result => "Sksk_1.sk_send_viber_one: Something wrong"}
@@ -125,50 +144,59 @@ class Sksk_1
125
144
 
126
145
  begin
127
146
 
128
- uri = URI(sk_url)
129
- #8 - client id
130
-
131
- https = Net::HTTP.new(uri.host, uri.port)
132
- https.use_ssl=true
133
- https.verify_mode = OpenSSL::SSL::VERIFY_NONE
134
- req = Net::HTTP::Post.new(uri.path, initheader = {:"Content-Type" => 'application/json'})
135
-
136
- req.basic_auth sk_login, sk_password
137
-
138
- request_message = {
139
- "phone_number": msisdn,
140
- "extra_id": "4232j4h89932kjhs",
141
- "callback_url": callback_url,
142
- #"start_time": "2019-08-16 09:59:10",
143
- "tag": "Dabrab_custom_api_1",
144
- "channels": [
145
- "viber",
146
- "sms"
147
- ],
148
- "channel_options": {
149
- "sms": {
150
- "text": sms_text,
151
- "alpha_name": alphaname,
152
- "ttl": 600
153
- },
154
- "viber": {
155
- "text": viber_txt,
156
- "ttl": 60,
157
- # "img": "http://olddogs.org/logo.png",
158
- # "caption": "Old Dogs need you!",
159
- # "action": "http://olddogs.org",
160
- },
161
- }
162
- }
163
-
164
- req.body = request_message.to_json
165
- res = https.request(req)
166
-
167
- output_params = {:code => 200,
168
- :result => "Sksk_1.sk_send_viber_sms_one: Request processed",
169
- :body => {:request_message => request_message,
170
- :res_code => res.code,
171
- :res_body => JSON.parse(res.body.to_s)}}
147
+ thr_sk_send_viber_sms_one = Thread.new do
148
+
149
+ uri = URI(sk_url)
150
+ #8 - client id
151
+
152
+ https = Net::HTTP.new(uri.host, uri.port)
153
+ https.use_ssl=true
154
+ https.verify_mode = OpenSSL::SSL::VERIFY_NONE
155
+ req = Net::HTTP::Post.new(uri.path, initheader = {:"Content-Type" => 'application/json'})
156
+
157
+ req.basic_auth sk_login, sk_password
158
+
159
+ req["Content-Type"] = "application/json"
160
+ req["Accept"] = "application/json"
161
+
162
+ request_message = {
163
+ "phone_number": msisdn,
164
+ "extra_id": "4232j4h89932kjhs",
165
+ "callback_url": callback_url,
166
+ #"start_time": "2019-08-16 09:59:10",
167
+ "tag": "Dabrab_custom_api_1",
168
+ "channels": [
169
+ "viber",
170
+ "sms"
171
+ ],
172
+ "channel_options": {
173
+ "sms": {
174
+ "text": sms_text,
175
+ "alpha_name": alphaname,
176
+ "ttl": 600
177
+ },
178
+ "viber": {
179
+ "text": viber_txt,
180
+ "ttl": 60,
181
+ # "img": "http://olddogs.org/logo.png",
182
+ # "caption": "Old Dogs need you!",
183
+ # "action": "http://olddogs.org",
184
+ },
185
+ }
186
+ }
187
+
188
+ req.body = request_message.to_json
189
+ res = https.request(req)
190
+
191
+ output_params = {:code => 200,
192
+ :result => "Sksk_1.sk_send_viber_sms_one: Request processed",
193
+ :body => {:request_message => request_message,
194
+ :res_code => res.code,
195
+ :res_body => JSON.parse(res.body.to_s)}}
196
+
197
+ end
198
+
199
+ thr_sk_send_viber_sms_one.join
172
200
 
173
201
  rescue
174
202
  output_params = {:code => 500, :result => "Sksk_1.sk_send_viber_sms_one: Something wrong"}
@@ -186,43 +214,51 @@ class Sksk_1
186
214
  request_message = {}
187
215
 
188
216
  begin
189
- uri = URI(sk_url_broadcast)
190
- #8 - client id
191
-
192
- https = Net::HTTP.new(uri.host, uri.port)
193
- https.use_ssl = true
194
- https.verify_mode = OpenSSL::SSL::VERIFY_NONE
195
- req = Net::HTTP::Post.new(uri.path, initheader = {:"Content-Type" => 'application/json'})
196
-
197
- req.basic_auth sk_login, sk_password
198
-
199
- # [{"phone_number": 375298766719}, {"phone_number": 375295730878}]
200
- request_message = {
201
- "recipients": msisdn_list,
202
- "callback_url": callback_url,
203
- "tag": "Dabrab_custom_api_1",
204
- "channels": [
205
- "sms"
206
- ],
207
- "channel_options": {
208
- "sms": {
209
- "alpha_name": alphaname,
210
- "text": text,
211
- "ttl": 60
212
- }
213
- }
214
- }
215
-
216
- p request_message
217
-
218
- req.body = request_message.to_json
219
- res = https.request(req)
220
-
221
- output_params = {:code => 200,
222
- :result => "Sksk_1.sk_send_sms_list: Request processed",
223
- :body => {:request_message => request_message,
224
- :res_code => res.code,
225
- :res_body => JSON.parse(res.body.to_s)}}
217
+
218
+ thr_sk_send_sms_list = Thread.new do
219
+
220
+ uri = URI(sk_url_broadcast)
221
+ #8 - client id
222
+
223
+ https = Net::HTTP.new(uri.host, uri.port)
224
+ https.use_ssl = true
225
+ https.verify_mode = OpenSSL::SSL::VERIFY_NONE
226
+ req = Net::HTTP::Post.new(uri.path, initheader = {:"Content-Type" => 'application/json'})
227
+
228
+ req.basic_auth sk_login, sk_password
229
+
230
+ req["Content-Type"] = "application/json"
231
+ req["Accept"] = "application/json"
232
+
233
+ # [{"phone_number": 375298766719}, {"phone_number": 375295730878}]
234
+ request_message = {
235
+ "recipients": msisdn_list,
236
+ "callback_url": callback_url,
237
+ "tag": "Dabrab_custom_api_1",
238
+ "channels": [
239
+ "sms"
240
+ ],
241
+ "channel_options": {
242
+ "sms": {
243
+ "alpha_name": alphaname,
244
+ "text": text,
245
+ "ttl": 60
246
+ }
247
+ }
248
+ }
249
+
250
+ req.body = request_message.to_json
251
+ res = https.request(req)
252
+
253
+ output_params = {:code => 200,
254
+ :result => "Sksk_1.sk_send_sms_list: Request processed",
255
+ :body => {:request_message => request_message,
256
+ :res_code => res.code,
257
+ :res_body => JSON.parse(res.body.to_s)}}
258
+
259
+ end
260
+ thr_sk_send_sms_list.join
261
+
226
262
  rescue
227
263
  output_params = {:code => 500, :result => "Sksk_1.sk_send_sms_list: Something wrong"}
228
264
  end
@@ -238,42 +274,48 @@ class Sksk_1
238
274
  request_message = {}
239
275
 
240
276
  begin
241
- uri = URI(sk_url_broadcast)
242
- #8 - client id
243
-
244
- https = Net::HTTP.new(uri.host, uri.port)
245
- https.use_ssl = true
246
- https.verify_mode = OpenSSL::SSL::VERIFY_NONE
247
- req = Net::HTTP::Post.new(uri.path, initheader = {:"Content-Type" => 'application/json'})
248
-
249
- req.basic_auth sk_login, sk_password
250
-
251
- # [{"phone_number": 375298766719}, {"phone_number": 375295730878}]
252
- request_message = {
253
- "recipients": msisdn_list,
254
- "callback_url": callback_url,
255
- "tag": "Dabrab_custom_api_1",
256
- "channels": [
257
- "viber"
258
- ],
259
- "channel_options": {
260
- "viber": {
261
- "text": text,
262
- "ttl": 60
263
- }
264
- }
265
- }
266
-
267
- p request_message
268
-
269
- req.body = request_message.to_json
270
- res = https.request(req)
271
-
272
- output_params = {:code => 200,
273
- :result => "Sksk_1.sk_send_viber_list: Request processed",
274
- :body => {:request_message => request_message,
275
- :res_code => res.code,
276
- :res_body => JSON.parse(res.body.to_s)}}
277
+
278
+ thr_sk_send_viber_list = Thread.new do
279
+ uri = URI(sk_url_broadcast)
280
+ #8 - client id
281
+
282
+ https = Net::HTTP.new(uri.host, uri.port)
283
+ https.use_ssl = true
284
+ https.verify_mode = OpenSSL::SSL::VERIFY_NONE
285
+ req = Net::HTTP::Post.new(uri.path, initheader = {:"Content-Type" => 'application/json'})
286
+
287
+ req["Content-Type"] = "application/json"
288
+ req["Accept"] = "application/json"
289
+
290
+ req.basic_auth sk_login, sk_password
291
+
292
+
293
+ # [{"phone_number": 375298766719}, {"phone_number": 375295730878}]
294
+ request_message = {
295
+ "recipients": msisdn_list,
296
+ "callback_url": callback_url,
297
+ "tag": "Dabrab_custom_api_1",
298
+ "channels": [
299
+ "viber"
300
+ ],
301
+ "channel_options": {
302
+ "viber": {
303
+ "text": text,
304
+ "ttl": 60
305
+ }
306
+ }
307
+ }
308
+
309
+ req.body = request_message.to_json
310
+ res = https.request(req)
311
+
312
+ output_params = {:code => 200,
313
+ :result => "Sksk_1.sk_send_viber_list: Request processed",
314
+ :body => {:request_message => request_message,
315
+ :res_code => res.code,
316
+ :res_body => JSON.parse(res.body.to_s)}}
317
+ end
318
+ thr_sk_send_viber_list.join
277
319
  rescue
278
320
  output_params = {:code => 500, :result => "Sksk_1.sk_send_viber_list: Something wrong"}
279
321
  end
@@ -283,58 +325,60 @@ class Sksk_1
283
325
 
284
326
 
285
327
  def sk_send_viber_sms_list(msisdn_list, callback_url, sms_text, viber_text, alphaname)
286
- p "stat"
287
-
288
328
  input_params = {:msisdn_list => msisdn_list, :callback_url => callback_url, :sms_text => sms_text, :viber_text => viber_text, :alphaname => alphaname}
289
329
  output_params = {}
290
330
  request_message = {}
291
331
 
292
332
  begin
293
- p "hhhh"
294
- uri = URI(sk_url_broadcast)
295
- #8 - client id
296
-
297
-
298
- https = Net::HTTP.new(uri.host, uri.port)
299
- https.use_ssl = true
300
- https.verify_mode = OpenSSL::SSL::VERIFY_NONE
301
- req = Net::HTTP::Post.new(uri.path, initheader = {:"Content-Type" => 'application/json'})
302
-
303
- req.basic_auth sk_login, sk_password
304
-
305
- # [{"phone_number": 375298766719}, {"phone_number": 375295730878}]
306
- request_message = {
307
- "recipients": msisdn_list,
308
- "callback_url": callback_url,
309
- "tag": "Dabrab_custom_api_1",
310
- "channels": [
311
- "viber",
312
- "sms"
313
- ],
314
- "channel_options": {
315
- "sms": {
316
- "alpha_name": alphaname,
317
- "text": sms_text,
318
- "ttl": 60
319
- },
320
- "viber": {
321
- "text": viber_text,
322
- "ttl": 60
323
- }
324
- }
325
- }
326
-
327
-
328
- p request_message
329
-
330
- req.body = request_message.to_json
331
- res = https.request(req)
332
-
333
- output_params = {:code => 200,
334
- :result => "Sksk_1.sk_send_viber_sms_list: Request processed",
335
- :body => {:request_message => request_message,
336
- :res_code => res.code,
337
- :res_body => JSON.parse(res.body.to_s)}}
333
+ thr_sk_send_viber_sms_list = Thread.new do
334
+ uri = URI(sk_url_broadcast)
335
+ #8 - client id
336
+
337
+ https = Net::HTTP.new(uri.host, uri.port)
338
+ https.use_ssl = true
339
+ https.verify_mode = OpenSSL::SSL::VERIFY_NONE
340
+ req = Net::HTTP::Post.new(uri.path, initheader = {:"Content-Type" => 'application/json'})
341
+
342
+ req.basic_auth sk_login, sk_password
343
+
344
+
345
+ req["Content-Type"] = "application/json"
346
+ req["Accept"] = "application/json"
347
+
348
+ # [{"phone_number": 375298766719}, {"phone_number": 375295730878}]
349
+ request_message = {
350
+ "recipients": msisdn_list,
351
+ "callback_url": callback_url,
352
+ "tag": "Dabrab_custom_api_1",
353
+ "channels": [
354
+ "viber",
355
+ "sms"
356
+ ],
357
+ "channel_options": {
358
+ "sms": {
359
+ "alpha_name": alphaname,
360
+ "text": sms_text,
361
+ "ttl": 60
362
+ },
363
+ "viber": {
364
+ "text": viber_text,
365
+ "ttl": 60
366
+ }
367
+ }
368
+ }
369
+
370
+ req.body = request_message.to_json
371
+ res = https.request(req)
372
+
373
+ output_params = {:code => 200,
374
+ :result => "Sksk_1.sk_send_viber_sms_list: Request processed",
375
+ :body => {:request_message => request_message,
376
+ :res_code => res.code,
377
+ :res_body => JSON.parse(res.body.to_s)}}
378
+ end
379
+
380
+ thr_sk_send_viber_sms_list.join
381
+
338
382
  rescue
339
383
  output_params = {:code => 500, :result => "Sksk_1.sk_send_viber_sms_list: Something wrong"}
340
384
  end
@@ -0,0 +1,57 @@
1
+ require 'imperituroard/projects/iot/internal_functions'
2
+
3
+
4
+ class Crm_1
5
+
6
+ attr_accessor :crm_callback_url, :crm_login, :crm_password
7
+
8
+ def initialize(crm_callback_url, crm_login, crm_password)
9
+ @crm_callback_url = crm_callback_url
10
+ @crm_login = crm_login
11
+ @crm_password = crm_password
12
+ @internal_func = InternalFunc.new
13
+ end
14
+
15
+ def crm_status_1(crm_payload)
16
+
17
+ input_params = {:crm_payload => crm_payload}
18
+ output_params = {}
19
+ request_message = {}
20
+
21
+ begin
22
+
23
+ thr_crm_status_1 = Thread.new do
24
+ uri = URI(crm_callback_url)
25
+ #8 - client id
26
+
27
+ https = Net::HTTP.new(uri.host, uri.port)
28
+ https.use_ssl = true
29
+ https.verify_mode = OpenSSL::SSL::VERIFY_NONE
30
+ req = Net::HTTP::Post.new(uri.path, initheader = {:"Content-Type" => 'application/json'})
31
+
32
+ req.basic_auth crm_login, crm_password
33
+
34
+ req["Content-Type"] = "application/json"
35
+ req["Accept"] = "application/json"
36
+
37
+ req.body = crm_payload.to_json
38
+ res = https.request(req)
39
+ output_params = {:code => 200,
40
+ :result => "Crm_1.crm_status_1: Request processed",
41
+ :body => {:request_message => crm_payload,
42
+ :res_code => res.code,
43
+ :res_body => JSON.parse(res.body.to_s)}}
44
+ p res.body
45
+ end
46
+ thr_crm_status_1.join
47
+
48
+ rescue
49
+ output_params = {:code => 500, :result => "Crm_1.crm_status_1: Something wrong", :body => {:request_message => request_message}}
50
+ end
51
+ internal_func.printer_texter({:input => input_params, :output => output_params, :procedure => "Crm_1.crm_status_1"}, "debug")
52
+ output_params
53
+
54
+ end
55
+
56
+
57
+ end
@@ -49,21 +49,56 @@ end
49
49
  p hub_answer
50
50
 
51
51
  for a in hub_answer[:body][:res_body]["messages"]
52
- s1 = {"to": a["phone_number"], "status": {"groupId": 1,
52
+ s1 = {"to": {"phoneNumber": a["phone_number"]}, "status": {"groupId": 1,
53
53
  "groupName": "PENDING",
54
54
  "id": 26,
55
55
  "name": "MESSAGE_ACCEPTED",
56
56
  "description": "Message sent to next instance"},
57
57
  "messageId": a["message_id"]}
58
+
58
59
  messages_sect.append(s1)
59
60
  end
60
61
 
61
62
  p messages_sect
62
63
 
63
- mess_to_recip = {"messages": messages_sect}
64
-
64
+ mess_to_recip = {"bulkId": "00000000-0000-0000-0000-000000000000", "messages": messages_sect}
65
65
  {:code => 200, :result => "Data processed", :body => {:mess_to_recip => mess_to_recip}}
66
+ end
67
+
68
+
69
+
70
+ def delivery_report_transform(hub_report)
71
+ #{"number"=>"375297116638", "time"=>1588673492000, "status"=>2, "substatus"=>23, "msg_status"=>23033, "message_id"=>"486649ba-a573-4ee9-8f58-018ed20ca6fd", "extra_id"=>"444/0/ServiceModel/ScGetReports.svc/GetReports", "sent_via"=>"viber", "controller"=>"reports", "action"=>"delivery", "report"=>{"number"=>"375297116638", "time"=>1588673492000, "status"=>2, "substatus"=>23, "msg_status"=>23033, "message_id"=>"486649ba-a573-4ee9-8f58-018ed20ca6fd", "extra_id"=>"444/0/ServiceModel/ScGetReports.svc/GetReports", "sent_via"=>"viber"}}
72
+
73
+ report_to_recip = {
74
+ "results": [
75
+ {
76
+
77
+ # "bulkId": "9a410cb0-091e-41cf-a640-5d37bee14d9a",
78
+ "messageId": hub_report["report"]["message_id"],
79
+ "to": hub_report["report"]["number"],
80
+ # "sentAt": "2020-05-05T20:00:00.000+0000",
81
+ # "doneAt": "2020-05-05T20:00:00.000+0000",
82
+ "status": {
83
+ "groupId": 3,
84
+ "groupName": "DELIVERED",
85
+ "id": 5,
86
+ "name": "DELIVERED_TO_HANDSET",
87
+ "description": "Message delivered to handset"
88
+ },
89
+ "error": {
90
+ "groupId": 0,
91
+ "groupName": "Ok",
92
+ "id": 0,
93
+ "name": "NO_ERROR",
94
+ "description": "No Error",
95
+ "permanent": false
96
+ }
97
+ }
98
+ ]
99
+ }
66
100
 
101
+ {:code => 200, :result => "Data processed", :body => {:report_to_recip => report_to_recip}}
67
102
  end
68
103
 
69
104
  end
@@ -1,3 +1,3 @@
1
1
  module Imperituroard
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end
data/lib/imperituroard.rb CHANGED
@@ -800,9 +800,16 @@ end
800
800
 
801
801
  class Mhub_2
802
802
 
803
- attr_accessor :sk_url, :sk_login, :sk_password, :mhub_connector, :internal_func, :dabrab_connecter, :static_callback
804
-
805
- def initialize(sk_url_simple, sk_login, sk_password, telegram_api_url, telegram_chat_id, sk_url_broadcast, static_callback)
803
+ attr_accessor :sk_url,
804
+ :sk_login,
805
+ :sk_password,
806
+ :mhub_connector,
807
+ :internal_func,
808
+ :dabrab_connecter,
809
+ :static_callback,
810
+ :crm_connector
811
+
812
+ 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)
806
813
  @sk_url = sk_url_simple
807
814
  @sk_login = sk_login
808
815
  @sk_password = sk_password
@@ -812,6 +819,7 @@ class Mhub_2
812
819
  @dabrab_connecter = Dabrab.new
813
820
  @add_functions_connector = AdditionalFunc.new(telegram_api_url, telegram_chat_id)
814
821
  @static_callback = static_callback
822
+ @crm_connector = Crm_1.new(crm_callback_url, crm_login, crm_password)
815
823
  end
816
824
 
817
825
 
@@ -896,6 +904,31 @@ class Mhub_2
896
904
  end
897
905
 
898
906
 
907
+ def recieve_delivery_report(params, ip_src, ip_real, ip_vip)
908
+ input_params = {:params => params, :ip_src => ip_src, :ip_real => ip_real, :ip_vip => ip_vip}
909
+ output_params = {}
910
+ hub_resp = {}
911
+ null_statement = [nil, "nil", "", "null"]
912
+
913
+ begin
914
+
915
+
916
+ mes_report = dabrab_connecter.delivery_report_transform(params)[:body][:report_to_recip]
917
+
918
+ result = crm_connector.crm_status_1(mes_report)
919
+
920
+ 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}}}
921
+
922
+ rescue
923
+ output_params = {"code": 500, "result": "Unknown SDK error", "body": {"answer": {}, "sender": {"ip_src": ip_src, "ip_real": ip_real, "ip_vip": ip_vip}}}
924
+ end
925
+
926
+ internal_func.printer_texter({:input => input_params, :output => output_params, :hub_resp => hub_resp, :procedure => "Mhub_2.recieve_delivery_report"}, "debug")
927
+ output_params
928
+
929
+ end
930
+
931
+
899
932
  def test2
900
933
  hh = Infobip_1.new
901
934
  hh.test
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: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dzmitry Buynovskiy
@@ -167,6 +167,7 @@ files:
167
167
  - lib/imperituroard/projects/iot/mongoconnector.rb
168
168
  - lib/imperituroard/projects/mhub/infobip.rb
169
169
  - lib/imperituroard/projects/mhub/sk.rb
170
+ - lib/imperituroard/projects/mhub/subs/dabrab/dabrab_platform.rb
170
171
  - lib/imperituroard/projects/mhub/subs/dabrab/dabrab_proced.rb
171
172
  - lib/imperituroard/projects/wttx/updatepostcps.rb
172
173
  - lib/imperituroard/version.rb