Class: Smsinabox::SentMessage
- Inherits:
-
Object
- Object
- Smsinabox::SentMessage
- Defined in:
- lib/smsinabox/sent_message.rb
Instance Attribute Summary collapse
-
#change_id ⇒ Object
Returns the value of attribute change_id.
-
#customer_id ⇒ Object
Returns the value of attribute customer_id.
-
#event_id ⇒ Object
Returns the value of attribute event_id.
-
#flash ⇒ Object
Returns the value of attribute flash.
-
#id ⇒ Object
Returns the value of attribute id.
-
#message ⇒ Object
Returns the value of attribute message.
-
#status ⇒ Object
Returns the value of attribute status.
-
#status_date ⇒ Object
Returns the value of attribute status_date.
-
#to ⇒ Object
Returns the value of attribute to.
-
#type ⇒ Object
Returns the value of attribute type.
Class Method Summary collapse
-
.from_response(nokogiri_xml) ⇒ Object
Generate a #SentMessage from a response xml fragment.
Instance Method Summary collapse
Instance Attribute Details
#change_id ⇒ Object
Returns the value of attribute change_id.
25 26 27 |
# File 'lib/smsinabox/sent_message.rb', line 25 def change_id @change_id end |
#customer_id ⇒ Object
Returns the value of attribute customer_id.
25 26 27 |
# File 'lib/smsinabox/sent_message.rb', line 25 def customer_id @customer_id end |
#event_id ⇒ Object
Returns the value of attribute event_id.
25 26 27 |
# File 'lib/smsinabox/sent_message.rb', line 25 def event_id @event_id end |
#flash ⇒ Object
Returns the value of attribute flash.
25 26 27 |
# File 'lib/smsinabox/sent_message.rb', line 25 def flash @flash end |
#id ⇒ Object
Returns the value of attribute id.
25 26 27 |
# File 'lib/smsinabox/sent_message.rb', line 25 def id @id end |
#message ⇒ Object
Returns the value of attribute message.
25 26 27 |
# File 'lib/smsinabox/sent_message.rb', line 25 def @message end |
#status ⇒ Object
Returns the value of attribute status.
25 26 27 |
# File 'lib/smsinabox/sent_message.rb', line 25 def status @status end |
#status_date ⇒ Object
Returns the value of attribute status_date.
25 26 27 |
# File 'lib/smsinabox/sent_message.rb', line 25 def status_date @status_date end |
#to ⇒ Object
Returns the value of attribute to.
25 26 27 |
# File 'lib/smsinabox/sent_message.rb', line 25 def to @to end |
#type ⇒ Object
Returns the value of attribute type.
25 26 27 |
# File 'lib/smsinabox/sent_message.rb', line 25 def type @type end |
Class Method Details
.from_response(nokogiri_xml) ⇒ Object
Generate a #SentMessage from a response xml fragment
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/smsinabox/sent_message.rb', line 7 def from_response( nokogiri_xml ) msg = new msg.id = nokogiri_xml.xpath('./sentid/text()').to_s.to_i msg.change_id = nokogiri_xml.xpath('./changeid/text()').to_s.to_i msg.event_id = nokogiri_xml.xpath('./eventid/text()').to_s.to_i msg.type = nokogiri_xml.xpath('./smstype/text()').to_s msg.to = nokogiri_xml.xpath('./numto/text()').to_s msg. = nokogiri_xml.xpath('./data/text()').to_s msg.flash = nokogiri_xml.xpath('./flash/text()').to_s == 'true' msg.customer_id = nokogiri_xml.xpath('./customerid/text()').to_s msg.status = nokogiri_xml.xpath('./status/text()').to_s msg.status_date = nokogiri_xml.xpath('./statusdate/text()').to_s msg end |
Instance Method Details
#delivered? ⇒ Boolean
28 29 30 |
# File 'lib/smsinabox/sent_message.rb', line 28 def delivered? @status == 'DELIVRD' end |