Module: Routo

Defined in:
lib/routo.rb,
lib/routo/number.rb,
lib/routo/message.rb,
lib/routo/exception.rb,
lib/routo/exception/error.rb,
lib/routo/exception/failed.rb,
lib/routo/exception/too_long.rb,
lib/routo/exception/no_message.rb,
lib/routo/exception/wrong_type.rb,
lib/routo/exception/auth_failed.rb,
lib/routo/exception/not_allowed.rb,
lib/routo/exception/bad_operator.rb,
lib/routo/exception/system_error.rb,
lib/routo/exception/wrong_format.rb,
lib/routo/exception/wrong_number.rb,
lib/routo/exception/wrong_message.rb,
lib/routo/exception/no_credits_left.rb,
lib/routo/exception/too_many_numbers.rb

Defined Under Namespace

Modules: Exception Classes: Message, Number

Constant Summary collapse

@@username =
""
@@password =
""
@@http_api_url =
"http://smsc5.routotelecom.com/SMSsend"
@@http_api_url_backup =
"http://smsc56.routotelecom.com/SMSsend"
@@delivery =
0
@@email_options =
{}
@@seconds_between_mails =
600
@@no_credits_left =
{:subject => 'Routo Messaging: no credits left', :body => 'You do not have any credit left on Routo messaging. You should buy some more credits in order to be able to send more SMS.'}
@@using_backup_url =
{:subject => 'Routo Messaging: using backup url', :body => 'The primary Routo Messaging http API url was not responding correctly. We tried the backup API.'}

Class Method Summary collapse

Class Method Details

.balanceObject

not tested



47
48
49
50
# File 'lib/routo.rb', line 47

def self.balance
  balance = open("http://smsc5.routotelecom.com/balance.php?username=#{URI.encode(Routo.username)}=&password=#{URI.encode(Routo.password)}")
  balance.to_i
end

.config {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (Routo)

    the object that the method was called on



37
38
39
40
# File 'lib/routo.rb', line 37

def self.config
  yield self
  Pony.options = @@email_options
end

.send_sms(msg, *numbers) ⇒ Object



42
43
44
# File 'lib/routo.rb', line 42

def self.send_sms msg, *numbers
  Message.new(msg).send_sms(*numbers)
end