piliponi 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +8 -0
- data/README.md +8 -0
- data/lib/piliponi/piliponi_api.rb +7 -4
- data/lib/piliponi/version.rb +1 -1
- data/lib/piliponi.rb +3 -2
- data/spec/piliponi_spec.rb +9 -1
- metadata +4 -3
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# Piliponi
|
2
2
|
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/piliponi.png)](http://badge.fury.io/rb/piliponi) [![Build Status](https://travis-ci.org/adimasuhid/piliponi.png?branch=master)](https://travis-ci.org/adimasuhid/piliponi)
|
4
|
+
|
3
5
|
Simple mobile phone formatter for the Philippines
|
4
6
|
|
5
7
|
## Installation
|
@@ -73,3 +75,9 @@ Thorough testing
|
|
73
75
|
4. Commit your changes (`git commit -am 'Add some feature'`)
|
74
76
|
5. Push to the branch (`git push origin my-new-feature`)
|
75
77
|
6. Create new Pull Request
|
78
|
+
|
79
|
+
## License
|
80
|
+
|
81
|
+
Copyright (c) 2013 Ace Dimasuhid. See [LICENSE] for details.
|
82
|
+
|
83
|
+
[LICENSE]: http://github.com/adimasuhid/piliponi/blob/master/LICENSE.txt
|
@@ -1,10 +1,11 @@
|
|
1
1
|
module Piliponi
|
2
2
|
class PiliponiApi
|
3
3
|
def lookup(prefix)
|
4
|
-
smart = %w{0813 0918 0947 0998 0999
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
smart = %w{0813 0918 0947 0998 0999}
|
5
|
+
globe = %w{0817 0905 0906 0915 0916 0917 0925 0926 0927 0935 0936 0937 0945 0994 0995 0996 0997}
|
6
|
+
sun = %w{0922 0923 0932 0933 0934 0942 0943}
|
7
|
+
smart_others = %w{0907 0908 0909 0910 0912 0919 0920 0921 0928 0929 0930 0938 0939 0946 0948 0949 0989}
|
8
|
+
|
8
9
|
|
9
10
|
if smart.include? prefix
|
10
11
|
"smart"
|
@@ -12,6 +13,8 @@ module Piliponi
|
|
12
13
|
"globe"
|
13
14
|
elsif sun.include? prefix
|
14
15
|
"sun"
|
16
|
+
elsif smart_others.include? prefix
|
17
|
+
"smart_others"
|
15
18
|
else
|
16
19
|
"unknown"
|
17
20
|
end
|
data/lib/piliponi/version.rb
CHANGED
data/lib/piliponi.rb
CHANGED
@@ -9,9 +9,10 @@ module Piliponi
|
|
9
9
|
clean_num = clean(number)
|
10
10
|
size = clean_num.size
|
11
11
|
|
12
|
-
(clean_num[0] == "9" && size == 10) ||
|
12
|
+
((clean_num[0] == "9" && size == 10) ||
|
13
13
|
(clean_num[0..1] == "63" && size == 12) ||
|
14
|
-
(clean_num[0..1] == "09" && size == 11)
|
14
|
+
(clean_num[0..1] == "09" && size == 11)) &&
|
15
|
+
telco?(clean_num) != "unknown"
|
15
16
|
end
|
16
17
|
|
17
18
|
def normalize(number, options={})
|
data/spec/piliponi_spec.rb
CHANGED
@@ -76,12 +76,20 @@ describe Piliponi do
|
|
76
76
|
|
77
77
|
context "#telco?" do
|
78
78
|
it "returns smart for 09XX" do
|
79
|
-
dummy.telco?('
|
79
|
+
dummy.telco?('09181234567').should eq('smart')
|
80
80
|
end
|
81
81
|
|
82
82
|
it "returns globe for 09XX" do
|
83
83
|
dummy.telco?("09170000000").should eq("globe")
|
84
84
|
end
|
85
|
+
|
86
|
+
it "returns sun for 09XX" do
|
87
|
+
dummy.telco?("09220000000").should eq("sun")
|
88
|
+
end
|
89
|
+
|
90
|
+
it "returns talk and text/ addict or red" do
|
91
|
+
dummy.telco?("09070000000").should eq("smart_others")
|
92
|
+
end
|
85
93
|
end
|
86
94
|
|
87
95
|
context '#prefix' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: piliponi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-08-
|
12
|
+
date: 2013-08-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -67,6 +67,7 @@ extensions: []
|
|
67
67
|
extra_rdoc_files: []
|
68
68
|
files:
|
69
69
|
- .gitignore
|
70
|
+
- .travis.yml
|
70
71
|
- Gemfile
|
71
72
|
- LICENSE.txt
|
72
73
|
- README.md
|
@@ -98,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
98
99
|
version: '0'
|
99
100
|
requirements: []
|
100
101
|
rubyforge_project:
|
101
|
-
rubygems_version: 1.8.
|
102
|
+
rubygems_version: 1.8.24
|
102
103
|
signing_key:
|
103
104
|
specification_version: 3
|
104
105
|
summary: Mobile Phone Number Formatter for the Philippines
|