Module: SMSFu

Defined in:
lib/sms_fu.rb

Overview

WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Defined Under Namespace

Classes: SMSFuException

Constant Summary collapse

RAILS_CONFIG_ROOT =
defined?(RAILS_ROOT) ? "#{RAILS_ROOT}/config" : "#{File.dirname(__FILE__)}/../templates"

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.carriersObject



29
30
31
# File 'lib/sms_fu.rb', line 29

def self.carriers
  @@carriers.dup
end

Instance Method Details

#deliver_sms(number, carrier, message, options = {}) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/sms_fu.rb', line 33

def deliver_sms(number,carrier,message,options={})
  number = format_number(number)
  raise SMSFuException.new("Cannot deliver an empty message to #{number}") if message.nil? or message.empty?
  
  options[:limit] ||= message.length
  message = message[0..options[:limit]-1]
  sms_email = determine_sms_email(format_number(number),carrier)
  
  SmsNotifier.deliver_sms_message(sms_email,message)
rescue SMSFuException => exception
  raise exception
end

#get_sms_address(number, carrier) ⇒ Object



46
47
48
49
# File 'lib/sms_fu.rb', line 46

def get_sms_address(number,carrier)
  number = format_number(number)
  determine_sms_email(number,carrier)
end