mobile-subscriber 0.0.1.alpha4 → 0.0.1.alpha5

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: ae7f7ff2ab99759a49beef779711360052c0cc85
4
- data.tar.gz: daa60ed245a79d3161c29f142244866c4afb2016
3
+ metadata.gz: 0f3d86284c8cd6a42a0fdab25eba82cb6c1ba05b
4
+ data.tar.gz: fbcf9b5f54072d1a6f9580da21bc6afbd4314d51
5
5
  SHA512:
6
- metadata.gz: 4781b295edb467703313ed06d9167998d457a5418445b52a31915563eea46e53561a0ec144cff37eaceba3ab0b264eae875d0445579ef644a87b0cc0b6747b67
7
- data.tar.gz: f237cdbbc072af9ad6f4389fbcab25052982041727086a4a422035317b29842e43393fa33e08988a636e9598d2135b03123fb668afc066b134c5c60d44c2a357
6
+ metadata.gz: 0acdb66c244b26c2360958eeaf0a392b3786d59e73946348e5abfc1f249ea47e978576711b76e3a2f4a960c60e1ad4ca546e879c085a2821be8223c8ad2317ab
7
+ data.tar.gz: d7f91b0655d285b3f9ce75993ee7702088b35e17887590c77cd54df922703fd421000a49e08ddf6d1dc45b9e6c3d630039c8b0652048d4f0a60a527e60b98a7c
@@ -34,7 +34,7 @@ module MobileSubscriber
34
34
  http_request_headers: { 'Msisdn' => msisdn }
35
35
  }
36
36
 
37
- country_code = MobileSubscriber::DIALING_COUNTRY_CODES[msisdn[0,2]]
37
+ country_code = MobileSubscriber::DIALING_COUNTRY_CODES[msisdn[0,2]] || MobileSubscriber::DIALING_COUNTRY_CODES[msisdn[0,3]]
38
38
 
39
39
  # Determinar la procedencia del MSISDN
40
40
  # TODO: Validar por IP, etc.
@@ -22,7 +22,7 @@ module MobileSubscriber
22
22
  http_request_headers: { 'X-Nokia-Msisdn' => msisdn }
23
23
  }
24
24
 
25
- country_code = MobileSubscriber::DIALING_COUNTRY_CODES[msisdn[0,2]]
25
+ country_code = MobileSubscriber::DIALING_COUNTRY_CODES[msisdn[0,2]] || MobileSubscriber::DIALING_COUNTRY_CODES[msisdn[0,3]]
26
26
 
27
27
  # Determinar la procedencia del MSISDN
28
28
  # TODO: Validar por IP, etc.
@@ -20,7 +20,7 @@ module MobileSubscriber
20
20
  http_request_headers: { 'X-Up-Ch-Msisdn' => msisdn }
21
21
  }
22
22
 
23
- country_code = MobileSubscriber::DIALING_COUNTRY_CODES[msisdn[0,2]]
23
+ country_code = MobileSubscriber::DIALING_COUNTRY_CODES[msisdn[0,2]] || MobileSubscriber::DIALING_COUNTRY_CODES[msisdn[0,3]]
24
24
 
25
25
  # Determinar la procedencia del MSISDN
26
26
  # TODO: Validar por IP, etc.
@@ -23,7 +23,7 @@ module MobileSubscriber
23
23
  http_request_headers: { header_name => msisdn }
24
24
  }
25
25
 
26
- country_code = MobileSubscriber::DIALING_COUNTRY_CODES[msisdn[0,2]]
26
+ country_code = MobileSubscriber::DIALING_COUNTRY_CODES[msisdn[0,2]] || MobileSubscriber::DIALING_COUNTRY_CODES[msisdn[0,3]]
27
27
 
28
28
  # Determinar la procedencia del MSISDN
29
29
  # TODO: Validar por IP, etc.
@@ -1,3 +1,3 @@
1
1
  module MobileSubscriber
2
- VERSION = "0.0.1.alpha4"
2
+ VERSION = "0.0.1.alpha5"
3
3
  end
@@ -34,7 +34,7 @@ describe MobileSubscriber::Detection::FromMsisdnHttpRequestHeader do
34
34
  end
35
35
  end
36
36
 
37
- context "when given a request made from Claro Colomobia" do
37
+ context "when given a request made from Claro Colombia" do
38
38
  let(:test_request) { build :mobile_request_from_claro_colombia }
39
39
 
40
40
  include_examples "of detection of msisdn from a valid colombian mobile network http request"
