Class: Reji::PaymentMethod
- Inherits:
-
Object
- Object
- Reji::PaymentMethod
- Defined in:
- lib/reji/payment_method.rb
Instance Method Summary collapse
-
#as_stripe_payment_method ⇒ Object
Get the Stripe PaymentMethod instance.
-
#delete ⇒ Object
Delete the payment method.
-
#initialize(owner, payment_method) ⇒ PaymentMethod
constructor
A new instance of PaymentMethod.
-
#method_missing(key) ⇒ Object
Dynamically get values from the Stripe PaymentMethod.
-
#owner ⇒ Object
Get the Stripe model instance.
Constructor Details
#initialize(owner, payment_method) ⇒ PaymentMethod
Returns a new instance of PaymentMethod.
5 6 7 8 9 10 |
# File 'lib/reji/payment_method.rb', line 5 def initialize(owner, payment_method) raise Reji::InvalidPaymentMethodError.invalid_owner(payment_method, owner) if owner.stripe_id != payment_method.customer @owner = owner @payment_method = payment_method end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(key) ⇒ Object
Dynamically get values from the Stripe PaymentMethod.
28 29 30 |
# File 'lib/reji/payment_method.rb', line 28 def method_missing(key) @payment_method[key] end |
Instance Method Details
#as_stripe_payment_method ⇒ Object
Get the Stripe PaymentMethod instance.
23 24 25 |
# File 'lib/reji/payment_method.rb', line 23 def as_stripe_payment_method @payment_method end |
#delete ⇒ Object
Delete the payment method.
13 14 15 |
# File 'lib/reji/payment_method.rb', line 13 def delete @owner.remove_payment_method(@payment_method) end |
#owner ⇒ Object
Get the Stripe model instance.
18 19 20 |
# File 'lib/reji/payment_method.rb', line 18 def owner @owner end |