Sha256: e5db254daf9e0bc44a6b29c4fc2fd3079b453768f172341a309c752ed7b810a1

Contents?: true

Size: 809 Bytes

Versions: 1

Compression:

Stored size: 809 Bytes

Contents

require 'xmlsimple'
module Dineromail
  class Notification
    
    attr_reader :transaction_id, :tipo
    
    def initialize(transaction_id, tipo = null)
      @transaction_id = transaction_id
      @tipo = tipo
    end
    
    def status_report
      unless @status_report
        @status_report = StatusReport.new(transaction_id)
      end
      @status_report
    end
    
    def self.from_xml(notification_xml)
      notifications = []
      notificaction_data = XmlSimple.xml_in(notification_xml)
      operations = notificaction_data['operaciones'].first['operacion']
      operations.each do |operation|
        tipo = operation['tipo'].first
        transaction_id = operation['id'].first
        notifications << self.new(transaction_id, tipo)
      end
      notifications
    end
    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dineromail-0.0.2 lib/dineromail/notification.rb