Module SmsOnRails::ModelSupport::ClassMethods
In: lib/sms_on_rails/model_support/phone_number.rb

Methods

Public Instance methods

adds a sanitize search for numbers for the options used for finders Use with find for other ActiveRecord objects

  Outbound.find :all, add_number_search([1,2,3], :conditions => 'outbounds.send_priority == 1')

The digits (numbers) only of the phone number Digits are how phone numbers are stored in the database The following all return +12065555555+

 SmsOnRails::digits(12065555555')
 SmsOnRails::digits(206.555.5555')
 SmsOnRails::digits(1206-555  5555')

Find all numbers (sanitized) that match a list of String numbers

Find all numbers and create if it doesn‘t already exist number_list - a list of numbers (String, ActiveRecord or attribute hash) options - additional create options and normal finder options like :conditions

Additional Options

:create - :new(Default), :create, or :create! If the number does not exist, create it with this method. Using :new means none of the objects are saved :keep_duplicates<tt> - When set to true, duplicates in the list are returned <tt>:skip_sort - Default is to sort the list to be in the same order as number_list. Set to false to skip sorting (perf boost). Instance creation or attribute update does not occur when skip_sort is false.

Find a number and create if it does not exist options include those specified in find_all_and_create_by_number

Return the phone number with specified carrier if the phone number is an sms email address

The human display pretty phone number (206) 555-5555

Protected Instance methods

Return a sorted list of PhoneNumber instances Will create new records for missing records if attribute_list is specified unsorted_list - unsorted list of PhoneNumbers sorted_digits - sorted list of digits (Strings) attribute_list - optional list of attributes in sorted order creation_method - :create, :new, or :create!

create new records for any records not found update the attributes of the found records save if :create

[Validate]