Class: Braspag::Sale
- Inherits:
-
Object
- Object
- Braspag::Sale
- Defined in:
- lib/braspag/api/sale.rb
Instance Attribute Summary collapse
-
#customer ⇒ Object
Returns the value of attribute customer.
-
#merchant_order_id ⇒ Object
Returns the value of attribute merchant_order_id.
-
#payment ⇒ Object
Returns the value of attribute payment.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(merchant_order_id) ⇒ Sale
constructor
A new instance of Sale.
- #to_json(*options) ⇒ Object
Constructor Details
#initialize(merchant_order_id) ⇒ Sale
Returns a new instance of Sale.
7 8 9 |
# File 'lib/braspag/api/sale.rb', line 7 def initialize(merchant_order_id) @merchant_order_id = merchant_order_id end |
Instance Attribute Details
#customer ⇒ Object
Returns the value of attribute customer.
3 4 5 |
# File 'lib/braspag/api/sale.rb', line 3 def customer @customer end |
#merchant_order_id ⇒ Object
Returns the value of attribute merchant_order_id.
3 4 5 |
# File 'lib/braspag/api/sale.rb', line 3 def merchant_order_id @merchant_order_id end |
#payment ⇒ Object
Returns the value of attribute payment.
3 4 5 |
# File 'lib/braspag/api/sale.rb', line 3 def payment @payment end |
Class Method Details
.from_json(data) ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/braspag/api/sale.rb', line 17 def self.from_json(data) if (data != nil) sale = Sale.new(data["MerchantOrderId"] || nil) sale.customer = Customer.from_json(data["Customer"] || nil) sale.payment = Payment.from_json(data["Payment"] || nil) return sale end end |
Instance Method Details
#to_json(*options) ⇒ Object
11 12 13 14 15 |
# File 'lib/braspag/api/sale.rb', line 11 def to_json(*) hash = as_json(*) hash.reject! {|k,v| v.nil?} hash.to_json(*) end |