Class SmsOnRails::ServiceProviders::Base
In: lib/sms_on_rails/service_providers/base.rb
Parent: Object

Methods

Included Modules

Singleton

Protected Class methods

Locate the service provider object by provider_id, string, symbol, or ServiceProvider object Defaults to the default service provider

  SmsOnRails::ServiceProviders::Base.get_service_provider :dummy
  SmsOnRails::ServiceProviders::Base.get_service_provider 1
  SmsOnRails::ServiceProviders::Base.get_service_provider SmsOnRails::ServiceProviders::Dummy

Human name of provider

Name of service provider (downcase no spaces)

Locate the service provider by provider id

 Example: SmsOnRails::ServiceProviders::Base.provider_by_id 1

Locate the service provider by name or symbol

 Example: SmsOnRails::ServiceProviders::Base.provider_by_name :dummy

List of all providers available

Hash map of provider_id to the provider

Public Instance methods

Deliver all the sms messages marked with this as its sms service provider

Sends a message to a phone number directly to the provider. No validations are performed

  • phone_number the exact string text to send
  • message - the string message to send
  • options - additional options to be used by the provider

Send an Sms with validation sms is an sms active record object that responds to phone_number and full_message

Refer to send_to_phone for more infomation on validation

Sends a message to a phone number active record object or string and performs validation on the phone_number

  • phone_number can be either a phone number active record obj or a string text. Strings are converted to phone_number objects
  • message - the message to send
  • options - additional options to be used by the provider

Options

:skip_validation - skips validation and sends the message directly to the provider

Protected Instance methods

Raise exception if invalid data is entered

Raise an exception if this phone_number is marked as do not send

Raise an exception if the white list is being used (only sends to people on this list) and this phone number is not on the list

can override in subclass if different finder should be used

override this if the expected format differs in subclass

The class used for phone numbers can be overwritten and specified in environment.rb

return the appropriate exception class Return a fatal error if the block returns true and a non fatal if the block returns false

[Validate]