imperituroard 1.1.12 → 1.1.18

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
@@ -192,36 +201,40 @@ 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"
198
209
  report_to_recip = []
199
210
 
200
- data_for_status = {
201
- 23011 => {:status_id => 5, :status_grid => 3, :status_grname => "DELIVERED", :status_name => "DELIVERED_TO_HANDSET", :status_descr => "Message delivered by SMS",
202
- :error_id => 0, :error_grid => 0, :error_grname => "Ok", :error_name => "NO_ERROR", :error_descr => "No Error", :error_permanent => false
203
- },
204
- 23033 => {:status_id => 5, :status_grid => 3, :status_grname => "DELIVERED", :status_name => "DELIVERED_TO_HANDSET", :status_descr => "Message delivered by Viber",
205
- :error_id => 0, :error_grid => 0, :error_grname => "Ok", :error_name => "NO_ERROR", :error_descr => "No Error", :error_permanent => false
206
- },
207
- 35015 => {:status_id => 15, :status_grid => 4, :status_grname => "EXPIRED", :status_name => "EXPIRED_EXPIRED", :status_descr => "SMS 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 SMS expired
210
- 36463 => {:status_id => 15, :status_grid => 4, :status_grname => "EXPIRED", :status_name => "EXPIRED_EXPIRED", :status_descr => "Viber Message TTL EXPIRED",
211
- :error_id => 6, :error_grid => 1, :error_grname => "HANDSET_ERRORS", :error_name => "EC_ABSENT_SUBSCRIBER_SM", :error_descr => "Subscriber is absent.", :error_permanent => false
212
- }, #message Viber expired
213
- 36010 => {:status_id => 4, :status_grid => 2, :status_grname => "UNDELIVERABLE", :status_name => "UNDELIVERABLE_REJECTED_OPERATOR", :status_descr => "SMS. Subscriber not exists",
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 subscriber not exists
216
- 36131 => {:status_id => 4, :status_grid => 2, :status_grname => "UNDELIVERABLE", :status_name => "UNDELIVERABLE_REJECTED_OPERATOR", :status_descr => "SMS. Unknown subscriber",
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
- }, #SMS unknown subscriber
219
- 36505 => {:status_id => 4, :status_grid => 2, :status_grname => "UNDELIVERABLE", :status_name => "UNDELIVERABLE_REJECTED_OPERATOR", :status_descr => "Viber. Subscriber not exists",
220
- :error_id => 6, :error_grid => 1, :error_grname => "HANDSET_ERRORS", :error_name => "EC_UNKNOWN_SUBSCRIBER", :error_descr => "Subscriber not found.", :error_permanent => true
221
- } #Viber subscriber not exists
222
- }
223
-
224
- if hub_report_in.key?("msg_status")
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
+
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,7 +296,12 @@ class Dabrab
283
296
 
284
297
  hub_report_in["_json"].each {|hub_report2|
285
298
 
286
- 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"]] != ""
287
305
  report_to_recip.push({
288
306
 
289
307
  "bulkId": "00000000-0000-0000-0000-000000000000",
@@ -310,6 +328,7 @@ class Dabrab
310
328
 
311
329
 
312
330
  else
331
+
313
332
  report_to_recip.push({
314
333
 
315
334
  "bulkId": "00000000-0000-0000-0000-000000000000",
@@ -334,6 +353,7 @@ class Dabrab
334
353
  }
335
354
  })
336
355
  end
356
+
337
357
  }
338
358
  end
339
359
 
@@ -0,0 +1,187 @@
1
+ require 'imperituroard/platforms/cps/qps_connector'
2
+ require 'imperituroard/platforms/cps/cps_mongo_connector'
3
+
4
+ class Kosmonavty_2
5
+ attr_accessor :file_of_changed_prof,
6
+ :qps_connector,
7
+ :cps_mongo,
8
+ :filename_processed_added,
9
+ :logfile,
10
+ :filename_failed_add,
11
+ :logfile_return,
12
+ :filename_processed_return,
13
+ :filename_failed_return
14
+
15
+ def initialize(file_of_changed_prof)
16
+ @file_of_changed_prof = file_of_changed_prof
17
+ @qps_connector = Qps_2.new('http://172.24.220.65:8080/ua/wsdl/UnifiedApi.wsdl', 'http://172.24.220.65:8080/ua/soap', 'http://broadhop.com/unifiedapi/soap/types')
18
+ @cps_mongo = MongoCPS_2.new('site1-ca-pri-sessionmgr01', '27720', 'spr')
19
+
20
+ @filename_processed_added = 'testfile.txt'
21
+ @filename_processed_return = 'testfile_return.txt'
22
+ @logfile = 'day60log.txt'
23
+ @logfile_return = 'day60log_return.txt'
24
+ @filename_failed_add = 'testfile_failed.txt'
25
+ @filename_failed_return = 'testfile_failed_return.txt'
26
+ end
27
+
28
+ def write_to_file_rewr(new_text)
29
+ File.open(file_of_changed_prof + filename_processed_added, 'w') {|file| file.write(new_text)}
30
+ end
31
+
32
+ def add_line_to_file(new_line, filename)
33
+ File.open(file_of_changed_prof + filename, 'a') do |file|
34
+ line = new_line + "\n"
35
+ file.write line
36
+ end
37
+ end
38
+
39
+ def get_msisdn_from_file
40
+ begin
41
+ file = File.open(file_of_changed_prof + filename_processed_added)
42
+ file_data = file.read
43
+ output = []
44
+ splitted_lines = file_data.split("\n")
45
+ splitted_lines.each do |aaa|
46
+ if aaa != '' && aaa != "\n" && aaa.include?(';')
47
+ msssisdn = aaa.split(';')
48
+ output.push(msssisdn[0])
49
+ end
50
+ end
51
+ return output
52
+ rescue
53
+ return []
54
+ end
55
+ end
56
+
57
+ def get_msisdn_from_file_for_del
58
+ begin
59
+ file = File.open(file_of_changed_prof + filename_processed_added)
60
+ file_data = file.read
61
+ output = []
62
+ splitted_lines = file_data.split("\n")
63
+ splitted_lines.each do |aaa|
64
+ if aaa != '' && aaa != "\n" && aaa.include?(';')
65
+ msssisdn = aaa.split(';')
66
+ output.push({:msisdn => msssisdn[0], :devId => msssisdn[1]})
67
+ end
68
+ end
69
+ return output
70
+ rescue
71
+ return []
72
+ end
73
+ end
74
+
75
+ def main_processor_add_acl
76
+ process_json = {}
77
+ process_msisdn_list = []
78
+
79
+ #dat_cps = cps_mongo.get_minsk_fttx_fizlic
80
+ dat_cps = cps_mongo.get_minsk_fttx_zone2
81
+
82
+ dat_cps.each do |t|
83
+ gg = t.split(';')
84
+ process_json[gg[0]] = gg[1]
85
+ process_msisdn_list.push(gg[0])
86
+ end
87
+
88
+ from_file = get_msisdn_from_file
89
+ list_for_process = process_msisdn_list - from_file
90
+ uniq_list_for_proc = list_for_process.uniq
91
+
92
+ uniq_list_for_proc.each do |ddd|
93
+ ans = qps_connector.add_avp_acl(ddd, 'GTFU_IN')
94
+ #ans = {:change_subscriber_avps_response => {:error_code => '0'}}
95
+ begin
96
+ if ans[:change_subscriber_avps_response][:error_code] == '0'
97
+ add_line_to_file(ddd + ';' + process_json[ddd], filename_processed_added)
98
+ resp = qps_connector.stop_session_username(process_json[ddd])
99
+ add_line_to_file(ddd + ';' + process_json[ddd] + 'stop_session: ' + resp.to_s, logfile)
100
+ else
101
+ add_line_to_file(ddd + ';' + process_json[ddd], filename_failed_add)
102
+ add_line_to_file(ddd + ';' + process_json[ddd] + 'add_avps: ' + ans.to_s, logfile)
103
+ end
104
+ rescue
105
+ add_line_to_file(ddd + ';' + process_json[ddd], filename_failed_add)
106
+ add_line_to_file(ddd + ';' + process_json[ddd] + 'add_avps: ' + ans.to_s, logfile)
107
+ end
108
+ end
109
+ end
110
+
111
+ def main_processor_del_acl
112
+ from_file = get_msisdn_from_file_for_del
113
+
114
+ from_file.each do |ddd1|
115
+ ans = qps_connector.delete_avp_acl(ddd1[:msisdn])
116
+ if ans[:change_subscriber_avps_response][:error_code] == '0'
117
+ add_line_to_file(ddd1.to_s, filename_processed_return)
118
+ resp = qps_connector.stop_session_username(ddd1[:devId])
119
+ add_line_to_file(ddd1.to_s + ';' + ddd1[:devId] + 'stop_session: ' + resp.to_s, logfile_return)
120
+ else
121
+ add_line_to_file(ddd1.to_s, filename_failed_return)
122
+ add_line_to_file(ddd1.to_s + ';' + ddd1[:devId] + 'del_avp: ' + ans.to_s, logfile_return)
123
+ end
124
+ end
125
+ end
126
+
127
+ def test
128
+ qps_connector.stop_session_username('Ethernet1/0/7:1907.0 Min_Rokossovskogo_145_5/0/0/1/0/7')
129
+ end
130
+
131
+ def test_mongo
132
+
133
+ dat_cps = cps_mongo.get_minsk_fttx_zone2
134
+ dat_cps2 = cps_mongo.get_minsk_fttx_zone3_rokos
135
+ dat_cps3 = cps_mongo.get_minsk_fttx_zone4_mega
136
+ dat_cps4 = cps_mongo.get_minsk_fttx_zone5_koles
137
+ dat_cps5 = cps_mongo.get_minsk_fttx_zone6_all
138
+ dat_cps7 = cps_mongo.get_minsk_fttx_zone7_3last
139
+
140
+ #1
141
+ p "get_minsk_fttx_zone2"
142
+ p dat_cps
143
+ p dat_cps.length
144
+
145
+ #2
146
+ p "get_minsk_fttx_zone3_rokos"
147
+ p dat_cps2
148
+ p dat_cps2.length
149
+
150
+
151
+ #3
152
+ p "get_minsk_fttx_zone4_mega"
153
+ p dat_cps3
154
+ p dat_cps3.length
155
+
156
+
157
+ #4
158
+ p "get_minsk_fttx_zone5_koles"
159
+ p dat_cps4
160
+ p dat_cps4.length
161
+
162
+ #5
163
+ p "get_minsk_fttx_zone6_all"
164
+ p dat_cps5
165
+ p dat_cps5.length
166
+
167
+
168
+ p "get_minsk_fttx_zone7_3last"
169
+ p dat_cps7
170
+ p dat_cps7.length
171
+
172
+ end
173
+
174
+ end
175
+
176
+
177
+ #p test.delete_avp_acl("375298766719")
178
+ #p test.add_avp_acl("375298766719", "ffgfg2")
179
+
180
+ #test2 = Kosmonavty_2.new('/Users/imperituroard/Desktop/')
181
+
182
+ #test2.main_processor_add_acl
183
+
184
+ #test2.main_processor_del_acl
185
+
186
+ #test2.test_mongo
187
+
@@ -74,13 +74,14 @@ class Belgim_2
74
74
  elem = elem.gsub(" ", "")
75
75
  end
76
76
 
77
- if elem.match(/а|б|в|г|д|е|ж|ё|Ё|з|и|й|к|л|м|н|о|п|р|с|т|у|ф|х|ц|ч|ш|щ|ь|ы|ъ|э|ю|я|А|Б|В|Г|Д|Е|Ж|З|И|Й|К|Л|М|Н|О|П|Р|С|Т|У|Ф|Х|Ц|Ч|Ш|Щ|Ь|Ы|Ъ|Э|Ю|Я/)
77
+ #if elem.match(/а|б|в|г|д|е|ж|ё|Ё|з|и|й|к|л|м|н|о|п|р|с|т|у|ф|х|ц|ч|ш|щ|ь|ы|ъ|э|ю|я|А|Б|В|Г|Д|Е|Ж|З|И|Й|К|Л|М|Н|О|П|Р|С|Т|У|Ф|Х|Ц|Ч|Ш|Щ|Ь|Ы|Ъ|Э|Ю|Я/)
78
+ if elem.match(/[а-яА-ЯЁё]/)
78
79
  elem = SimpleIDN.to_ascii(elem)
79
80
  end
80
81
 
81
82
  if elem != "-" && elem != ""
82
83
  domain_parsed.push(elem)
83
- if_www = elem[0]+elem[1]+elem[2]+elem[3]
84
+ if_www = elem[0] + elem[1] + elem[2] + elem[3]
84
85
 
85
86
  #if not contain www - add domain with www
86
87
  if if_www != "www."
@@ -76,36 +76,38 @@ class AddFuncUkaz60_2
76
76
  if !processed_domain_in_url.include? "/"
77
77
  #it is domain. Process domain
78
78
  #if it is kirillica then process
79
- if processed_domain_in_url.match(/а|б|в|г|д|е|ж|ё|Ё|з|и|й|к|л|м|н|о|п|р|с|т|у|ф|х|ц|ч|ш|щ|ь|ы|ъ|э|ю|я|А|Б|В|Г|Д|Е|Ж|З|И|Й|К|Л|М|Н|О|П|Р|С|Т|У|Ф|Х|Ц|Ч|Ш|Щ|Ь|Ы|Ъ|Э|Ю|Я/)
79
+ #if processed_domain_in_url.match(/а|б|в|г|д|е|ж|ё|Ё|з|и|й|к|л|м|н|о|п|р|с|т|у|ф|х|ц|ч|ш|щ|ь|ы|ъ|э|ю|я|А|Б|В|Г|Д|Е|Ж|З|И|Й|К|Л|М|Н|О|П|Р|С|Т|У|Ф|Х|Ц|Ч|Ш|Щ|Ь|Ы|Ъ|Э|Ю|Я/)
80
+ if processed_domain_in_url.match(/[а-яА-ЯЁё]/)
80
81
  processed_domain_in_url = SimpleIDN.to_ascii(processed_domain_in_url)
81
82
  end
82
83
  domain_only = domain_only + processed_domain_in_url
83
- type = "domain"
84
+ type = 'domain'
84
85
  else
85
86
  #it is url. process url
86
- hh = processed_domain_in_url.split("/")
87
+ hh = processed_domain_in_url.split('/')
87
88
  domain_only = hh[0]
88
- if domain_only.match(/а|б|в|г|д|е|ж|ё|Ё|з|и|й|к|л|м|н|о|п|р|с|т|у|ф|х|ц|ч|ш|щ|ь|ы|ъ|э|ю|я|А|Б|В|Г|Д|Е|Ж|З|И|Й|К|Л|М|Н|О|П|Р|С|Т|У|Ф|Х|Ц|Ч|Ш|Щ|Ь|Ы|Ъ|Э|Ю|Я/)
89
+ #if domain_only.match(/а|б|в|г|д|е|ж|ё|Ё|з|и|й|к|л|м|н|о|п|р|с|т|у|ф|х|ц|ч|ш|щ|ь|ы|ъ|э|ю|я|А|Б|В|Г|Д|Е|Ж|З|И|Й|К|Л|М|Н|О|П|Р|С|Т|У|Ф|Х|Ц|Ч|Ш|Щ|Ь|Ы|Ъ|Э|Ю|Я/)
90
+ if domain_only.match(/[а-яА-ЯЁё]/)
89
91
  hh[0] = SimpleIDN.to_ascii(domain_only)
90
- processed_domain_in_url = ""
92
+ processed_domain_in_url = ''
91
93
  for t in hh
92
- processed_domain_in_url = processed_domain_in_url + t + "/"
94
+ processed_domain_in_url = processed_domain_in_url + t + '/'
93
95
  end
94
96
  sss1len = processed_domain_in_url.size
95
97
  processed_domain_in_url = processed_domain_in_url[0..sss1len-2]
96
98
  end
97
- type = "url"
99
+ type = 'url'
98
100
  end
99
101
  else
100
- type = "empty"
102
+ type = 'empty'
101
103
  end
102
- output_answer = {:code => 200, :result => "Request processed", :ishodnye_dannye => stroka, :first_url => first_url, :processed_domain_in_url => processed_domain_in_url, :domain_only => domain_only, :protocol => protocol, :type => type}
104
+ output_answer = {:code => 200, :result => 'Request processed', :ishodnye_dannye => stroka, :first_url => first_url, :processed_domain_in_url => processed_domain_in_url, :domain_only => domain_only, :protocol => protocol, :type => type}
103
105
 
104
106
  else
105
- output_answer = {:code => 202, :result => "Data not found"}
107
+ output_answer = {:code => 202, :result => 'Data not found'}
106
108
  end
107
109
  rescue
108
- output_answer = {:code => 507, :result => "Something wrong"}
110
+ output_answer = {:code => 507, :result => 'Something wrong'}
109
111
  end
110
112
  output_answer
111
113
  end
@@ -132,12 +134,12 @@ class AddFuncUkaz60_2
132
134
  #result_out.push({aaa[0] => "Ok"})
133
135
  num_ok = num_ok + 1
134
136
  else
135
- result_out[aaa[0]] = "Failed"
137
+ result_out[aaa[0]] = 'Failed'
136
138
  #result_out.push({aaa[0] => "Failed"})
137
139
  num_failed = num_failed + 1
138
140
  end
139
141
  rescue
140
- result_out["unknown"] = aaa.to_s
142
+ result_out['unknown'] = aaa.to_s
141
143
  #result_out.push({"unknown" => aaa.to_s})
142
144
  num_failed = num_failed + 1
143
145
  end