@@ -43,6 +43,17 @@ describe MobileSubscriber::Detection::FromMsisdnHttpRequestHeader do
43
43
  expect(subject[:mobile_network_code]).to eq '101'
44
44
  end
45
45
  end
46
+
47
+ context "when given a request made from Claro Ecuador" do
48
+ let(:test_request) { build :mobile_request_from_claro_ecuador }
49
+
50
+ include_examples "of detection of msisdn from a valid ecuadorian mobile network http request"
51
+
52
+ it "has a :mobile_network_code value of '01'" do
53
+ expect(subject[:mobile_network_code]).to eq '01'
54
+ end
55
+ end
56
+
46
57
  end
47
58
 
48
59
  end
@@ -0,0 +1,35 @@
1
+ require "spec_helper"
2
+
3
+ describe MobileSubscriber::Detection::FromXUpCallingLineIdHttpRequestHeader do
4
+
5
+ include described_class::ClassMethods
6
+
7
+ describe "the returned object of self.extract_from_msisdn_http_request_header" do
8
+
9
+ subject do
10
+ extract_from_x_up_calling_line_id_http_request_header test_request
11
+ end
12
+
13
+ context "when given a request made from Claro Perú" do
14
+ let(:test_request) { build :mobile_request_from_claro_peru }
15
+
16
+ include_examples "of detection of msisdn from a valid peruvian mobile network http request"
17
+
18
+ it "has a :mobile_network_code value of '10'" do
19
+ expect(subject[:mobile_network_code]).to eq '10'
20
+ end
21
+ end
22
+
23
+ context "when given a request made from Movistar Perú" do
24
+ let(:test_request) { build :mobile_request_from_movistar_peru }
25
+
26
+ include_examples "of detection of msisdn from a valid peruvian mobile network http request"
27
+
28
+ it "has a :mobile_network_code value of '06'" do
29
+ expect(subject[:mobile_network_code]).to eq '06'
30
+ end
31
+ end
32
+
33
+ end
34
+
35
+ end
@@ -21,8 +21,7 @@ FactoryGirl.define do
21
21
 
22
22
  initialize_with do
23
23
  new build(:common_mobile_request_env).merge(
24
- "REMOTE_ADDR" => "201.144.162.4",
25
- "REMOTE_HOST" => "201.144.162.4"
24
+ "REMOTE_ADDR" => "201.144.162.4"
26
25
  )
27
26
  end
28
27
 
@@ -30,7 +29,6 @@ FactoryGirl.define do
30
29
  initialize_with do
31
30
  new build(:common_mobile_request_env).merge(
32
31
  "REMOTE_ADDR" => "201.144.162.4",
33
- "REMOTE_HOST" => "201.144.162.4",
34
32
  "HTTP_X_NOKIA_MSISDN" => "528110000000"
35
33
  )
36
34
  end
@@ -40,8 +38,7 @@ FactoryGirl.define do
40
38
  initialize_with do
41
39
  new build(:common_mobile_request_env).merge(
42
40
  "REMOTE_ADDR" => "170.51.255.240",
43
- "REMOTE_HOST" => "170.51.255.240",
44
- "HTTP_X_NOKIA_MSISDN" => "5491141098443"
41
+ "HTTP_X_NOKIA_MSISDN" => "5491141090000"
45
42
  )
46
43
  end
47
44
  end
@@ -50,7 +47,6 @@ FactoryGirl.define do
50
47
  initialize_with do
51
48
  new build(:common_mobile_request_env).merge(
52
49
  "REMOTE_ADDR" => "201.23.176.202",
53
- "REMOTE_HOST" => "201.23.176.202",
54
50
  "HTTP_MSISDN" => "5500000000000"
55
51
  )
56
52
  end
@@ -61,8 +57,7 @@ FactoryGirl.define do
61
57
  initialize_with do
62
58
  new build(:common_mobile_request_env).merge(
63
59
  "REMOTE_ADDR" => "191.116.39.114",
64
- "REMOTE_HOST" => "191.116.39.114",
65
- "HTTP_MSISDN" => "56024445202"
60
+ "HTTP_MSISDN" => "56024440000"
66
61
  )
67
62
  end
68
63
  end
@@ -71,18 +66,27 @@ FactoryGirl.define do
71
66
  initialize_with do
72
67
  new build(:common_mobile_request_env).merge(
73
68
  "REMOTE_ADDR" => "200.26.137.100",
74
- "REMOTE_HOST" => "200.26.137.100",
75
69
  "HTTP_MSISDN" => "57000000000"
76
70
  )
