mobile-subscriber 1.0.0.alpha3 → 1.0.0.alpha4
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/detection/from_x_up_calling_line_id_http_request_header.rb +4 -2
- data/lib/mobile_subscriber/detection/http_request_info.rb +1 -0
- data/lib/mobile_subscriber/identity.rb +1 -0
- data/lib/mobile_subscriber/version.rb +1 -1
- data/spec/factories/requests.rb +27 -6
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 824221695c48e812f55c982abdc9e4ede9333818
|
4
|
+
data.tar.gz: 6339fc5ab174bf1197ff5946001a0c80583a13e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0fa3e242b91af01570b39bd5e26322b57f1037b488330f8f66026a1f04319cb69c96c5e6a90a140acff28c90784f758e0124083b25ecbc14682b1883fdb64647
|
7
|
+
data.tar.gz: 2ae1fb0491f13732cfbf5da8198a37483f9bf32d6801831b7a3bcfa7928d43c33b4d06d44b0366e19aaf9cbdc69f7cad2102ced08c306d3641203de13921de2e
|
@@ -24,9 +24,11 @@ module MobileSubscriber::Detection
|
|
24
24
|
# TODO: Validate IP ranges, additional headers, etc.
|
25
25
|
network_id_tuple = case country_code
|
26
26
|
when 'PE'
|
27
|
-
|
27
|
+
# Claro Perú includes the "X-Nokia-Imsi" header...
|
28
|
+
imsi = http_request_info.headers['X-Nokia-Imsi']
|
29
|
+
if imsi.present?
|
28
30
|
# Claro Peru: (IP's 190.113.x)
|
29
|
-
{ mcc: "716", mnc: "10" }
|
31
|
+
{ mcc: "716", mnc: "10" } if imsi.start_with?('71610')
|
30
32
|
else
|
31
33
|
# Movistar Peru: (IP's 190.238.x)
|
32
34
|
{ mcc: "716", mnc: "06" }
|
@@ -0,0 +1 @@
|
|
1
|
+
# Placeholder for the new Mobile User class
|
data/spec/factories/requests.rb
CHANGED
@@ -6,8 +6,8 @@ FactoryGirl.define do
|
|
6
6
|
initialize_with do
|
7
7
|
{
|
8
8
|
"HTTP_HOST" => "www.example.com",
|
9
|
-
"HTTP_CONNECTION" => "
|
10
|
-
"HTTP_CACHE_CONTROL" => "max-age=0",
|
9
|
+
"HTTP_CONNECTION" => "close",
|
10
|
+
"HTTP_CACHE_CONTROL" => "no-cache, max-age=0",
|
11
11
|
"HTTP_ACCEPT" => "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
|
12
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
13
|
"HTTP_ACCEPT_ENCODING" => "gzip, deflate, sdch",
|
@@ -163,13 +163,34 @@ FactoryGirl.define do
|
|
163
163
|
end
|
164
164
|
end
|
165
165
|
|
166
|
-
#
|
166
|
+
# Real request recorded at claroapps.com at 2015-03-24
|
167
167
|
factory :mobile_request_from_claro_peru do
|
168
168
|
initialize_with do
|
169
169
|
new build(:common_mobile_request_env).merge(
|
170
|
-
"REMOTE_ADDR"
|
171
|
-
|
172
|
-
"
|
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"
|
173
194
|
)
|
174
195
|
end
|
175
196
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mobile-subscriber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.alpha4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roberto Quintanilla
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -125,6 +125,7 @@ files:
|
|
125
125
|
- lib/mobile_subscriber/dictionaries/dialing_and_country_codes.rb
|
126
126
|
- lib/mobile_subscriber/dictionaries/mobile_and_iso_country_codes.rb
|
127
127
|
- lib/mobile_subscriber/dictionaries/operator_data.rb
|
128
|
+
- lib/mobile_subscriber/identity.rb
|
128
129
|
- lib/mobile_subscriber/isdn.rb
|
129
130
|
- lib/mobile_subscriber/version.rb
|
130
131
|
- mobile-subscriber.gemspec
|