class PagSeguro::Authorization::Response
Attributes
object[R]
The PagSeguro::Authorization
or PagSeguro::Authorization::Collection
object
response[R]
The request response.
Public Class Methods
new(response, object)
click to toggle source
# File lib/pagseguro/authorization/response.rb, line 4 def initialize(response, object) @response = response @object = object end
Public Instance Methods
serialize()
click to toggle source
# File lib/pagseguro/authorization/response.rb, line 9 def serialize if success? xml = Nokogiri::XML(response.body).css('authorization').first serializer = ResponseSerializer.new(xml).serialize object.update_attributes(serializer) else object.errors.add(response) end object end
serialize_collection()
click to toggle source
# File lib/pagseguro/authorization/response.rb, line 21 def serialize_collection if success? object.authorizations = serialize_authorizations else object.errors.add(response) end object end
success?()
click to toggle source
# File lib/pagseguro/authorization/response.rb, line 31 def success? response.success? && response.xml? end