class PagSeguro::Installment::Response

Attributes

collection[R]
response[R]

The request response.

Public Class Methods

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

Public Instance Methods

serialize() click to toggle source
# File lib/pagseguro/installment/response.rb, line 9
def serialize
  if success?
    collection.installments = serialize_installments
  else
    collection.errors.add(response)
  end

  collection
end
success?() click to toggle source
# File lib/pagseguro/installment/response.rb, line 19
def success?
  response.success? && response.xml?
end

Private Instance Methods

serialize_installments() click to toggle source
# File lib/pagseguro/installment/response.rb, line 30
def serialize_installments
  Nokogiri::XML(response.body).css("installments > installment").map do |node|
    ResponseSerializer.new(node).serialize
  end
end