Class: Esendex::MessageFailedEvent

Inherits:
Object
  • Object
show all
Includes:
HashSerialisation
Defined in:
lib/esendex/message_failed_event.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Methods included from HashSerialisation

#initialize, #to_hash

Instance Attribute Details

#account_idObject

Returns the value of attribute account_id.



16
17
18
# File 'lib/esendex/message_failed_event.rb', line 16

def 
  @account_id
end

#idObject

Returns the value of attribute id.



16
17
18
# File 'lib/esendex/message_failed_event.rb', line 16

def id
  @id
end

#message_idObject

Returns the value of attribute message_id.



16
17
18
# File 'lib/esendex/message_failed_event.rb', line 16

def message_id
  @message_id
end

#occurred_atObject

Returns the value of attribute occurred_at.



16
17
18
# File 'lib/esendex/message_failed_event.rb', line 16

def occurred_at
  @occurred_at
end

Class Method Details

.from_xml(source) ⇒ Object



18
19
20
21
22
23
24
25
26
27
# File 'lib/esendex/message_failed_event.rb', line 18

def self.from_xml(source)
  doc = Nokogiri::XML source
  event = MessageFailedEvent.new
  event.id = doc.at_xpath("/MessageFailed/Id").content
  event.message_id = doc.at_xpath("/MessageFailed/MessageId").content
  event. = doc.at_xpath("/MessageFailed/AccountId").content
  occurred_at_s = doc.at_xpath("/MessageFailed/OccurredAt").content
  event.occurred_at = DateTime.strptime(occurred_at_s, "%Y-%m-%dT%H:%M:%S").to_time
  event
end