Class: SMSBox::WebsendRequest

Inherits:
XMLRequest show all
Defined in:
lib/sms_box/websend_request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from XMLRequest

#to_xml

Constructor Details

#initializeWebsendRequest

Returns a new instance of WebsendRequest.



12
13
14
# File 'lib/sms_box/websend_request.rb', line 12

def initialize
  self.receivers = []
end

Instance Attribute Details

#maximum_sms_amountObject

Returns the value of attribute maximum_sms_amount.



10
11
12
# File 'lib/sms_box/websend_request.rb', line 10

def maximum_sms_amount
  @maximum_sms_amount
end

#passwordObject

Returns the value of attribute password.



6
7
8
# File 'lib/sms_box/websend_request.rb', line 6

def password
  @password
end

#receiversObject

Returns the value of attribute receivers.



9
10
11
# File 'lib/sms_box/websend_request.rb', line 9

def receivers
  @receivers
end

#serviceObject

Returns the value of attribute service.



7
8
9
# File 'lib/sms_box/websend_request.rb', line 7

def service
  @service
end

#textObject

Returns the value of attribute text.



8
9
10
# File 'lib/sms_box/websend_request.rb', line 8

def text
  @text
end

#usernameObject

Returns the value of attribute username.



5
6
7
# File 'lib/sms_box/websend_request.rb', line 5

def username
  @username
end

Instance Method Details

#commandObject



16
17
18
# File 'lib/sms_box/websend_request.rb', line 16

def command
  'WEBSEND'
end

#decorate_xml(xml) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/sms_box/websend_request.rb', line 20

def decorate_xml(xml)
  xml.SMSBoxXMLRequest do |root|
    super(root)
    root.parameters do |parameters|
      receivers.each do |r|
        parameters.multiReceiver r
      end
      parameters.service service
      parameters.text_ text
      if maximum_sms_amount.present?
        parameters.maximumSMSAmount maximum_sms_amount
      end
    end
    xml
  end
end