class PagSeguro::Transaction::Response
Attributes
object[R]
Set the that will receive errors or updates
response[R]
The http response.
Public Class Methods
new(response, object)
click to toggle source
# File lib/pagseguro/transaction/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/response.rb, line 9 def serialize if success? object.update_attributes(Serializer.new(xml).serialize) else object.errors.add response end object end
serialize_statuses()
click to toggle source
# File lib/pagseguro/transaction/response.rb, line 19 def serialize_statuses if success? object.statuses = Serializer.new(xml).serialize_status_history else object.errors.add(response) end object end
success?()
click to toggle source
# File lib/pagseguro/transaction/response.rb, line 29 def success? response.success? && response.xml? end
Private Instance Methods
xml()
click to toggle source
# File lib/pagseguro/transaction/response.rb, line 40 def xml Nokogiri::XML(response.body) end