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 +4 -4
- data/lib/imperituroard/projects/mhub/sk.rb +280 -236
- data/lib/imperituroard/projects/mhub/subs/dabrab/dabrab_platform.rb +57 -0
- data/lib/imperituroard/projects/mhub/subs/dabrab/dabrab_proced.rb +38 -3
- data/lib/imperituroard/version.rb +1 -1
- data/lib/imperituroard.rb +36 -3
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 031abda94ddb9c334f546e752e5487ef3fbe11c5
|
4
|
+
data.tar.gz: 6f06c2ba153d2d24be3ba443cc53dde929e01464
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
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
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
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
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
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
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
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
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
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
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
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
|
data/lib/imperituroard.rb
CHANGED
@@ -800,9 +800,16 @@ end
|
|
800
800
|
|
801
801
|
class Mhub_2
|
802
802
|
|
803
|
-
attr_accessor :sk_url,
|
804
|
-
|
805
|
-
|
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.
|
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
|