class Pagseguro::Charge::Summary

Credit card data

Attributes

paid[RW]
refunded[RW]
total[RW]

Public Class Methods

fill_from_json(data) click to toggle source
# File lib/pagseguro/charge/summary.rb, line 22
def self.fill_from_json(data)
  return if data.nil?

  summary = new
  summary.total = data["total"]
  summary.paid = data["paid"]
  summary.refunded = data["refunded"]
  summary
end
new(args = {}) click to toggle source
# File lib/pagseguro/charge/summary.rb, line 10
def initialize(args = {})
  @total = args[:total]
  @paid = args[:paid]
  @refunded = args[:refunded]
end

Public Instance Methods

as_json(options={}) click to toggle source
# File lib/pagseguro/charge/summary.rb, line 32
def as_json(options={})
  {
    total: @total,
    paid: @paid,
    refunded: @refunded
  }
end
to_json(*options) click to toggle source
# File lib/pagseguro/charge/summary.rb, line 16
def to_json(*options)
  hash = as_json(*options)
  hash.reject! {|k,v| v.nil?}
  hash.to_json(*options)
end