lib/dineromail/notification.rb in dineromail-0.0.2 vs lib/dineromail/notification.rb in dineromail-0.0.3
- old
+ new
@@ -2,11 +2,11 @@
module Dineromail
class Notification
attr_reader :transaction_id, :tipo
- def initialize(transaction_id, tipo = null)
+ def initialize(transaction_id, tipo = nil)
@transaction_id = transaction_id
@tipo = tipo
end
def status_report
@@ -16,17 +16,21 @@
@status_report
end
def self.from_xml(notification_xml)
notifications = []
- notificaction_data = XmlSimple.xml_in(notification_xml)
- operations = notificaction_data['operaciones'].first['operacion']
+ notificaction_data = XmlSimple.xml_in(notification_xml,'KeyToSymbol' => true)
+ operations = notificaction_data[:operaciones].first[:operacion]
operations.each do |operation|
- tipo = operation['tipo'].first
- transaction_id = operation['id'].first
+ tipo = operation[:tipo].first
+ transaction_id = operation[:id].first
notifications << self.new(transaction_id, tipo)
end
notifications
+ end
+
+ def self.method_missing(symbol, *args)
+ status_report.send(symbol, *args)
end
end
end
\ No newline at end of file