Class: Smsinabox::SentMessage

Inherits:
Object
  • Object
show all
Defined in:
lib/smsinabox/sent_message.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#change_idObject

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_idObject

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_idObject

Returns the value of attribute event_id.



25
26
27
# File 'lib/smsinabox/sent_message.rb', line 25

def event_id
  @event_id
end

#flashObject

Returns the value of attribute flash.



25
26
27
# File 'lib/smsinabox/sent_message.rb', line 25

def flash
  @flash
end

#idObject

Returns the value of attribute id.



25
26
27
# File 'lib/smsinabox/sent_message.rb', line 25

def id
  @id
end

#messageObject

Returns the value of attribute message.



25
26
27
# File 'lib/smsinabox/sent_message.rb', line 25

def message
  @message
end

#statusObject

Returns the value of attribute status.



25
26
27
# File 'lib/smsinabox/sent_message.rb', line 25

def status
  @status
end

#status_dateObject

Returns the value of attribute status_date.



25
26
27
# File 'lib/smsinabox/sent_message.rb', line 25

def status_date
  @status_date
end

#toObject

Returns the value of attribute to.



25
26
27
# File 'lib/smsinabox/sent_message.rb', line 25

def to
  @to
end

#typeObject

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.message = 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

Returns:

  • (Boolean)


28
29
30
# File 'lib/smsinabox/sent_message.rb', line 28

def delivered?
  @status == 'DELIVRD'
end