Class: PagarMe::Subscription
- Inherits:
-
TransactionCommon
- Object
- PagarMeObject
- Model
- TransactionCommon
- PagarMe::Subscription
- Defined in:
- lib/pagarme/resources/subscription.rb
Constant Summary
Constants inherited from PagarMeObject
Instance Attribute Summary
Attributes inherited from PagarMeObject
Instance Method Summary collapse
- #cancel ⇒ Object
- #charge(amount, installments = 1) ⇒ Object
- #create ⇒ Object
-
#postbacks ⇒ Object
TODO: Test it.
- #save ⇒ Object
- #settle_charge ⇒ Object
- #transactions ⇒ Object
Methods inherited from TransactionCommon
Methods inherited from Model
all, class_name, create, extract_page_count_or_params, find_by, find_by_id, underscored_class_name, url, #url
Methods inherited from PagarMeObject
#==, #[]=, convert, #empty?, #initialize, #respond_to?, #to_hash, #to_s, #unsaved_attributes
Constructor Details
This class inherits a constructor from PagarMe::TransactionCommon
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class PagarMe::PagarMeObject
Instance Method Details
#cancel ⇒ Object
18 19 20 |
# File 'lib/pagarme/resources/subscription.rb', line 18 def cancel update PagarMe::Request.post( url 'cancel' ).run end |
#charge(amount, installments = 1) ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/pagarme/resources/subscription.rb', line 30 def charge(amount, installments = 1) PagarMe::Request.post(url('transactions'), params: { amount: amount, installments: installments }).run update PagarMe::Request.get(url).run end |
#create ⇒ Object
3 4 5 6 |
# File 'lib/pagarme/resources/subscription.rb', line 3 def create set_plan_id super end |
#postbacks ⇒ Object
TODO: Test it
14 15 16 |
# File 'lib/pagarme/resources/subscription.rb', line 14 def postbacks PagarMe::Request.get( url 'postbacks' ).call end |
#save ⇒ Object
8 9 10 11 |
# File 'lib/pagarme/resources/subscription.rb', line 8 def save set_plan_id super end |