class Pagseguro::Charge::Amount

Credit card data

Attributes

currency[RW]
summary[RW]
value[RW]

Public Class Methods

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

  amount = new
  amount.currency = data["currency"]
  amount.value = data["value"]
  amount.summary = Summary.fill_from_json(data["summary"])
  amount

end
new(args = {}) click to toggle source
# File lib/pagseguro/charge/amount.rb, line 10
def initialize(args = {})
  @value = args[:value]
  @currency = args[:currency]
  @summary = args[:summary]
end

Public Instance Methods

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