Class: Smsinabox::Reply

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#event_idObject

Returns the value of attribute event_id.



24
25
26
# File 'lib/smsinabox/reply.rb', line 24

def event_id
  @event_id
end

#fromObject

Returns the value of attribute from.



24
25
26
# File 'lib/smsinabox/reply.rb', line 24

def from
  @from
end

#idObject

Returns the value of attribute id.



24
25
26
# File 'lib/smsinabox/reply.rb', line 24

def id
  @id
end

#messageObject

Returns the value of attribute message.



24
25
26
# File 'lib/smsinabox/reply.rb', line 24

def message
  @message
end

#originalObject

Returns the value of attribute original.



24
25
26
# File 'lib/smsinabox/reply.rb', line 24

def original
  @original
end

#receivedObject

Returns the value of attribute received.



24
25
26
# File 'lib/smsinabox/reply.rb', line 24

def received
  @received
end

#sentObject

Returns the value of attribute sent.



24
25
26
# File 'lib/smsinabox/reply.rb', line 24

def sent
  @sent
end

#sent_customer_idObject

Returns the value of attribute sent_customer_id.



24
25
26
# File 'lib/smsinabox/reply.rb', line 24

def sent_customer_id
  @sent_customer_id
end

#sent_idObject

Returns the value of attribute sent_id.



24
25
26
# File 'lib/smsinabox/reply.rb', line 24

def sent_id
  @sent_id
end

Class Method Details

.from_response(nokogiri_xml) ⇒ Object

Generate a reply from the nokogiri response fragment



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/smsinabox/reply.rb', line 7

def from_response( nokogiri_xml )
  reply = new

  reply.id = nokogiri_xml.xpath('./replyid/text()').to_s.to_i
  reply.event_id = nokogiri_xml.xpath('./eventid/text()').to_s.to_i
  reply.from = nokogiri_xml.xpath('./numfrom/text()').to_s
  reply.message = nokogiri_xml.xpath('./receiveddata/text()').to_s
  reply.sent_id = nokogiri_xml.xpath('./sentid/text()').to_s.to_i
  reply.original = nokogiri_xml.xpath('./sentdata/text()').to_s
  reply.sent_customer_id = nokogiri_xml.xpath('./sentcustomerid/text()').to_s
  reply.received = nokogiri_xml.xpath('./received/text()').to_s
  reply.sent = nokogiri_xml.xpath('./sentdatetime/text()').to_s

  reply
end