sunilkumarn / sanitize_msisdns

A small ruby gem to sanitize MSISDNS.
1 stars 3 forks source link

Sanitize MSISDNS as per mobile number format. This is specially useful for formating Android mobile numbers which are stored in different formats. Currently only Indian MSISDNs are supported.

Usage

gem install sanitized_msisdns

require 'msisdn_sanitizer'

MSISDN::Sanitizer.sanitize('00919876543210')
 => ["+919876543210"]

MSISDN::Sanitizer.sanitize('0987-6543210')
 => ["+919876543210"]

MSISDN::Sanitizer.sanitize(['00919876543210', '9037 123 456', '04972123465'])
 => ["+919876543210", "+919037123456"]

MSISDN::Sanitizer.sanitize(9876543210)
 => ["+919876543210"]

You could also specify options, format & country_code ( Right now the only supported country code is ':in') The defaults are { :country_code => :in, :format => 'international' }

MSISDN::Sanitizer.sanitize(['00919876543210', '9037 123 456', '04972123465'], format: 'local')
 => ["9876543210", "9037123456"]