Class: KondutoPayment
- Inherits:
-
Object
- Object
- KondutoPayment
- Defined in:
- lib/konduto-ruby/konduto_payment.rb
Constant Summary collapse
- TYPE_PAYMENT =
[:credit, :boleto, :debit, :transfer, :voucher]
- TYPE_STATUS =
[:approved, :declined, :pending]
Instance Attribute Summary collapse
-
#bin ⇒ Object
Returns the value of attribute bin.
-
#expiration_date ⇒ Object
Returns the value of attribute expiration_date.
-
#last4 ⇒ Object
Returns the value of attribute last4.
-
#status ⇒ Object
Returns the value of attribute status.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(*args) ⇒ KondutoPayment
constructor
A new instance of KondutoPayment.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(*args) ⇒ KondutoPayment
Returns a new instance of KondutoPayment.
7 8 9 10 11 12 13 |
# File 'lib/konduto-ruby/konduto_payment.rb', line 7 def initialize(*args) unless args[0].nil? args[0].each do |k,v| instance_variable_set("@#{k}", v) unless v.nil? end end end |
Instance Attribute Details
#bin ⇒ Object
Returns the value of attribute bin.
2 3 4 |
# File 'lib/konduto-ruby/konduto_payment.rb', line 2 def bin @bin end |
#expiration_date ⇒ Object
Returns the value of attribute expiration_date.
2 3 4 |
# File 'lib/konduto-ruby/konduto_payment.rb', line 2 def expiration_date @expiration_date end |
#last4 ⇒ Object
Returns the value of attribute last4.
2 3 4 |
# File 'lib/konduto-ruby/konduto_payment.rb', line 2 def last4 @last4 end |
#status ⇒ Object
Returns the value of attribute status.
2 3 4 |
# File 'lib/konduto-ruby/konduto_payment.rb', line 2 def status @status end |
#type ⇒ Object
Returns the value of attribute type.
2 3 4 |
# File 'lib/konduto-ruby/konduto_payment.rb', line 2 def type @type end |
Instance Method Details
#to_hash ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/konduto-ruby/konduto_payment.rb', line 15 def to_hash hash = { type: self.type, status: self.status, bin: self.bin, last4: self.last4, expiration_date: self.expiration_date } KondutoUtils.remove_nil_keys_from_hash(hash) end |
#to_json ⇒ Object
26 27 28 |
# File 'lib/konduto-ruby/konduto_payment.rb', line 26 def to_json self.to_hash.to_json end |