Project

gphone

0.01
No commit activity in last 3 years
No release in over 3 years
ruby bindings for Google's libphonenumber (see http://code.google.com/p/libphonenumber/)
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 1.0.0
~> 1.8.4
~> 3.12
~> 2.8.0

Runtime

>= 0
 Project Readme

gphone

Ruby bindings to Google's libphonenumber (http://code.google.com/p/libphonenumber/). With gphone you can parse, validate and normalize and format phone numbers and determine their type. So far this library offers only very basic coverage of the features the C++ library offers.

Usage

GPhone

require 'gphone'

ph = GPhone.new('+49 09131/76352435', 'DE')

ph.valid?
> true

ph.possible?
> true

ph.normalize
> "+49913176352435"

ph.format_national
> "09131 76352435"

ph.type
> "fixed line"

ph.raw_number
> "+49 09131/76352435"

ph.country_code
> 'DE'

ph.numeric_country_code
> 49

ph.national_number
> 913176352435

GPhoneOfflineGeocoder

geocoder = GPhoneOfflineGeocoder.new()

gastgeocoder.get_location_for_number('12063554274')
> "Washington"

GPhoneNumberMatcher

m = GPhoneNumberMatcher.new('Hier steht eine Nummer: 0211/543235-3, und hier noch eine: +1 213 542 8427.', 'DE')
m.numbers
> ["0211/543235-3", "+1 213 542 8427"]

Contribute

Feel free to fork this repository and send me pull requests if you add functionality.