mobile-subscriber 0.0.1.beta1 → 1.0.0.alpha1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b57bb989e630712c7b4a06d051a7038006b426c1
4
- data.tar.gz: 00d70b45ea77d7e0ebeae56c47c3fb19960c5ebc
3
+ metadata.gz: ae67ac6282a540faba3e4b5212070bf6032ff29b
4
+ data.tar.gz: 25145806d895c4a019f788672f7034de4647695c
5
5
  SHA512:
6
- metadata.gz: df5e3a68907f3c6a33350a16be66e20ed2d385d133ee2547e1848613ae179a5231c8a145ccf4ed46ae1a2f41c785c2c816c612c4c62a50381ba4140a8b4fface
7
- data.tar.gz: 2e4a5f0151692218c8cf90d20de3288f31aa91ebaba3533dbb67607176272acc940caee34ca243c617af9697c70168aeccd5f0438cd8eb5a54e267d0ae392989
6
+ metadata.gz: 7ec68823ec387842a9b55a03d635c4207052a60f04545184fc19ee2ecf01287b59de2d5b724dd282bbc0f36a806634ec0717c6f75a45d347b3dfc4d6db90da54
7
+ data.tar.gz: 60122de6fe24bd0e9375574ff1bbe28b26d48e43eab85a3291798f2473ebeeaec59a853929a12fe73c8bde4e2ddb3b320c85e683acbb528fc52d38d3a4048163
data/.travis.yml CHANGED
@@ -1,3 +1,5 @@
1
1
  language: ruby
2
2
  rvm:
3
+ - 2.0.0-p598
3
4
  - 2.1.5
5
+ - 2.2.0
data/Gemfile CHANGED
@@ -4,7 +4,11 @@ source 'https://rubygems.org'
4
4
  gemspec
5
5
 
6
6
  gem 'activesupport', "~> 4.0"
7
- gem 'guard-rspec', require: false
8
- gem 'byebug', require: true
9
- gem 'thor'
10
- gem 'nokogiri'
7
+
8
+ group :development, :test do
9
+ gem "rake"
10
+ gem 'guard-rspec', require: false
11
+ gem 'byebug', require: true
12
+ gem 'thor'
13
+ gem 'nokogiri'
14
+ end
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # MobileSubscriber Gem
2
2
 
