class PagseguroCatcher::Transaction::Base
Public Class Methods
new(xml)
click to toggle source
# File lib/pagseguro_catcher/transaction/base.rb, line 7 def initialize(xml) self.body = Hash.from_xml(xml)["transaction"] self.body.recursive_symbolize_keys! if self.body end
Public Instance Methods
amount()
click to toggle source
# File lib/pagseguro_catcher/transaction/base.rb, line 12 def amount @amount ||= PagseguroCatcher::Transaction::Amount.new(self.body) @amount end
date()
click to toggle source
# File lib/pagseguro_catcher/transaction/base.rb, line 41 def date self[:date].to_datetime.change(:offset => "-0300") end
each_item() { |item| ... }
click to toggle source
# File lib/pagseguro_catcher/transaction/base.rb, line 37 def each_item self.items.each { |item| yield item } end
items()
click to toggle source
# File lib/pagseguro_catcher/transaction/base.rb, line 27 def items @items = [] self[:items][:item].each do |item| @items << PagseguroCatcher::Transaction::Item.new(item) end @items end
last_event_date()
click to toggle source
# File lib/pagseguro_catcher/transaction/base.rb, line 45 def last_event_date self[:lastEventDate].to_datetime.change(:offset => "-0300") end
payment_method_code()
click to toggle source
# File lib/pagseguro_catcher/transaction/base.rb, line 61 def payment_method_code PAYMENT_CODES[self[:paymentMethod][:code].to_i] end
payment_method_type()
click to toggle source
# File lib/pagseguro_catcher/transaction/base.rb, line 57 def payment_method_type PAYMENT_TYPES[self[:paymentMethod][:type].to_i] end
sender()
click to toggle source
# File lib/pagseguro_catcher/transaction/base.rb, line 17 def sender @sender ||= PagseguroCatcher::Transaction::Sender.new(self.body) @sender end
shipping()
click to toggle source
# File lib/pagseguro_catcher/transaction/base.rb, line 22 def shipping @shipping ||= PagseguroCatcher::Transaction::Shipping.new(self.body) @shipping end
transaction_status()
click to toggle source
# File lib/pagseguro_catcher/transaction/base.rb, line 53 def transaction_status TRANSACTION_STATUS[self[:status].to_i] end
transaction_type()
click to toggle source
# File lib/pagseguro_catcher/transaction/base.rb, line 49 def transaction_type TRANSACTION_TYPES[self[:type].to_i] end