Project

piliponi

0.01
No commit activity in last 3 years
No release in over 3 years
Philippine Mobile Phone Formatter
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3
>= 0
>= 0
 Project Readme

Piliponi

Gem Version Build Status

Simple mobile phone formatter for the Philippines

Installation

Add this line to your application's Gemfile:

gem 'piliponi'

And then execute:

$ bundle

Or install it yourself as:

$ gem install piliponi

Usage

Include piliponi to your class to use its methods or access it directly as singleton methods.

class Dummy
  include Piliponi
end

dummy = Dummy.new

###Plausible Check if the number is a probable mobile number

Piliponi.plausible? "09170000001"   #true
dummy.plausible? "091700000001"     #true
dummy.plausible? "NotaNumber"       #false

###Clean Removes Non-numeric characters

Piliponi.clean "+639-17-000-0001" #639170000001
dummy.clean "+639-17-000-0001"    #639170000001

###Telco Returns local Telco coverage of a given number

Piliponi.telco "09170000001" #globe
dummy.telco "09170000001" #globe

###Normalization Returns formatted numbers as specified

####Local

Piliponi.normalize("0917-000-0000", format: :local) #09170000000
dummy.normalize("0917-000-0000", format: :local) #09170000000

####International

Piliponi.normalize("0917-000-0000", format: :international) #+639170000000
dummy.normalize("0917-000-0000", format: :international) #+639170000000

####Pure

Piliponi.normalize("0917-000-0000", format: :pure) #9170000000
dummy.normalize("0917-000-0000", format: :pure) #9170000000

####Erroneous Numbers

Piliponi.normalize("wat", format: :pure) #Piliponi::InvalidPhoneNumberException
dummy.normalize("wat", format: :pure) #Piliponi::InvalidPhoneNumberException

####Wrong format

Piliponi.normalize("0917-000-0000", format: :none) #Piliponi::FormatNotRecognizedException
dummy.normalize("0917-000-0000", format: :none) #Piliponi::FormatNotRecognizedException

##Needs

Accepting Integers

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Add Rspec Tests
  4. Commit your changes (git commit -am 'Add some feature')
  5. Push to the branch (git push origin my-new-feature)
  6. Create new Pull Request

License

Copyright (c) 2013 Ace Dimasuhid. See LICENSE for details.