3
+ [![Build Status](https://travis-ci.org/vovimayhem/mobile-subscriber-gem.svg?branch=master)](https://travis-ci.org/vovimayhem/mobile-subscriber-gem)
4
+
3
5
  It's a fact that the Mobile network providers (carriers, operators & such) share
4
6
  subscriber identity data to approved 3rd parties when users navigate via Web to
5
7
  the 3rd parties' websites.
@@ -11,7 +11,6 @@ module MobileSubscriber::Detection
11
11
  # - Claro República Dominicana
12
12
  # - Claro Ecuador
13
13
  # - Claro El Salvador
14
- # - Claro Guatemala
15
14
  # - Claro Nicaragua
16
15
  # - Claro Panamá
17
16
  # - Claro Paraguay
@@ -22,7 +21,8 @@ module MobileSubscriber::Detection
22
21
 
23
22
  country_code = (
24
23
  MobileSubscriber::DIALING_COUNTRY_CODES[msisdn[0,2]] ||
25
- MobileSubscriber::DIALING_COUNTRY_CODES[msisdn[0,3]]
24
+ MobileSubscriber::DIALING_COUNTRY_CODES[msisdn[0,3]] ||
25
+ MobileSubscriber::DIALING_COUNTRY_CODES[msisdn[0,4]] # Dominican Republic
26
26
  )
27
27
 
28
28
  # Determine the Network Operator (MCC + MNC tuple):
@@ -43,10 +43,6 @@ module MobileSubscriber::Detection
43
43
  { mcc: "740", mnc: "01" }
44
44
  when 'SV' # Claro El Salvador:
45
45
  { mcc: "706", mnc: "01" }
46
- when 'GT' # Claro Guatemala:
47
- { mcc: "704", mnc: "01" }
48
- when 'HN' # Claro Honduras:
49
- { mcc: "708", mnc: "001" }
50
46
  when 'NI' # Claro Nicaragua:
51
47
  { mcc: "710", mnc: "21" }
52
48
  when 'PA' # Claro Panamá:
@@ -4,6 +4,8 @@ module MobileSubscriber::Detection
4
4
  # Módulo que provee métodos de deteccion y validacion para MSISDN's de:
5
5
  # - Telcel México
6
6
  # - Claro Argentina
7
+ # - Claro Guatemala
8
+ # - Claro Honduras
7
9
  module FromXNokiaMsisdnHttpRequestHeader
8
10
 
9
11
  def extract_from_x_nokia_msisdn_http_request_header(http_request_info)
@@ -19,7 +21,10 @@ module MobileSubscriber::Detection
19
21
  network_id_tuple = case country_code
20
22
  when 'MX' # Telcel México:
21
23
  { mcc: "334", mnc: "020" }
22
-
24
+ when 'GT' # Claro Guatemala:
25
+ { mcc: "704", mnc: "01" }
26
+ when 'HN' # Claro Honduras:
27
+ { mcc: "708", mnc: "001" }
23
28
  when 'AR' # Claro Argentina:
24
29
  { mcc: "722", mnc: "330" }
25
30
  end
@@ -1,6 +1,11 @@
1
1
  module MobileSubscriber
2
- # Diccionario de Mobile Country Codes => ISO country codes:
2
+ # Diccionario de Dialing Country Codes => ISO country codes:
3
3
  DIALING_COUNTRY_CODES = {
4
+ # Caribbean Islands' country codes are a mess!
5
+ '1809' => 'DO', # Dominican Republic
6
+ '1829' => 'DO', # Dominican Republic Overlay 1
7
+ '1849' => 'DO', # Dominican Republic Overlay 2
8
+
4
9
  '501' => 'BZ', # Belize
5
10
  '502' => 'GT', # Guatemala
6
11
  '503' => 'SV', # El Salvador
@@ -1,3 +1,3 @@
1
1
  module MobileSubscriber
2
- VERSION = "0.0.1.beta1"
2
+ VERSION = "1.0.0.alpha1"
3
3
  end
@@ -34,6 +34,26 @@ describe MobileSubscriber::Detection::FromXNokiaMsisdnHttpRequestHeader do
34
34
  expect(subject[:mobile_network_code]).to match /310|320|330/
35
35
  end
36
36
  end
37
+
38
+ context "when given a request made from Claro Guatemala" do
39
+ let(:test_request) { build :mobile_request_from_claro_guatemala }
40
+
41
+ include_examples "of detection of msisdn from a valid guatemalan mobile network http request"
42
+
43
+ it "has a :mobile_network_code value of '01'" do
44
+ expect(subject[:mobile_network_code]).to eq '01'
45
+ end
46
+ end
47
+
48
+ context "when given a request made from Claro Honduras" do
49
+ let(:test_request) { build :mobile_request_from_claro_honduras }
50
+
51
+ include_examples "of detection of msisdn from a valid honduran mobile network http request"
52
+
53
+ it "has a :mobile_network_code value of '001'" do
54
+ expect(subject[:mobile_network_code]).to eq '001'
55
+ end
56
+ end
37
57
  end
38
58
 
39
59
  end
@@ -1,6 +1,6 @@
1
1
  require "spec_helper"
2
2
 
3
- describe MobileSubscriber::Detection::FromXWapSesiones3gMdnHttpRequestHeader, focus: true do
3
+ describe MobileSubscriber::Detection::FromXWapSesiones3gMdnHttpRequestHeader do
4
4
 
5
5
  include described_class
6
6
 
@@ -90,6 +90,29 @@ FactoryGirl.define do
90
90
  end
91
91
  end
92
92
 
93
+ # Request from a client through Claro Guatemala network:
94
+ # (Built from an actual ATP test)
95
+ factory :mobile_request_from_claro_guatemala do
96
+ initialize_with do
97
+ new build(:common_mobile_request_env).merge(
98
+ "REMOTE_ADDR" => "216.230.152.158",
99
+ "HTTP_X_NOKIA_MSISDN" => "50241865146",
100
+ "HTTP_X_NOKIA_IMSI" => "704012013128442",
101
+ "HTTP_X_FORWARDED_FOR" => "190.212.233.218, 204.0.3.199"
102
+ )
103
+ end
104
+ end
105
+
106
+ # TODO: Replace with a real example:
107
+ factory :mobile_request_from_claro_honduras do
108
+ initialize_with do
109
+ new build(:common_mobile_request_env).merge(
110
+ "REMOTE_ADDR" => "190.107.157.31",
111
+ "HTTP_X_NOKIA_MSISDN" => "50430000000"
112
+ )
113
+ end
114
+ end
115
+
93
116
  # http://myip.ms/view/ip_owners/90291/America_Movil_Peru_S_a_c.html
94
117
  factory :mobile_request_from_claro_peru do
95
118
  initialize_with do
@@ -50,6 +50,26 @@ shared_examples "of detection of msisdn from a valid mexican mobile network http
50
50
  end
51
51
  end
52
52
 
53
+ shared_examples "of detection of msisdn from a valid guatemalan mobile network http request" do
54
+ include_examples "of detection of msisdn from a valid mobile network http request"
55
+ it "has an :id value that starts with '502'" do
56
+ expect(subject[:id]).to match /\A502/
57
+ end
58
+ it "has a :mobile_country_code value of '704'" do
59
+ expect(subject[:mobile_country_code]).to eq '704'
60
+ end
61
+ end
62
+
63
+ shared_examples "of detection of msisdn from a valid honduran mobile network http request" do
64
+ include_examples "of detection of msisdn from a valid mobile network http request"
65
+ it "has an :id value that starts with '504'" do
66
+ expect(subject[:id]).to match /\A504/
67
+ end
68
+ it "has a :mobile_country_code value of '708'" do
69
+ expect(subject[:mobile_country_code]).to eq '708'
70
+ end
71
+ end
72
+
53
73
  shared_examples "of detection of msisdn from a valid brazilian mobile network http request" do
54
74
  include_examples "of detection of msisdn from a valid mobile network http request"
55
75
  it "has an :id value that starts with '55'" do
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: 0.0.1.beta1
4
+ version: 1.0.0.alpha1
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-01-08 00:00:00.000000000 Z
11
+ date: 2015-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -158,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
158
158
  version: 1.3.1
159
159
  requirements: []
160
160
  rubyforge_project:
161
- rubygems_version: 2.2.2
161
+ rubygems_version: 2.4.5
162
162
  signing_key:
163
163
  specification_version: 4
164
164
  summary: Mobile MSISDN detection & validation.