class Cielo::API30::Sale
Attributes
customer[RW]
merchant_order_id[RW]
payment[RW]
Public Class Methods
from_json(data)
click to toggle source
# File lib/cielo/api30/sale.rb, line 18 def self.from_json(data) return if data.nil? sale = new(data["MerchantOrderId"]) sale.customer = Customer.from_json(data["Customer"]) sale.payment = Payment.from_json(data["Payment"]) sale end
new(merchant_order_id)
click to toggle source
# File lib/cielo/api30/sale.rb, line 8 def initialize(merchant_order_id) @merchant_order_id = merchant_order_id end
Public Instance Methods
as_json(options={})
click to toggle source
# File lib/cielo/api30/sale.rb, line 27 def as_json(options={}) { MerchantOrderId: @merchant_order_id, Customer: @customer, Payment: @payment } end
to_json(*options)
click to toggle source
# File lib/cielo/api30/sale.rb, line 12 def to_json(*options) hash = as_json(*options) hash.reject! {|k,v| v.nil?} hash.to_json(*options) end