operator_finder 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/lib/generators/operator_finder/install_generator.rb +20 -0
- data/lib/generators/templates/operator_finder.rb +5 -0
- data/lib/operator_finder.rb +70 -0
- data/lib/operator_finder/circle_operator.yml +95 -0
- data/lib/operator_finder/helpers/configuration.rb +23 -0
- data/lib/operator_finder/load.rb +2 -0
- data/lib/operator_finder/version.rb +3 -0
- metadata +93 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 77918696816fdc5c7078b8919697cd783caf0f30
|
|
4
|
+
data.tar.gz: eae2971c89694701885f336ebbb53338d025d60b
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: '0737011838f12a06b71da62c2d03f49a3d4036da3124cc6fae220654ce97ed245a177cc7ea56576037fc01ca795573b9862b3894de1d9558baca33dcf2da4a56'
|
|
7
|
+
data.tar.gz: 13b12fa2807762e8f262ea0979f6818896fcca0d0b3491ef2471a1b400395b7ea5f15d8380d8b4f62a8c3a44954bdd725a660ac8c88e2e95503a753bb8af8c09
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module OperatorFinder
|
|
2
|
+
module Generators
|
|
3
|
+
class InstallGenerator < Rails::Generators::Base
|
|
4
|
+
source_root File.expand_path("../../templates", __FILE__)
|
|
5
|
+
desc 'Creates a OperatorFinder gem configuration file an initializer at config/initializers/operator_finder.rb'
|
|
6
|
+
|
|
7
|
+
# def self.source_root
|
|
8
|
+
# @_operator_finder_source_root ||= File.expand_path("../templates", __FILE__)
|
|
9
|
+
# end
|
|
10
|
+
|
|
11
|
+
# def create_config_file
|
|
12
|
+
# template 'sugarcrm.yml', File.join('config', 'sugarcrm.yml')
|
|
13
|
+
# end
|
|
14
|
+
|
|
15
|
+
def create_initializer_file
|
|
16
|
+
template 'operator_finder.rb', File.join('config', 'initializers', 'operator_finder.rb')
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
require "operator_finder/version"
|
|
2
|
+
require 'operator_finder/helpers/configuration'
|
|
3
|
+
require 'uri'
|
|
4
|
+
require 'net/http'
|
|
5
|
+
require 'byebug'
|
|
6
|
+
require 'yaml'
|
|
7
|
+
require 'json'
|
|
8
|
+
require "operator_finder/load"
|
|
9
|
+
|
|
10
|
+
module OperatorFinder
|
|
11
|
+
extend Configuration
|
|
12
|
+
|
|
13
|
+
attr_accessor :client_id, :uri
|
|
14
|
+
|
|
15
|
+
define_setting :jolo_api_token, ""
|
|
16
|
+
define_setting :jolo_user_id, ""
|
|
17
|
+
|
|
18
|
+
def self.run_action(params = {})
|
|
19
|
+
if OperatorFinder.jolo_api_token.nil? || OperatorFinder.jolo_api_token == "" || OperatorFinder.jolo_user_id.nil? || OperatorFinder.jolo_user_id.nil?
|
|
20
|
+
final_result = "Please provide jolo api token in config/initializers/operator_finder.rb, Ex: config.jolo_api_token = \\'name\\'"
|
|
21
|
+
elsif OperatorFinder.jolo_api_token.include? 'Please'
|
|
22
|
+
final_result = "Please Update Operator Finder Configuration."
|
|
23
|
+
else
|
|
24
|
+
@params = params.merge({
|
|
25
|
+
userid: OperatorFinder.jolo_user_id,
|
|
26
|
+
key: OperatorFinder.jolo_api_token
|
|
27
|
+
})
|
|
28
|
+
OperatorFinder.execute
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def self.execute
|
|
33
|
+
begin
|
|
34
|
+
@uri.query = URI.encode_www_form(@params)
|
|
35
|
+
@response = Net::HTTP.get_response(@uri)
|
|
36
|
+
result = JSON.parse(@response.body)
|
|
37
|
+
circle_code = ""
|
|
38
|
+
operator = ""
|
|
39
|
+
|
|
40
|
+
if CIRCLEOPERATOR["circle_code"].keys.include?(result["circle_code"].to_i)
|
|
41
|
+
circle_code = CIRCLEOPERATOR["circle_code"][result["circle_code"].to_i]
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
if CIRCLEOPERATOR["operator"].keys.include?(result["operator_code"].to_i)
|
|
45
|
+
operator = CIRCLEOPERATOR["operator"][result["operator_code"].to_i]
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
final_result = operator+" "+circle_code
|
|
49
|
+
return final_result
|
|
50
|
+
|
|
51
|
+
rescue
|
|
52
|
+
{:error=>"Transaction Failed",:status=>false}
|
|
53
|
+
rescue => err_msg
|
|
54
|
+
{:error=>"#{err_msg}",:status=>false}
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def self.get_operator_detail(number)
|
|
59
|
+
@uri = URI("https://joloapi.com/api/findoperator.php?")
|
|
60
|
+
if number.length != 10
|
|
61
|
+
final_result = "Please pass 10 digits mobile number(ex: 8888888888)"
|
|
62
|
+
else
|
|
63
|
+
params = {
|
|
64
|
+
mob: number,
|
|
65
|
+
type: 'json'
|
|
66
|
+
}
|
|
67
|
+
OperatorFinder.run_action params
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
operator:
|
|
2
|
+
28: 'AIRTEL'
|
|
3
|
+
1: 'AIRCEL'
|
|
4
|
+
3: 'BSNL'
|
|
5
|
+
22: 'VODAFONE'
|
|
6
|
+
17: 'TATA DOCOMO GSM'
|
|
7
|
+
18: 'TATA DOCOMO CDMA'
|
|
8
|
+
13: 'RELIANCE GSM'
|
|
9
|
+
12: 'RELAINCE CDMA'
|
|
10
|
+
10: 'MTS'
|
|
11
|
+
19: 'UNINOR'
|
|
12
|
+
9: 'LOOP'
|
|
13
|
+
5: 'VIDEOCON'
|
|
14
|
+
6: 'MTNL MUMBAI'
|
|
15
|
+
20: 'MTNL DELHI'
|
|
16
|
+
0: 'NONE'
|
|
17
|
+
8: 'IDEA'
|
|
18
|
+
17: 'VIRGIN GSM'
|
|
19
|
+
18: 'VIRGIN CDMA'
|
|
20
|
+
17: 'T24'
|
|
21
|
+
circle_code:
|
|
22
|
+
5: 'Andhra Pradesh'
|
|
23
|
+
19: 'Assam'
|
|
24
|
+
17: 'Bihar & Jharkhand'
|
|
25
|
+
23: 'Chennai'
|
|
26
|
+
1: 'Delhi/NCR'
|
|
27
|
+
8: 'Gujarat'
|
|
28
|
+
16: 'Haryana'
|
|
29
|
+
21: 'Himachal Pradesh'
|
|
30
|
+
22: 'Jammu & Kashmir'
|
|
31
|
+
7: 'Karnataka'
|
|
32
|
+
14: 'Kerala'
|
|
33
|
+
3: 'Kolkata'
|
|
34
|
+
2: 'Mumbai'
|
|
35
|
+
20: 'North East'
|
|
36
|
+
18: 'Orissa'
|
|
37
|
+
15: 'Punjab'
|
|
38
|
+
13: 'Rajasthan'
|
|
39
|
+
6: 'Tamil Nadu'
|
|
40
|
+
9: 'Uttar Pradesh (E)'
|
|
41
|
+
11: 'Uttar Pradesh (W)'
|
|
42
|
+
12: 'West Bengal'
|
|
43
|
+
4: 'Maharashtra'
|
|
44
|
+
10: 'Madhya Pradesh'
|
|
45
|
+
0: 'None'
|
|
46
|
+
operator1:
|
|
47
|
+
AC: "AIRCEL"
|
|
48
|
+
AT: "AIRTEL"
|
|
49
|
+
CC: "BSNL"
|
|
50
|
+
CG: "BSNL"
|
|
51
|
+
DC: "DATACOM (Now renamed as Videocon Mobile Services)"
|
|
52
|
+
DP: "MTNL"
|
|
53
|
+
ET: "Etisalat India (Getting into the market as Cheers Mobile)"
|
|
54
|
+
ID: "IDEA"
|
|
55
|
+
LM: "LOOP MOBILE"
|
|
56
|
+
MT: "MTS"
|
|
57
|
+
PG: "PING CDMA (HFCL Infotel Ltd.)"
|
|
58
|
+
RC: "RELIANCE CDMA"
|
|
59
|
+
RG: "RELIANCE GSM"
|
|
60
|
+
RJ: "Reliance Jio Infocomm"
|
|
61
|
+
SP: "Spice Digital"
|
|
62
|
+
ST: "S Tel"
|
|
63
|
+
T24: "T24"
|
|
64
|
+
TD: "TATA DOCOMO"
|
|
65
|
+
TI: "TATA INDICOM"
|
|
66
|
+
UN: "UNINOR"
|
|
67
|
+
VC: "VIRGIN CDMA"
|
|
68
|
+
VG: "VIRGIN GSM"
|
|
69
|
+
VF: "VODAFONE"
|
|
70
|
+
VD: "VIDEOCON"
|
|
71
|
+
circle_code1:
|
|
72
|
+
AP: "Andhra Pradesh Telecom Circle, includes Telangana and Yanam districtalso."
|
|
73
|
+
AS: "Assam Telecom Circle."
|
|
74
|
+
BR: "Bihar and Jharkhand Telecom Circle."
|
|
75
|
+
CH: "Chennai Metro Telecom Circle (includes Chennai, MEPZ and Mahabalipuram)."
|
|
76
|
+
DL: "Delhi Metro Telecom Circle (includes NCR, Faridabad, Ghaziabad, Gurgaon and Noida)."
|
|
77
|
+
GJ: "Gujarat Telecom Circle (includes Daman and Diu, Dadra and Nagar Haveli)."
|
|
78
|
+
HP: "Himachal Pradesh Telecom Circle."
|
|
79
|
+
HR: "Haryana Telecom Circle (excludes Faridabad, Gurgaon and Panchkula)."
|
|
80
|
+
JK: "Jammu and Kashmir Telecom Circle."
|
|
81
|
+
KL: "Kerala Telecom Circle (includes Lakshadweep and Mahé))."
|
|
82
|
+
KA: "Karnataka Telecom Circle."
|
|
83
|
+
KO: "Kolkata Metro Telecom Circle (includes parts of Howrah, Hooghly, North and South 24 Parganas and Nadia Districts)."
|
|
84
|
+
MH: "Maharashtra Telecom Circle (includes Goa but excludes Mumbai, Navi Mumbai and Kalyan)."
|
|
85
|
+
MP: "Madhya Pradesh and Chhattisgarh Telecom Circle."
|
|
86
|
+
MU: "Mumbai Metro Telecom Circle (includes Navi Mumbai and Kalyan)"
|
|
87
|
+
NE: "North East India Telecom Circle (includes Arunachal Pradesh, Meghalaya, Mizoram, Nagaland, Manipur and Tripura)."
|
|
88
|
+
OR: "Odisha Telecom Circle."
|
|
89
|
+
PB: "Punjab Telecom Circle (includes Chandigarh and Panchkula)."
|
|
90
|
+
RJ: "Rajasthan Telecom Circle."
|
|
91
|
+
TN: "Tamil Nadu Telecom Circle (excludes CH Chennai, MEPZ, Mahabalipuram and Minjur and includes Puducherry except Yanam and Mahé)."
|
|
92
|
+
UE: "Uttar Pradesh (East) Telecom Circle."
|
|
93
|
+
UW: "Uttar Pradesh (West) and Uttarakhand Telecom Circle (excludes Ghaziabad and Noida)."
|
|
94
|
+
WB: "West Bengal Telecom Circle (includes Andaman and Nicobar Islands, Sikkim excludes Calcutta Telecom District)."
|
|
95
|
+
ZZ: "Customer Care (All Over India)."
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module Configuration
|
|
2
|
+
|
|
3
|
+
def configuration
|
|
4
|
+
yield self
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def define_setting(name, default = nil)
|
|
8
|
+
class_variable_set("@@#{name}", default)
|
|
9
|
+
define_class_method "#{name}=" do |value|
|
|
10
|
+
class_variable_set("@@#{name}", value)
|
|
11
|
+
end
|
|
12
|
+
define_class_method name do
|
|
13
|
+
class_variable_get("@@#{name}")
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
private
|
|
18
|
+
def define_class_method(name, &block)
|
|
19
|
+
(class << self; self; end).instance_eval do
|
|
20
|
+
define_method name, &block
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: operator_finder
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- CIS
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2016-12-17 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: bundler
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '1.11'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '1.11'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rake
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '10.0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '10.0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: rspec
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - ">="
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '0'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - ">="
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '0'
|
|
55
|
+
description: 'Operator Finder gem '
|
|
56
|
+
email:
|
|
57
|
+
- satyendra.s@cisinlabs.com
|
|
58
|
+
executables: []
|
|
59
|
+
extensions: []
|
|
60
|
+
extra_rdoc_files: []
|
|
61
|
+
files:
|
|
62
|
+
- lib/generators/operator_finder/install_generator.rb
|
|
63
|
+
- lib/generators/templates/operator_finder.rb
|
|
64
|
+
- lib/operator_finder.rb
|
|
65
|
+
- lib/operator_finder/circle_operator.yml
|
|
66
|
+
- lib/operator_finder/helpers/configuration.rb
|
|
67
|
+
- lib/operator_finder/load.rb
|
|
68
|
+
- lib/operator_finder/version.rb
|
|
69
|
+
homepage: ''
|
|
70
|
+
licenses:
|
|
71
|
+
- MIT
|
|
72
|
+
metadata: {}
|
|
73
|
+
post_install_message:
|
|
74
|
+
rdoc_options: []
|
|
75
|
+
require_paths:
|
|
76
|
+
- lib
|
|
77
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
78
|
+
requirements:
|
|
79
|
+
- - ">="
|
|
80
|
+
- !ruby/object:Gem::Version
|
|
81
|
+
version: '0'
|
|
82
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
83
|
+
requirements:
|
|
84
|
+
- - ">="
|
|
85
|
+
- !ruby/object:Gem::Version
|
|
86
|
+
version: '0'
|
|
87
|
+
requirements: []
|
|
88
|
+
rubyforge_project:
|
|
89
|
+
rubygems_version: 2.5.1
|
|
90
|
+
signing_key:
|
|
91
|
+
specification_version: 4
|
|
92
|
+
summary: Operator Finder
|
|
93
|
+
test_files: []
|