Class: MongoCPS_2
- Inherits:
-
Object
- Object
- MongoCPS_2
- Defined in:
- lib/imperituroard/platforms/cps/cps_mongo_connector.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
-
#internal_func ⇒ Object
Returns the value of attribute internal_func.
-
#mongo_database ⇒ Object
Returns the value of attribute mongo_database.
-
#mongo_ip ⇒ Object
Returns the value of attribute mongo_ip.
-
#mongo_port ⇒ Object
Returns the value of attribute mongo_port.
-
#subs_collection ⇒ Object
Returns the value of attribute subs_collection.
Instance Method Summary collapse
- #get_minsk_fttx_fizlic ⇒ Object
- #get_minsk_fttx_zone2 ⇒ Object
- #get_minsk_fttx_zone3_rokos ⇒ Object
- #get_minsk_fttx_zone4_mega ⇒ Object
- #get_minsk_fttx_zone5_koles ⇒ Object
- #get_minsk_fttx_zone6_all ⇒ Object
- #get_minsk_fttx_zone7_3last ⇒ Object
-
#initialize(mongo_ip, mongo_port, mongo_database) ⇒ MongoCPS_2
constructor
A new instance of MongoCPS_2.
- #test ⇒ Object
Constructor Details
#initialize(mongo_ip, mongo_port, mongo_database) ⇒ MongoCPS_2
Returns a new instance of MongoCPS_2.
7 8 9 10 11 12 13 14 |
# File 'lib/imperituroard/platforms/cps/cps_mongo_connector.rb', line 7 def initialize(mongo_ip, mongo_port, mongo_database) @mongo_database = mongo_database @mongo_ip = mongo_ip @mongo_port = mongo_port client_host = [mongo_ip + ":" + mongo_port] @client = Mongo::Client.new(client_host, :database => mongo_database, :server_selection_timeout => 5) @subs_collection = client[:subscriber] end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
5 6 7 |
# File 'lib/imperituroard/platforms/cps/cps_mongo_connector.rb', line 5 def client @client end |
#internal_func ⇒ Object
Returns the value of attribute internal_func.
5 6 7 |
# File 'lib/imperituroard/platforms/cps/cps_mongo_connector.rb', line 5 def internal_func @internal_func end |
#mongo_database ⇒ Object
Returns the value of attribute mongo_database.
5 6 7 |
# File 'lib/imperituroard/platforms/cps/cps_mongo_connector.rb', line 5 def mongo_database @mongo_database end |
#mongo_ip ⇒ Object
Returns the value of attribute mongo_ip.
5 6 7 |
# File 'lib/imperituroard/platforms/cps/cps_mongo_connector.rb', line 5 def mongo_ip @mongo_ip end |
#mongo_port ⇒ Object
Returns the value of attribute mongo_port.
5 6 7 |
# File 'lib/imperituroard/platforms/cps/cps_mongo_connector.rb', line 5 def mongo_port @mongo_port end |
#subs_collection ⇒ Object
Returns the value of attribute subs_collection.
5 6 7 |
# File 'lib/imperituroard/platforms/cps/cps_mongo_connector.rb', line 5 def subs_collection @subs_collection end |
Instance Method Details
#get_minsk_fttx_fizlic ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/imperituroard/platforms/cps/cps_mongo_connector.rb', line 16 def get_minsk_fttx_fizlic answ_res_msisdn = [] req_json = {"$and": [{"avps_key.code_key": {"$not": /IN-ACL/}}, {"credentials_key.network_id_key": {"$in": [/ Min/, /Minsk/]}}, {"$or": [{"services_key.code_key": "FR12083"}, {"services_key.code_key": "FR7967"}, {"services_key.code_key": "FR7241"}, {"services_key.code_key": "FR7242"}, {"services_key.code_key": "FR7243"}, {"services_key.code_key": "FR7244"}, {"services_key.code_key": "FR9749"}, {"services_key.code_key": "FR9750"}, {"services_key.code_key": "FR9751"}, {"services_key.code_key": "FR9752"}, {"services_key.code_key": "FR11885"}, {"services_key.code_key": "FR14994"}, {"services_key.code_key": "FR15506"}, {"services_key.code_key": "FR17303"}, {"services_key.code_key": "FR11484"}]}, {"credentials_key.network_id_key": {"$not": /375\d+VL/}}]} subs_collection.find(req_json).each {|row| msisdn = "" username = "" row['credentials_key'].each {|cred| if cred['network_id_key'][/37500\d{7}/] msisdn = cred['network_id_key'] else username = cred['network_id_key'] end } if msisdn != '' && username != '' answ_res_msisdn.push(msisdn + ';' + username) end } answ_res_msisdn end |
#get_minsk_fttx_zone2 ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 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 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/imperituroard/platforms/cps/cps_mongo_connector.rb', line 37 def get_minsk_fttx_zone2 answ_res_msisdn = [] req_json = {'$and': [{'avps_key.code_key': {'$not': /IN-ACL/}}, {'credentials_key.network_id_key': {'$in': [/Min_Nezavisimosti_164/, /Min_Nezavisimosti_181/, /Min_Nezavisimosti_183/, /Min_Nezavisimosti_185/, /Min_Nezavisimosti_42/, /Min_Nezavisimosti_40/, /Min_Nezavisimosti_60/, /Min_Nezavisimosti_44/, /Min_Nezavisimosti_52/, /Min_Nezavisimosti_46/, /Min_Nezavisimosti_48/, /Min_Surganova_52/, /Min_Surganova_64/, /Min_Surganova_76/, /Min_Bogdanovicha_108/, /Min_Bogdanovicha_116/, /Min_Bogdanovicha_114/, /Min_Prityckogo_160/, /Min_Kropotkina_47/, /Storozhevskaya_8/, /Min_Kozlova_2/, /Min_Kozlova_4/, /Min_Kozlova_6/, /Min_Kozlova_5/, /Min_Kozlova_7/, /Min_Kozlova_9/, /Min_Bjaduli_3/, /Min_Bjaduli_5/, /Min_Bjaduli_6/, /Min_Bjaduli_8/, /Min_Bjaduli_12/, /Min_Pervomajskaja_15/, /Min_Pervomajskaja_17/, /Min_Zaharova_19/, /Min_Zaharova_23/, /Min_Zaharova_25/, /Min_Zaharova_27/, /Min_Zaharova_29/, /Min_Zaharova_33/, /Min_Bronevoj_12/, /Min_Bronevoj_13/, /Min_Vojskovoj_10/, /Min_Vojskovoj_13/, /Min_Vojskovoj_14/, /Min_Vojskovoj_15/, /Min_Rumjanceva_13/, /Min_Rumjanceva_14/, /Min_Rumjanceva_15/, /Min_Rumjanceva_17/]}}, {'$or': [{'services_key.code_key': 'FR12083'}, {'services_key.code_key': 'FR7967'}, {'services_key.code_key': 'FR7241'}, {'services_key.code_key': 'FR7242'}, {'services_key.code_key': 'FR7243'}, {'services_key.code_key': 'FR7244'}, {'services_key.code_key': 'FR9749'}, {'services_key.code_key': 'FR9750'}, {'services_key.code_key': 'FR9751'}, {'services_key.code_key': 'FR9752'}, {'services_key.code_key': 'FR11885'}, {'services_key.code_key': 'FR14994'}, {'services_key.code_key': 'FR15506'}, {'services_key.code_key': 'FR17303'}, {'services_key.code_key': 'FR11484'}]}, {'credentials_key.network_id_key': {'$not': /375\d+VL/}}]} subs_collection.find(req_json).each {|row| msisdn = '' username = '' row['credentials_key'].each {|cred| if cred['network_id_key'][/37500\d{7}/] msisdn = cred['network_id_key'] else username = cred['network_id_key'] end } if msisdn != '' && username != '' answ_res_msisdn.push(msisdn + ';' + username) end } answ_res_msisdn end |
#get_minsk_fttx_zone3_rokos ⇒ Object
127 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 |
# File 'lib/imperituroard/platforms/cps/cps_mongo_connector.rb', line 127 def get_minsk_fttx_zone3_rokos answ_res_msisdn = [] req_json = {'$and': [{'avps_key.code_key': {'$not': /IN-ACL/}}, {'credentials_key.network_id_key': {'$in': [/Rokossovskogo_81/]}}, {'$or': [{'services_key.code_key': 'FR12083'}, {'services_key.code_key': 'FR7967'}, {'services_key.code_key': 'FR7241'}, {'services_key.code_key': 'FR7242'}, {'services_key.code_key': 'FR7243'}, {'services_key.code_key': 'FR7244'}, {'services_key.code_key': 'FR9749'}, {'services_key.code_key': 'FR9750'}, {'services_key.code_key': 'FR9751'}, {'services_key.code_key': 'FR9752'}, {'services_key.code_key': 'FR11885'}, {'services_key.code_key': 'FR14994'}, {'services_key.code_key': 'FR15506'}, {'services_key.code_key': 'FR17303'}, {'services_key.code_key': 'FR11484'}]}, {'credentials_key.network_id_key': {'$not': /375\d+VL/}}]} subs_collection.find(req_json).each {|row| msisdn = '' username = '' row['credentials_key'].each {|cred| if cred['network_id_key'][/37500\d{7}/] msisdn = cred['network_id_key'] else username = cred['network_id_key'] end } if msisdn != '' && username != '' answ_res_msisdn.push(msisdn + ';' + username) end } answ_res_msisdn end |
#get_minsk_fttx_zone4_mega ⇒ Object
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 |
# File 'lib/imperituroard/platforms/cps/cps_mongo_connector.rb', line 168 def get_minsk_fttx_zone4_mega answ_res_msisdn = [] req_json = {'$and': [{'avps_key.code_key': {'$not': /IN-ACL/}}, {'credentials_key.network_id_key': {'$in': [/Min_Dzerzhinskogo_131/]}}, {'$or': [{'services_key.code_key': 'FR12083'}, {'services_key.code_key': 'FR7967'}, {'services_key.code_key': 'FR7241'}, {'services_key.code_key': 'FR7242'}, {'services_key.code_key': 'FR7243'}, {'services_key.code_key': 'FR7244'}, {'services_key.code_key': 'FR9749'}, {'services_key.code_key': 'FR9750'}, {'services_key.code_key': 'FR9751'}, {'services_key.code_key': 'FR9752'}, {'services_key.code_key': 'FR11885'}, {'services_key.code_key': 'FR14994'}, {'services_key.code_key': 'FR15506'}, {'services_key.code_key': 'FR17303'}, {'services_key.code_key': 'FR11484'}]}, {'credentials_key.network_id_key': {'$not': /375\d+VL/}}]} subs_collection.find(req_json).each {|row| msisdn = '' username = '' row['credentials_key'].each {|cred| if cred['network_id_key'][/37500\d{7}/] msisdn = cred['network_id_key'] else username = cred['network_id_key'] end } if msisdn != '' && username != '' answ_res_msisdn.push(msisdn + ';' + username) end } answ_res_msisdn end |
#get_minsk_fttx_zone5_koles ⇒ Object
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 |
# File 'lib/imperituroard/platforms/cps/cps_mongo_connector.rb', line 209 def get_minsk_fttx_zone5_koles answ_res_msisdn = [] req_json = {'$and': [{'avps_key.code_key': {'$not': /IN-ACL/}}, {'credentials_key.network_id_key': {'$in': [/Min_Kolesnikova_16/, /Min_Kolesnikova_20/]}}, {'$or': [{'services_key.code_key': 'FR12083'}, {'services_key.code_key': 'FR7967'}, {'services_key.code_key': 'FR7241'}, {'services_key.code_key': 'FR7242'}, {'services_key.code_key': 'FR7243'}, {'services_key.code_key': 'FR7244'}, {'services_key.code_key': 'FR9749'}, {'services_key.code_key': 'FR9750'}, {'services_key.code_key': 'FR9751'}, {'services_key.code_key': 'FR9752'}, {'services_key.code_key': 'FR11885'}, {'services_key.code_key': 'FR14994'}, {'services_key.code_key': 'FR15506'}, {'services_key.code_key': 'FR17303'}, {'services_key.code_key': 'FR11484'}]}, {'credentials_key.network_id_key': {'$not': /375\d+VL/}}]} subs_collection.find(req_json).each {|row| msisdn = '' username = '' row['credentials_key'].each {|cred| if cred['network_id_key'][/37500\d{7}/] msisdn = cred['network_id_key'] else username = cred['network_id_key'] end } if msisdn != '' && username != '' answ_res_msisdn.push(msisdn + ';' + username) end } answ_res_msisdn end |
#get_minsk_fttx_zone6_all ⇒ Object
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 279 280 281 282 283 284 285 286 287 288 289 290 291 292 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 338 339 340 341 |
# File 'lib/imperituroard/platforms/cps/cps_mongo_connector.rb', line 251 def get_minsk_fttx_zone6_all answ_res_msisdn = [] req_json = {'$and': [{'avps_key.code_key': {'$not': /IN-ACL/}}, {'credentials_key.network_id_key': {'$in': [/Min_Nezavisimosti_164/, /Min_Nezavisimosti_181/, /Min_Nezavisimosti_183/, /Min_Nezavisimosti_185/, /Min_Nezavisimosti_42/, /Min_Nezavisimosti_40/, /Min_Nezavisimosti_60/, /Min_Nezavisimosti_44/, /Min_Nezavisimosti_52/, /Min_Nezavisimosti_46/, /Min_Nezavisimosti_48/, /Min_Surganova_52/, /Min_Surganova_64/, /Min_Surganova_76/, /Min_Bogdanovicha_108/, /Min_Bogdanovicha_116/, /Min_Bogdanovicha_114/, /Min_Prityckogo_160/, /Min_Kropotkina_47/, /Storozhevskaya_8/, /Min_Kozlova_2/, /Min_Kozlova_4/, /Min_Kozlova_6/, /Min_Kozlova_5/, /Min_Kozlova_7/, /Min_Kozlova_9/, /Min_Bjaduli_3/, /Min_Bjaduli_5/, /Min_Bjaduli_6/, /Min_Bjaduli_8/, /Min_Bjaduli_12/, /Min_Pervomajskaja_15/, /Min_Pervomajskaja_17/, /Min_Zaharova_19/, /Min_Zaharova_23/, /Min_Zaharova_25/, /Min_Zaharova_27/, /Min_Zaharova_29/, /Min_Zaharova_33/, /Min_Bronevoj_12/, /Min_Bronevoj_13/, /Min_Vojskovoj_10/, /Min_Vojskovoj_13/, /Min_Vojskovoj_14/, /Min_Vojskovoj_15/, /Min_Rumjanceva_13/, /Min_Rumjanceva_14/, /Min_Rumjanceva_15/, /Min_Rumjanceva_17/, /Rokossovskogo_81/, /Min_Dzerzhinskogo_131/, /Min_Kolesnikova_16/, /Min_Kolesnikova_20/]}}, {'$or': [{'services_key.code_key': 'FR12083'}, {'services_key.code_key': 'FR7967'}, {'services_key.code_key': 'FR7241'}, {'services_key.code_key': 'FR7242'}, {'services_key.code_key': 'FR7243'}, {'services_key.code_key': 'FR7244'}, {'services_key.code_key': 'FR9749'}, {'services_key.code_key': 'FR9750'}, {'services_key.code_key': 'FR9751'}, {'services_key.code_key': 'FR9752'}, {'services_key.code_key': 'FR11885'}, {'services_key.code_key': 'FR14994'}, {'services_key.code_key': 'FR15506'}, {'services_key.code_key': 'FR17303'}, {'services_key.code_key': 'FR11484'}]}, {'credentials_key.network_id_key': {'$not': /375\d+VL/}}]} subs_collection.find(req_json).each {|row| msisdn = '' username = '' row['credentials_key'].each {|cred| if cred['network_id_key'][/37500\d{7}/] msisdn = cred['network_id_key'] else username = cred['network_id_key'] end } if msisdn != '' && username != '' answ_res_msisdn.push(msisdn + ';' + username) end } answ_res_msisdn end |
#get_minsk_fttx_zone7_3last ⇒ Object
344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 |
# File 'lib/imperituroard/platforms/cps/cps_mongo_connector.rb', line 344 def get_minsk_fttx_zone7_3last answ_res_msisdn = [] req_json = {'$and': [{'avps_key.code_key': {'$not': /IN-ACL/}}, {'credentials_key.network_id_key': {'$in': [/Rokossovskogo_81/, /Min_Dzerzhinskogo_131/, /Min_Kolesnikova_16/, /Min_Kolesnikova_20/]}}, {'$or': [{'services_key.code_key': 'FR12083'}, {'services_key.code_key': 'FR7967'}, {'services_key.code_key': 'FR7241'}, {'services_key.code_key': 'FR7242'}, {'services_key.code_key': 'FR7243'}, {'services_key.code_key': 'FR7244'}, {'services_key.code_key': 'FR9749'}, {'services_key.code_key': 'FR9750'}, {'services_key.code_key': 'FR9751'}, {'services_key.code_key': 'FR9752'}, {'services_key.code_key': 'FR11885'}, {'services_key.code_key': 'FR14994'}, {'services_key.code_key': 'FR15506'}, {'services_key.code_key': 'FR17303'}, {'services_key.code_key': 'FR11484'}]}, {'credentials_key.network_id_key': {'$not': /375\d+VL/}}]} subs_collection.find(req_json).each {|row| msisdn = '' username = '' row['credentials_key'].each {|cred| if cred['network_id_key'][/37500\d{7}/] msisdn = cred['network_id_key'] else username = cred['network_id_key'] end } if msisdn != '' && username != '' answ_res_msisdn.push(msisdn + ';' + username) end } answ_res_msisdn end |
#test ⇒ Object
387 388 389 390 391 392 |
# File 'lib/imperituroard/platforms/cps/cps_mongo_connector.rb', line 387 def test subs_collection.find({'credentials_key.network_id_key': '375001120416'}).each {|row| p row } p 'ee' end |