class PagSeguro::TransactionRefund::Response

Attributes

object[R]

The PagSeguro::Refund object to return

response[R]

The request response.

Public Class Methods

new(response, object) click to toggle source
# File lib/pagseguro/transaction_refund/response.rb, line 4
def initialize(response, object)
  @response = response
  @object = object
end

Public Instance Methods

serialize() click to toggle source
# File lib/pagseguro/transaction_refund/response.rb, line 9
def serialize
  if success?
    xml = Nokogiri::XML(response.body)
    serializer = ResponseSerializer.new(xml).serialize
    object.update_attributes(serializer)
  else
    object.errors.add(response)
  end

  object
end
success?() click to toggle source
# File lib/pagseguro/transaction_refund/response.rb, line 21
def success?
  response.success? && response.xml?
end