Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cogi_phony

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cogi_phony

  • 0.0.6
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

CogiPhony Build Status Coverage Status GitHub issues Gem Version

This gem provide you library to validate, parsing, format and normalize phone number, detect phone network in Vietnam.

It uses the super awesome Phony gem (https://github.com/floere/phony).

Installation

Add this line to your application's Gemfile:

gem 'cogi_phony'

And then execute:

$ bundle

Or install it yourself as:

$ gem install cogi_phony

Usage

Validation

Check if a string is a valid phone number.

CogiPhony.validate? '+14037089189' # => true

Normalization

Normalize phone numer to international format.

CogiPhony.normalize '+1 (403) 708-9189' # => '+14037089189'

Formatting

Format formats phone numbers according to the predominant format of a country.

CogiPhony.format '+84933081090' # => +84 93 3081090
CogiPhony.format '+84933081090', format: 'global' # => '+84 93 3081090'
CogiPhony.format '+84933081090', format: 'vietnam' # => '093 3081090'

Extract country code

Extract country code from phone number.

CogiPhony.country_code_from_number '+84933081090' # => '84'

Check if Vietnam mobile phone

Check if phone number is Vietnam mobile phone format

CogiPhony.vn_mobile_phone? '+84933081090' # => true

Phone provider

Return phone provider from phone number.

CogiPhony.phone_to_provider '+84933081090' # => 'Mobifone'

Contributing

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

Don't forget to add tests and run rspec before creating a pull request :)

See all contributors on https://github.com/hoahm/cogi_phony/graphs/contributors.

FAQs

Package last updated on 12 Sep 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc