Sha256: 02499a430b4e4cd64da0afad16f5186710be155a8b0a2ec2de43a4907e8b3beb

Contents?: true

Size: 831 Bytes

Versions: 16

Compression:

Stored size: 831 Bytes

Contents

#TODO: different base_uri's for get_balance and send_message
module SmsTools
  class Routomessaging < Base
    base_uri "http://smsc5.routotelecom.com"

    def initialize(*args)
      @uname, @passwd = args.shift, args.shift
    end

    #send_message TO, MESSAGE, FROM
    def send_message(*args)
      add_query_options! :user => @uname, :pass => @passwd, :type => 'LongSMS'

      (post 'SMSsend', :extra_query => {
         :number => args.shift,
         :message => args.shift,
         :ownnum => args.shift})
    end

    def get_balance
      # TODO: change base_uri before executing the query
      # self.base_uri 'http://smsc6.routotelecom.com'
      add_query_options! :username => @uname, :password => @passwd, :base_uri => 'http://smsc6.routotelecom.com'

      (post 'balance.php').to_s.chomp
    end
  end
end

#

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
smshelper-0.4.5 lib/smshelper/api/routomessaging.rb
smshelper-0.4.0 lib/smshelper/api/routomessaging.rb
smshelper-0.3.1 lib/smshelper/api/routomessaging.rb
smshelper-0.3.0 lib/smshelper/api/routomessaging.rb
smshelper-0.2.10 lib/smshelper/api/routomessaging.rb
smshelper-0.2.9 lib/smshelper/api/routomessaging.rb
smshelper-0.2.8 lib/smshelper/api/routomessaging.rb
smshelper-0.2.7 lib/smshelper/api/routomessaging.rb
smshelper-0.2.6 lib/smshelper/api/routomessaging.rb
smshelper-0.2.5 lib/smshelper/api/routomessaging.rb
smshelper-0.2.4 lib/smshelper/api/routomessaging.rb
smshelper-0.2.3 lib/smshelper/api/routomessaging.rb
smshelper-0.2.2 lib/smshelper/api/routomessaging.rb
smshelper-0.2.1 lib/smshelper/api/routomessaging.rb
smshelper-0.2.0 lib/smshelper/api/routomessaging.rb
smshelper-0.1.3 lib/smshelper/api/routomessaging.rb