77
71
  end
78
72
  end
79
73
 
74
+ # http://myip.ms/view/ip_owners/80612/Conecel.html
75
+ factory :mobile_request_from_claro_ecuador do
76
+ initialize_with do
77
+ new build(:common_mobile_request_env).merge(
78
+ "REMOTE_ADDR" => "190.63.1.10",
79
+ "HTTP_MSISDN" => "59342690000"
80
+ )
81
+ end
82
+ end
83
+
84
+ # http://myip.ms/view/ip_owners/90291/America_Movil_Peru_S_a_c.html
80
85
  factory :mobile_request_from_claro_peru do
81
86
  initialize_with do
82
87
  new build(:common_mobile_request_env).merge(
83
- "REMOTE_ADDR" => "190.113.192.9",
84
- "REMOTE_HOST" => "190.113.192.9",
85
- "HTTP_X_UP_CALLING_LINE_ID" => "5100000000000",
88
+ "REMOTE_ADDR" => "200.108.96.5",
89
+ "HTTP_X_UP_CALLING_LINE_ID" => "5116130000",
86
90
  "HTTP_VIA" => "aa Comverse aaa"
87
91
  )
88
92
  end
@@ -92,12 +96,21 @@ FactoryGirl.define do
92
96
  initialize_with do
93
97
  new build(:common_mobile_request_env).merge(
94
98
  "REMOTE_ADDR" => "187.26.59.4",
95
- "REMOTE_HOST" => "187.26.59.4",
96
99
  "HTTP_X_UP_CH_MSISDN" => "5500000000000"
97
100
  )
98
101
  end
99
102
  end
100
103
 
104
+ # http://myip.ms/view/ip_owners/7424/Telefonica_Del_Peru_Saa.html
105
+ factory :mobile_request_from_movistar_peru do
106
+ initialize_with do
107
+ new build(:common_mobile_request_env).merge(
108
+ "REMOTE_ADDR" => "190.42.165.87",
109
+ "HTTP_X_UP_CALLING_LINE_ID" => "5112100000"
110
+ )
111
+ end
112
+ end
113
+
101
114
 
102
115
  end
103
116
  end
@@ -82,3 +82,25 @@ shared_examples "of detection of msisdn from a valid colombian mobile network ht
82
82
  expect(subject[:mobile_country_code]).to eq '732'
83
83
  end
84
84
  end
85
+
86
+ shared_examples "of detection of msisdn from a valid ecuadorian mobile network http request" do
87
+ include_examples "of detection of msisdn from a valid mobile network http request"
88
+ it "has an :id value that starts with '593'" do
89
+ expect(subject[:id]).to match /\A593/
90
+ end
91
+
92
+ it "has a :mobile_country_code value of '740'" do
93
+ expect(subject[:mobile_country_code]).to eq '740'
94
+ end
95
+ end
96
+
97
+ shared_examples "of detection of msisdn from a valid peruvian mobile network http request" do
98
+ include_examples "of detection of msisdn from a valid mobile network http request"
99
+ it "has an :id value that starts with '51'" do
100
+ expect(subject[:id]).to match /\A51/
101
+ end
102
+
103
+ it "has a :mobile_country_code value of '716'" do
104
+ expect(subject[:mobile_country_code]).to eq '716'
105
+ end
106
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mobile-subscriber
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.alpha4
4
+ version: 0.0.1.alpha5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roberto Quintanilla
@@ -127,6 +127,7 @@ files:
127
127
  - mobile_subscriber.thor
128
128
  - spec/detection/from_msisdn_http_request_header_spec.rb
129
129
  - spec/detection/from_x_nokia_msisdn_http_request_header_spec.rb
130
+ - spec/detection/from_x_up_calling_line_id_http_request_header_spec.rb
130
131
  - spec/factories/requests.rb
131
132
  - spec/mobile_subscriber_spec.rb
132
133
  - spec/models/isdn_spec.rb
@@ -161,6 +162,7 @@ summary: Mobile MSISDN detection & validation.
161
162
  test_files:
162
163
  - spec/detection/from_msisdn_http_request_header_spec.rb
163
164
  - spec/detection/from_x_nokia_msisdn_http_request_header_spec.rb
165
+ - spec/detection/from_x_up_calling_line_id_http_request_header_spec.rb
164
166
  - spec/factories/requests.rb
165
167
  - spec/mobile_subscriber_spec.rb
166
168
  - spec/models/isdn_spec.rb