Class: Zoop::Transaction
- Inherits:
-
Model
- Object
- ZoopObject
- Model
- Zoop::Transaction
- Defined in:
- lib/zoop/resources/transaction.rb
Constant Summary
Constants inherited from ZoopObject
Instance Attribute Summary collapse
-
#capture ⇒ Object
Returns the value of attribute capture.
Attributes inherited from ZoopObject
Instance Method Summary collapse
- #capture! ⇒ Object
- #destroy ⇒ Object
-
#initialize(response = {}) ⇒ Transaction
constructor
A new instance of Transaction.
- #receivables ⇒ Object
- #refund ⇒ Object
- #split_rules ⇒ Object
Methods inherited from Model
class_name, #create, create, find_by_id, #save, underscored_class_name, #update, url, #url
Methods inherited from ZoopObject
#==, #[]=, convert, #empty?, #respond_to?, #to_hash, #to_s, #unsaved_attributes
Constructor Details
#initialize(response = {}) ⇒ Transaction
Returns a new instance of Transaction.
7 8 9 10 11 12 13 |
# File 'lib/zoop/resources/transaction.rb', line 7 def initialize(response = {}) super(response) self.currency ||= 'BRL' self.payment_type ||= 'credit' self.capture ||= true end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Zoop::ZoopObject
Instance Attribute Details
#capture ⇒ Object
Returns the value of attribute capture.
5 6 7 |
# File 'lib/zoop/resources/transaction.rb', line 5 def capture @capture end |
Instance Method Details
#capture! ⇒ Object
15 16 17 18 19 |
# File 'lib/zoop/resources/transaction.rb', line 15 def capture! params = { amount: amount.convert_to_cents, on_behalf_of: on_behalf_of } update_model Zoop::Request.post(url('capture'), params: params).run self end |
#destroy ⇒ Object
35 36 37 |
# File 'lib/zoop/resources/transaction.rb', line 35 def destroy raise NotImplementedError end |
#receivables ⇒ Object
27 28 29 |
# File 'lib/zoop/resources/transaction.rb', line 27 def receivables Zoop::Request.get( url 'receivables' ).call end |