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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dff021ce9f98d8b6f5b708e5b5b923371a73ae3e
4
- data.tar.gz: 6943c7b168217442a6f83cef0b439e71fee48874
3
+ metadata.gz: 824221695c48e812f55c982abdc9e4ede9333818
4
+ data.tar.gz: 6339fc5ab174bf1197ff5946001a0c80583a13e7
5
5
  SHA512:
6
- metadata.gz: da95e3e0d4d5fd5f9b7d251a08e368b667782e10d59622fb0c42ae42808a77e1900a8c3f30d86f226a4889d2c052f9d74394f6d702aba5633c55f6ad5482cb27
7
- data.tar.gz: 8c54ae67aae2b5056834831cadef35704e36f6e017cd7f318c25c4a9f4b5485cbbaeab90fb4139e5dcb050445f84e1026013314c981fd614d781f0493b99c3a8
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
- if (via_header = http_request_info.headers['Via']).present? and via_header =~ /Comverse/i
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" }
@@ -29,6 +29,7 @@ module MobileSubscriber::Detection
29
29
  'X-Msp-Clid',
30
30
  'X-Msp-Msisdn',
31
31
  'X-Network-Info',
32
+ 'X-Nokia-Imsi', # This is a VERY useful one... if you have it!
32
33
  'X-Nokia-Msisdn',
33
34
  'X-Nx-Clid',
34
35
  'X-Orange-Cli',
@@ -0,0 +1 @@
1
+ # Placeholder for the new Mobile User class
@@ -1,3 +1,3 @@
1
1
  module MobileSubscriber
2
- VERSION = "1.0.0.alpha3"
2
+ VERSION = "1.0.0.alpha4"
3
3
  end
@@ -6,8 +6,8 @@ FactoryGirl.define do
6
6
  initialize_with do
7
7
  {
8
8
  "HTTP_HOST" => "www.example.com",
9
- "HTTP_CONNECTION" => "keep-alive",
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
- # http://myip.ms/view/ip_owners/90291/America_Movil_Peru_S_a_c.html
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" => "200.108.96.5",
171
- "HTTP_X_UP_CALLING_LINE_ID" => "5116130000",
172
- "HTTP_VIA" => "aa Comverse aaa"
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.alpha3
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-24 00:00:00.000000000 Z
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