mobile-subscriber 1.0.0.alpha4 → 1.0.0.alpha5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mobile-subscriber.rb +13 -3
- data/lib/mobile_subscriber/dictionaries/dialing_and_country_codes.rb +468 -28
- data/lib/mobile_subscriber/http/known_imsi_headers.rb +22 -0
- data/lib/mobile_subscriber/http/known_msisdn_headers.rb +68 -0
- data/lib/mobile_subscriber/http/request_info.rb +166 -0
- data/lib/mobile_subscriber/identity.rb +97 -1
- data/lib/mobile_subscriber/version.rb +1 -1
- data/mobile_subscriber.thor +41 -0
- data/spec/factories/mobile_requests.rb +28 -0
- data/spec/factories/mobile_requests_from_claro.rb +257 -0
- data/spec/factories/mobile_requests_from_iusacell.rb +13 -0
- data/spec/factories/mobile_requests_from_movistar.rb +15 -0
- data/spec/factories/mobile_requests_from_telcel.rb +14 -0
- data/spec/factories/mobile_requests_from_vivo.rb +13 -0
- data/spec/features/claro_user_detection_spec.rb +170 -0
- data/spec/features/iusacell_user_detection_spec.rb +19 -0
- data/spec/features/movistar_user_detection_spec.rb +19 -0
- data/spec/features/telcel_user_detection_spec.rb +19 -0
- data/spec/models/{isdn_spec.rb → identity_spec.rb} +5 -5
- data/spec/shared_examples/identity_detection_in_argentina.rb +11 -0
- data/spec/shared_examples/identity_detection_in_brazil.rb +12 -0
- data/spec/shared_examples/identity_detection_in_chile.rb +12 -0
- data/spec/shared_examples/identity_detection_in_colombia.rb +12 -0
- data/spec/shared_examples/identity_detection_in_costa_rica.rb +15 -0
- data/spec/shared_examples/identity_detection_in_dominican_republic.rb +12 -0
- data/spec/shared_examples/identity_detection_in_ecuador.rb +12 -0
- data/spec/shared_examples/identity_detection_in_el_salvador.rb +15 -0
- data/spec/shared_examples/identity_detection_in_guatemala.rb +15 -0
- data/spec/shared_examples/identity_detection_in_honduras.rb +11 -0
- data/spec/shared_examples/identity_detection_in_mexico.rb +11 -0
- data/spec/shared_examples/identity_detection_in_nicaragua.rb +12 -0
- data/spec/shared_examples/identity_detection_in_panama.rb +12 -0
- data/spec/shared_examples/identity_detection_in_peru.rb +12 -0
- data/spec/shared_examples/identity_detection_in_puerto_rico.rb +14 -0
- data/spec/shared_examples/of_msisdn_detection_from_http_request.rb +3 -188
- data/templates/dialing_and_country_codes.rb.erb +20 -0
- metadata +58 -28
- data/lib/mobile_subscriber/detection/from_msisdn_http_request_header.rb +0 -48
- data/lib/mobile_subscriber/detection/from_x_nokia_msisdn_http_request_header.rb +0 -58
- data/lib/mobile_subscriber/detection/from_x_up_calling_line_id_http_request_header.rb +0 -65
- data/lib/mobile_subscriber/detection/from_x_up_ch_msisdn_http_request_header.rb +0 -35
- data/lib/mobile_subscriber/detection/from_x_up_subno_http_request_header.rb +0 -44
- data/lib/mobile_subscriber/detection/from_x_wap_msisdn_http_request_header.rb +0 -37
- data/lib/mobile_subscriber/detection/from_x_wap_sesiones3g_mdn_http_request_header.rb +0 -39
- data/lib/mobile_subscriber/detection/from_x_ztgo_beareraddress_http_request_header.rb +0 -36
- data/lib/mobile_subscriber/detection/http_request_info.rb +0 -77
- data/lib/mobile_subscriber/isdn.rb +0 -89
- data/spec/detection/from_msisdn_http_request_header_spec.rb +0 -53
- data/spec/detection/from_x_nokia_msisdn_http_request_header_spec.rb +0 -99
- data/spec/detection/from_x_up_calling_line_id_http_request_header_spec.rb +0 -39
- data/spec/detection/from_x_up_subno_http_request_header_spec.rb +0 -43
- data/spec/detection/from_x_wap_msisdn_http_request_header_spec.rb +0 -32
- data/spec/detection/from_x_wap_sesiones3g_mdn_http_request_header_spec.rb +0 -29
- data/spec/factories/requests.rb +0 -229
@@ -1,53 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe MobileSubscriber::Detection::FromMsisdnHttpRequestHeader do
|
4
|
-
|
5
|
-
include described_class
|
6
|
-
|
7
|
-
let :test_request do
|
8
|
-
build :mobile_request_from_claro_brasil
|
9
|
-
end
|
10
|
-
|
11
|
-
let :test_request_info do
|
12
|
-
MobileSubscriber::Detection::HttpRequestInfo.new test_request.env
|
13
|
-
end
|
14
|
-
|
15
|
-
describe "the returned object of self.extract_from_msisdn_http_request_header" do
|
16
|
-
|
17
|
-
subject do
|
18
|
-
extract_from_msisdn_http_request_header test_request_info
|
19
|
-
end
|
20
|
-
|
21
|
-
context "when given a request made from Claro Brasil" do
|
22
|
-
let(:test_request) { build :mobile_request_from_claro_brasil }
|
23
|
-
|
24
|
-
include_examples "of detection of msisdn from a valid brazilian mobile network http request"
|
25
|
-
|
26
|
-
it "has a :mobile_network_code value of '05' or '38'" do
|
27
|
-
expect(subject[:mobile_network_code]).to match /05|38/i
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
context "when given a request made from Claro Ecuador" do
|
32
|
-
let(:test_request) { build :mobile_request_from_claro_ecuador }
|
33
|
-
|
34
|
-
include_examples "of detection of msisdn from a valid ecuadorian mobile network http request"
|
35
|
-
|
36
|
-
it "has a :mobile_network_code value of '01'" do
|
37
|
-
expect(subject[:mobile_network_code]).to eq '01'
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
context "when given a request made from Claro República Dominicana" do
|
42
|
-
let(:test_request) { build :mobile_request_from_claro_dominican_republic }
|
43
|
-
|
44
|
-
include_examples "of detection of msisdn from a valid dominican mobile network http request"
|
45
|
-
|
46
|
-
it "has a :mobile_network_code value of '02'" do
|
47
|
-
expect(subject[:mobile_network_code]).to eq '02'
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
end
|
52
|
-
|
53
|
-
end
|
@@ -1,99 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe MobileSubscriber::Detection::FromXNokiaMsisdnHttpRequestHeader do
|
4
|
-
|
5
|
-
include described_class
|
6
|
-
|
7
|
-
let :test_request_info do
|
8
|
-
MobileSubscriber::Detection::HttpRequestInfo.new test_request.env
|
9
|
-
end
|
10
|
-
|
11
|
-
describe "the returned object of self.extract_from_msisdn_http_request_header" do
|
12
|
-
|
13
|
-
subject do
|
14
|
-
extract_from_x_nokia_msisdn_http_request_header test_request_info
|
15
|
-
end
|
16
|
-
|
17
|
-
context "when given a request made from Telcel México" do
|
18
|
-
let(:test_request) { build :mobile_request_from_telcel_mexico }
|
19
|
-
|
20
|
-
include_examples "of detection of msisdn from a valid mexican mobile network http request"
|
21
|
-
|
22
|
-
it "has a :mobile_network_code value of '020'" do
|
23
|
-
expect(subject[:mobile_network_code]).to eq '020'
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
context "when given a request made from Claro Argentina" do
|
28
|
-
let(:test_request) { build :mobile_request_from_claro_argentina }
|
29
|
-
|
30
|
-
include_examples "of detection of msisdn from a valid argentinian mobile network http request"
|
31
|
-
|
32
|
-
# TODO: Bad test... we need to test for each network code, if it can be determined:
|
33
|
-
it "has a :mobile_network_code value of '310', '320', or '330'" do
|
34
|
-
expect(subject[:mobile_network_code]).to match /310|320|330/
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
context "when given a request made from Claro Costa Rica" do
|
39
|
-
let(:test_request) { build :mobile_request_from_claro_costa_rica }
|
40
|
-
|
41
|
-
include_examples "of detection of msisdn from a valid costa rican mobile network http request"
|
42
|
-
|
43
|
-
it "has a :mobile_network_code value of '03'" do
|
44
|
-
expect(subject[:mobile_network_code]).to eq '03'
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
context "when given a request made from Claro Puerto Rico" do
|
49
|
-
let(:test_request) { build :mobile_request_from_claro_puerto_rico }
|
50
|
-
|
51
|
-
include_examples "of detection of msisdn from a valid puerto rican mobile network http request"
|
52
|
-
|
53
|
-
it "has a :mobile_network_code value of '110'" do
|
54
|
-
expect(subject[:mobile_network_code]).to eq '110'
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
context "when given a request made from Claro Guatemala" do
|
59
|
-
let(:test_request) { build :mobile_request_from_claro_guatemala }
|
60
|
-
|
61
|
-
include_examples "of detection of msisdn from a valid guatemalan mobile network http request"
|
62
|
-
|
63
|
-
it "has a :mobile_network_code value of '01'" do
|
64
|
-
expect(subject[:mobile_network_code]).to eq '01'
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
context "when given a request made from Claro Honduras" do
|
69
|
-
let(:test_request) { build :mobile_request_from_claro_honduras }
|
70
|
-
|
71
|
-
include_examples "of detection of msisdn from a valid honduran mobile network http request"
|
72
|
-
|
73
|
-
it "has a :mobile_network_code value of '001'" do
|
74
|
-
expect(subject[:mobile_network_code]).to eq '001'
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
context "when given a request made from Claro Nicaragua" do
|
79
|
-
let(:test_request) { build :mobile_request_from_claro_nicaragua }
|
80
|
-
|
81
|
-
include_examples "of detection of msisdn from a valid nicaraguan mobile network http request"
|
82
|
-
|
83
|
-
it "has a :mobile_network_code value of '21'" do
|
84
|
-
expect(subject[:mobile_network_code]).to eq '21'
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
context "when given a request made from Claro El Salvador" do
|
89
|
-
let(:test_request) { build :mobile_request_from_claro_el_salvador }
|
90
|
-
|
91
|
-
include_examples "of detection of msisdn from a valid salvadoran mobile network http request"
|
92
|
-
|
93
|
-
it "has a :mobile_network_code value of '01'" do
|
94
|
-
expect(subject[:mobile_network_code]).to eq '01'
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe MobileSubscriber::Detection::FromXUpCallingLineIdHttpRequestHeader do
|
4
|
-
|
5
|
-
include described_class
|
6
|
-
|
7
|
-
let :test_request_info do
|
8
|
-
MobileSubscriber::Detection::HttpRequestInfo.new test_request.env
|
9
|
-
end
|
10
|
-
|
11
|
-
describe "the returned object of self.extract_from_msisdn_http_request_header" do
|
12
|
-
|
13
|
-
subject do
|
14
|
-
extract_from_x_up_calling_line_id_http_request_header test_request_info
|
15
|
-
end
|
16
|
-
|
17
|
-
context "when given a request made from Claro Perú" do
|
18
|
-
let(:test_request) { build :mobile_request_from_claro_peru }
|
19
|
-
|
20
|
-
include_examples "of detection of msisdn from a valid peruvian mobile network http request"
|
21
|
-
|
22
|
-
it "has a :mobile_network_code value of '10'" do
|
23
|
-
expect(subject[:mobile_network_code]).to eq '10'
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
context "when given a request made from Movistar Perú" do
|
28
|
-
let(:test_request) { build :mobile_request_from_movistar_peru }
|
29
|
-
|
30
|
-
include_examples "of detection of msisdn from a valid peruvian mobile network http request"
|
31
|
-
|
32
|
-
it "has a :mobile_network_code value of '06'" do
|
33
|
-
expect(subject[:mobile_network_code]).to eq '06'
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|
38
|
-
|
39
|
-
end
|
@@ -1,43 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe MobileSubscriber::Detection::FromXUpSubnoHttpRequestHeader do
|
4
|
-
|
5
|
-
include described_class
|
6
|
-
|
7
|
-
let :test_request do
|
8
|
-
build :mobile_request_from_claro_colombia
|
9
|
-
end
|
10
|
-
|
11
|
-
let :test_request_info do
|
12
|
-
MobileSubscriber::Detection::HttpRequestInfo.new test_request.env
|
13
|
-
end
|
14
|
-
|
15
|
-
describe "the returned object of self.extract_from_msisdn_http_request_header" do
|
16
|
-
|
17
|
-
subject do
|
18
|
-
extract_from_x_up_subno_http_request_header test_request_info
|
19
|
-
end
|
20
|
-
|
21
|
-
context "when given a request made from Claro Colombia" do
|
22
|
-
|
23
|
-
include_examples "of detection of msisdn from a valid colombian mobile network http request"
|
24
|
-
|
25
|
-
it "has a :mobile_network_code value of '101'" do
|
26
|
-
expect(subject[:mobile_network_code]).to eq '101'
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
context "when given a request made from Claro Panamá" do
|
31
|
-
|
32
|
-
let(:test_request) { build :mobile_request_from_claro_panama }
|
33
|
-
|
34
|
-
include_examples "of detection of msisdn from a valid panamanian mobile network http request"
|
35
|
-
|
36
|
-
it "has a :mobile_network_code value of '03'" do
|
37
|
-
expect(subject[:mobile_network_code]).to eq '03'
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
end
|
42
|
-
|
43
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe MobileSubscriber::Detection::FromXWapMsisdnHttpRequestHeader do
|
4
|
-
|
5
|
-
include described_class
|
6
|
-
|
7
|
-
let :test_request do
|
8
|
-
build :mobile_request_from_claro_chile
|
9
|
-
end
|
10
|
-
|
11
|
-
let :test_request_info do
|
12
|
-
MobileSubscriber::Detection::HttpRequestInfo.new test_request.env
|
13
|
-
end
|
14
|
-
|
15
|
-
describe "the returned object of self.extract_from_msisdn_http_request_header" do
|
16
|
-
|
17
|
-
subject do
|
18
|
-
extract_from_x_wap_msisdn_http_request_header test_request_info
|
19
|
-
end
|
20
|
-
|
21
|
-
context "when given a request made from Claro Chile" do
|
22
|
-
|
23
|
-
include_examples "of detection of msisdn from a valid chilean mobile network http request"
|
24
|
-
|
25
|
-
it "has a :mobile_network_code value of '03'" do
|
26
|
-
expect(subject[:mobile_network_code]).to eq '03'
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
end
|
31
|
-
|
32
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe MobileSubscriber::Detection::FromXWapSesiones3gMdnHttpRequestHeader do
|
4
|
-
|
5
|
-
include described_class
|
6
|
-
|
7
|
-
let :test_request_info do
|
8
|
-
MobileSubscriber::Detection::HttpRequestInfo.new test_request.env
|
9
|
-
end
|
10
|
-
|
11
|
-
describe "the returned object of self.extract_from_msisdn_http_request_header" do
|
12
|
-
|
13
|
-
subject do
|
14
|
-
extract_from_x_wap_sesiones3g_mdn_http_request_header test_request_info
|
15
|
-
end
|
16
|
-
|
17
|
-
context "when given a request made from Iusacell Mexico" do
|
18
|
-
let(:test_request) { build :mobile_request_from_iusacell_mexico }
|
19
|
-
|
20
|
-
include_examples "of detection of msisdn from a valid mexican mobile network http request"
|
21
|
-
|
22
|
-
it "has a :mobile_network_code value of '040' or '050'" do
|
23
|
-
expect(subject[:mobile_network_code]).to match /040|050/i
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
28
|
-
|
29
|
-
end
|
data/spec/factories/requests.rb
DELETED
@@ -1,229 +0,0 @@
|
|
1
|
-
# Read about factories at https://github.com/thoughtbot/factory_girl
|
2
|
-
|
3
|
-
FactoryGirl.define do
|
4
|
-
|
5
|
-
factory :common_mobile_request_env, class: Hash do
|
6
|
-
initialize_with do
|
7
|
-
{
|
8
|
-
"HTTP_HOST" => "www.example.com",
|
9
|
-
"HTTP_CONNECTION" => "close",
|
10
|
-
"HTTP_CACHE_CONTROL" => "no-cache, max-age=0",
|
11
|
-
"HTTP_ACCEPT" => "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
|
12
|
-
"HTTP_USER_AGENT" => "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X; en-us) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53",
|
13
|
-
"HTTP_ACCEPT_ENCODING" => "gzip, deflate, sdch",
|
14
|
-
"HTTP_ACCEPT_LANGUAGE" => "en-US,en;q=0.8,es;q=0.6",
|
15
|
-
"HTTP_VERSION" => "HTTP/1.1"
|
16
|
-
}
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
factory :mobile_request, class: Rack::Request do
|
21
|
-
|
22
|
-
initialize_with do
|
23
|
-
new build(:common_mobile_request_env).merge(
|
24
|
-
"REMOTE_ADDR" => "201.144.162.4"
|
25
|
-
)
|
26
|
-
end
|
27
|
-
|
28
|
-
factory :mobile_request_from_iusacell_mexico do
|
29
|
-
initialize_with do
|
30
|
-
new build(:common_mobile_request_env).merge(
|
31
|
-
"REMOTE_ADDR" => "201.144.162.4",
|
32
|
-
"HTTP_X_WAP_SESIONES3G_MDN" => "528110000000"
|
33
|
-
)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
factory :mobile_request_from_telcel_mexico do
|
38
|
-
initialize_with do
|
39
|
-
new build(:common_mobile_request_env).merge(
|
40
|
-
"REMOTE_ADDR" => "201.144.162.4",
|
41
|
-
"HTTP_X_NOKIA_MSISDN" => "528110000000"
|
42
|
-
)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
factory :mobile_request_from_claro_argentina do
|
47
|
-
initialize_with do
|
48
|
-
new build(:common_mobile_request_env).merge(
|
49
|
-
"REMOTE_ADDR" => "170.51.255.240",
|
50
|
-
"HTTP_X_NOKIA_MSISDN" => "5491141090000"
|
51
|
-
)
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
factory :mobile_request_from_claro_brasil do
|
56
|
-
initialize_with do
|
57
|
-
new build(:common_mobile_request_env).merge(
|
58
|
-
"REMOTE_ADDR" => "201.23.176.202",
|
59
|
-
"HTTP_MSISDN" => "5500000000000"
|
60
|
-
)
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
# TODO: Replace with a real example:
|
65
|
-
factory :mobile_request_from_claro_dominican_republic do
|
66
|
-
initialize_with do
|
67
|
-
new build(:common_mobile_request_env).merge(
|
68
|
-
"REMOTE_ADDR" => "181.37.104.3",
|
69
|
-
"HTTP_MSISDN" => "18098591800"
|
70
|
-
)
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
# http://ns.myip.ms/view/ip_owners/181034/Claro_Chile_S_a.html
|
75
|
-
factory :mobile_request_from_claro_chile do
|
76
|
-
initialize_with do
|
77
|
-
new build(:common_mobile_request_env).merge(
|
78
|
-
"REMOTE_ADDR" => "191.116.39.114",
|
79
|
-
"HTTP_X_WAP_MSISDN" => "56024440000"
|
80
|
-
)
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
factory :mobile_request_from_claro_colombia do
|
85
|
-
initialize_with do
|
86
|
-
new build(:common_mobile_request_env).merge(
|
87
|
-
"REMOTE_ADDR" => "200.26.137.100",
|
88
|
-
"HTTP_X_UP_SUBNO" => "57000000000"
|
89
|
-
)
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
# TODO: Replace with a real example request:
|
94
|
-
factory :mobile_request_from_claro_costa_rica do
|
95
|
-
initialize_with do
|
96
|
-
new build(:common_mobile_request_env).merge(
|
97
|
-
"REMOTE_ADDR" => "186.26.126.37",
|
98
|
-
"HTTP_X_NOKIA_MSISDN" => "50600000000"
|
99
|
-
)
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
# TODO: Replace with a real example request:
|
104
|
-
factory :mobile_request_from_claro_puerto_rico do
|
105
|
-
initialize_with do
|
106
|
-
new build(:common_mobile_request_env).merge(
|
107
|
-
"REMOTE_ADDR" => "64.237.130.12",
|
108
|
-
"HTTP_X_NOKIA_MSISDN" => "17872889401" # 1-787-XXXXXXXX
|
109
|
-
)
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
# http://myip.ms/view/ip_owners/80612/Conecel.html
|
114
|
-
factory :mobile_request_from_claro_ecuador do
|
115
|
-
initialize_with do
|
116
|
-
new build(:common_mobile_request_env).merge(
|
117
|
-
"REMOTE_ADDR" => "190.63.1.10",
|
118
|
-
"HTTP_MSISDN" => "59342690000"
|
119
|
-
)
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
# Request from a client through Claro Guatemala network:
|
124
|
-
# (Built from an actual ATP test)
|
125
|
-
factory :mobile_request_from_claro_guatemala do
|
126
|
-
initialize_with do
|
127
|
-
new build(:common_mobile_request_env).merge(
|
128
|
-
"REMOTE_ADDR" => "216.230.152.158",
|
129
|
-
"HTTP_X_NOKIA_MSISDN" => "50241865146",
|
130
|
-
"HTTP_X_NOKIA_IMSI" => "704012013128442",
|
131
|
-
"HTTP_X_FORWARDED_FOR" => "190.212.233.218, 204.0.3.199"
|
132
|
-
)
|
133
|
-
end
|
134
|
-
end
|
135
|
-
|
136
|
-
# TODO: Replace with a real example:
|
137
|
-
factory :mobile_request_from_claro_honduras do
|
138
|
-
initialize_with do
|
139
|
-
new build(:common_mobile_request_env).merge(
|
140
|
-
"REMOTE_ADDR" => "190.107.157.31",
|
141
|
-
"HTTP_X_NOKIA_MSISDN" => "50430000000"
|
142
|
-
)
|
143
|
-
end
|
144
|
-
end
|
145
|
-
|
146
|
-
# TODO: Replace with a real example request:
|
147
|
-
factory :mobile_request_from_claro_nicaragua do
|
148
|
-
initialize_with do
|
149
|
-
new build(:common_mobile_request_env).merge(
|
150
|
-
"REMOTE_ADDR" => "190.212.88.8",
|
151
|
-
"HTTP_X_NOKIA_MSISDN" => "50500000000"
|
152
|
-
)
|
153
|
-
end
|
154
|
-
end
|
155
|
-
|
156
|
-
# TODO: Replace with a real example request:
|
157
|
-
factory :mobile_request_from_claro_el_salvador do
|
158
|
-
initialize_with do
|
159
|
-
new build(:common_mobile_request_env).merge(
|
160
|
-
"REMOTE_ADDR" => "190.86.139.225",
|
161
|
-
"HTTP_X_NOKIA_MSISDN" => "50300000000"
|
162
|
-
)
|
163
|
-
end
|
164
|
-
end
|
165
|
-
|
166
|
-
# Real request recorded at claroapps.com at 2015-03-24
|
167
|
-
factory :mobile_request_from_claro_peru do
|
168
|
-
initialize_with do
|
169
|
-
new build(:common_mobile_request_env).merge(
|
170
|
-
"REMOTE_ADDR" => "216.246.75.208", # This IP belongs to a U.S. datacenter which acts as proxy for the real user...
|
171
|
-
|
172
|
-
"HTTP_ACCEPT_LANGUAGE" => "es-PE,es-419;q=0.8,es;q=0.6",
|
173
|
-
"HTTP_AKAMAI_ORIGIN_HOP" => "1",
|
174
|
-
"HTTP_CONNECT_TIME" => "3",
|
175
|
-
"HTTP_PRAGMA" => "no-cache",
|
176
|
-
"HTTP_TOTAL_ROUTE_TIME" => "5",
|
177
|
-
"HTTP_VERSION" => "HTTP/1.1",
|
178
|
-
"HTTP_VIA" => "1.1 akamai.net(ghost) (AkamaiGHost), 1.1 vegur",
|
179
|
-
|
180
|
-
# X Headers:
|
181
|
-
"HTTP_X_AKAMAI_CONFIG_LOG_DETAIL" => "true",
|
182
|
-
|
183
|
-
# The leftmost IP is the:
|
184
|
-
# - Closer to the User (or the actual user IP)
|
185
|
-
# - Less trustable
|
186
|
-
"HTTP_X_FORWARDED_FOR" => "190.113.210.147, 216.246.75.208",
|
187
|
-
"HTTP_X_NOKIA_IMSI" => "716100316259449",
|
188
|
-
"HTTP_X_REQUEST" => "272aa345-55cc-45b2-b879-79678957817f",
|
189
|
-
|
190
|
-
"HTTP_X_REQUEST_START" => "1427225820026",
|
191
|
-
"HTTP_X_FORWARDED_PORT" => "80",
|
192
|
-
"HTTP_X_FORWARDED_PROTO" => "http",
|
193
|
-
"HTTP_X_UP_CALLING_LINE_ID" => "51941037249"
|
194
|
-
)
|
195
|
-
end
|
196
|
-
end
|
197
|
-
|
198
|
-
factory :mobile_request_from_vivo_brasil do
|
199
|
-
initialize_with do
|
200
|
-
new build(:common_mobile_request_env).merge(
|
201
|
-
"REMOTE_ADDR" => "187.26.59.4",
|
202
|
-
"HTTP_X_UP_CH_MSISDN" => "5500000000000"
|
203
|
-
)
|
204
|
-
end
|
205
|
-
end
|
206
|
-
|
207
|
-
# TODO: Replace with a real example:
|
208
|
-
factory :mobile_request_from_claro_panama do
|
209
|
-
initialize_with do
|
210
|
-
new build(:common_mobile_request_env).merge(
|
211
|
-
"REMOTE_ADDR" => "181.178.231.8",
|
212
|
-
"HTTP_X_UP_SUBNO" => "5070000000"
|
213
|
-
)
|
214
|
-
end
|
215
|
-
end
|
216
|
-
|
217
|
-
# http://myip.ms/view/ip_owners/7424/Telefonica_Del_Peru_Saa.html
|
218
|
-
factory :mobile_request_from_movistar_peru do
|
219
|
-
initialize_with do
|
220
|
-
new build(:common_mobile_request_env).merge(
|
221
|
-
"REMOTE_ADDR" => "190.42.165.87",
|
222
|
-
"HTTP_X_UP_CALLING_LINE_ID" => "5112100000"
|
223
|
-
)
|
224
|
-
end
|
225
|
-
end
|
226
|
-
|
227
|
-
|
228
|
-
end
|
229
|
-
end
|