class PagSeguro::Installment

Attributes

amount[RW]

Set the amount. Must fit the patern: \d+.\d{2} (e.g. “12.00”)

card_brand[RW]

Set the credit card brand.

interest_free[RW]

Set interest free.

quantity[RW]

Set the installments quantity.

total_amount[RW]

Set total amount.

Public Class Methods

find(amount, card_brand, options = {}) click to toggle source

Return a PagSeguro::Installment::Collection instance

# File lib/pagseguro/installment.rb, line 25
def self.find(amount, card_brand, options = {})
  request = Request.get("installments", api_version, options.merge(params(amount: amount, card_brand: card_brand)))
  collection = Collection.new
  Response.new(request, collection).serialize

  collection
end

Private Class Methods

api_version() click to toggle source
# File lib/pagseguro/installment.rb, line 39
def self.api_version
  'v2'
end
load_from_response(response) click to toggle source
# File lib/pagseguro/installment.rb, line 43
def self.load_from_response(response)
  if response.success? and response.xml?
    Nokogiri::XML(response.body).css("installments > installment").map do |node|
      load_from_xml(node)
    end
  else
    Response.new Errors.new(response)
  end
end
load_from_xml(xml) click to toggle source
# File lib/pagseguro/installment.rb, line 53
def self.load_from_xml(xml)
  new Serializer.new(xml).serialize
end
params(options) click to toggle source
# File lib/pagseguro/installment.rb, line 35
def self.params(options)
  RequestSerializer.new(options).to_params
end