Class: ASPSMS::Request::SendTextSMS
Instance Attribute Summary collapse
-
#blinking ⇒ Object
Returns the value of attribute blinking.
-
#flashing ⇒ Object
Returns the value of attribute flashing.
-
#originator ⇒ Object
Returns the value of attribute originator.
-
#recipients ⇒ Object
Returns the value of attribute recipients.
-
#text ⇒ Object
Returns the value of attribute text.
-
#tx_refs ⇒ Object
Returns the value of attribute tx_refs.
-
#url_buffered ⇒ Object
Returns the value of attribute url_buffered.
-
#url_delivery ⇒ Object
Returns the value of attribute url_delivery.
-
#url_nondelivery ⇒ Object
Returns the value of attribute url_nondelivery.
Attributes inherited from Abstract
Instance Method Summary collapse
- #each_element {|REXML::Element.new('Originator').add_text(@cfg.utf8(originator))| ... } ⇒ Object
-
#initialize(cfg) ⇒ SendTextSMS
constructor
A new instance of SendTextSMS.
Methods inherited from Abstract
Constructor Details
#initialize(cfg) ⇒ SendTextSMS
Returns a new instance of SendTextSMS.
190 191 192 193 194 195 196 197 198 199 200 201 |
# File 'lib/aspsms.rb', line 190 def initialize(cfg) super(cfg) @originator = @cfg.originator @recipients = [] @text = '' @flashing = false @blinking = false @tx_refs = [] @url_buffered = '' @url_delivery = '' @url_nondelivery = '' end |
Instance Attribute Details
#blinking ⇒ Object
Returns the value of attribute blinking.
188 189 190 |
# File 'lib/aspsms.rb', line 188 def blinking @blinking end |
#flashing ⇒ Object
Returns the value of attribute flashing.
188 189 190 |
# File 'lib/aspsms.rb', line 188 def flashing @flashing end |
#originator ⇒ Object
Returns the value of attribute originator.
188 189 190 |
# File 'lib/aspsms.rb', line 188 def originator @originator end |
#recipients ⇒ Object
Returns the value of attribute recipients.
188 189 190 |
# File 'lib/aspsms.rb', line 188 def recipients @recipients end |
#text ⇒ Object
Returns the value of attribute text.
188 189 190 |
# File 'lib/aspsms.rb', line 188 def text @text end |
#tx_refs ⇒ Object
Returns the value of attribute tx_refs.
188 189 190 |
# File 'lib/aspsms.rb', line 188 def tx_refs @tx_refs end |
#url_buffered ⇒ Object
Returns the value of attribute url_buffered.
188 189 190 |
# File 'lib/aspsms.rb', line 188 def url_buffered @url_buffered end |
#url_delivery ⇒ Object
Returns the value of attribute url_delivery.
188 189 190 |
# File 'lib/aspsms.rb', line 188 def url_delivery @url_delivery end |
#url_nondelivery ⇒ Object
Returns the value of attribute url_nondelivery.
188 189 190 |
# File 'lib/aspsms.rb', line 188 def url_nondelivery @url_nondelivery end |
Instance Method Details
#each_element {|REXML::Element.new('Originator').add_text(@cfg.utf8(originator))| ... } ⇒ Object
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 |
# File 'lib/aspsms.rb', line 202 def each_element yield REXML::Element.new('Originator').add_text(@cfg.utf8(originator)) @recipients = [ @recipients ] unless @recipients.kind_of?(Array) txr = @tx_refs.dup recipients.each do |recipient| rcpt = REXML::Element.new('Recipient') rcpt.elements.add(Element.new('PhoneNumber'). add_text(@cfg.utf8(recipient))) rcpt.elements.add(Element.new('TransRefNumber'). add_text(txr.shift)) unless txr.empty? yield rcpt end yield REXML::Element.new('MessageData').add_text(@cfg.utf8(text)) yield REXML::Element.new('UsedCredits').add_text('1') yield REXML::Element.new('FlashingSMS').add_text('1') if flashing yield REXML::Element.new('BlinkingSMS').add_text('1') if blinking yield REXML::Element.new('URLBufferedMessageNotification'). add_text(@cfg.utf8(url_buffered)) unless url_buffered.empty? yield REXML::Element.new('URLDeliveryNotification'). add_text(@cfg.utf8(url_delivery)) unless url_delivery.empty? yield REXML::Element.new('URLNonDeliveryNotification'). add_text(@cfg.utf8(url_nondelivery)) unless url_nondelivery.empty? end |