class SmswayApi::Method::SendMessage

Public Class Methods

new(*args) click to toggle source
# File lib/smsway_api/method/send_message.rb, line 3
def initialize *args
  if args.first.is_a?(SmswayApi::Message)
    @messages = args
  elsif args.length == 2 && args.first.is_a?(String)
    @messages = []
    sms = SmswayApi::Message::Sms.new(args.first)
    sms.add_recipient(args.last)
    @messages << sms
  else
    @messages = Array.wrap(args.first)
  end
end

Public Instance Methods

build_xml() click to toggle source
Calls superclass method SmswayApi::Method#build_xml
# File lib/smsway_api/method/send_message.rb, line 16
def build_xml
  super do |xml|
    abonents = 1
    @messages.each do |m|
      m.build(xml, abonents)
      abonents += m.recepients.size
    end
  end
end
parse(response) click to toggle source
# File lib/smsway_api/method/send_message.rb, line 30
def parse response
  Hash.from_xml(response)
end
uri() click to toggle source
# File lib/smsway_api/method/send_message.rb, line 26
def uri
  'xml/index.php'
end