Class: Reji::PaymentMethod
- Inherits:
-
Object
- Object
- Reji::PaymentMethod
- Defined in:
- lib/reji/payment_method.rb
Instance Attribute Summary collapse
-
#owner ⇒ Object
readonly
Get the Stripe model instance.
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.
- #respond_to_missing?(method_name, include_private = false) ⇒ Boolean
Constructor Details
#initialize(owner, payment_method) ⇒ PaymentMethod
Returns a new instance of PaymentMethod.
5 6 7 8 9 10 11 12 |
# File 'lib/reji/payment_method.rb', line 5 def initialize(owner, payment_method) if owner.stripe_id != payment_method.customer raise Reji::InvalidPaymentMethodError.invalid_owner(payment_method, owner) end @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 Attribute Details
#owner ⇒ Object (readonly)
Get the Stripe model instance.
20 21 22 |
# File 'lib/reji/payment_method.rb', line 20 def owner @owner 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.
15 16 17 |
# File 'lib/reji/payment_method.rb', line 15 def delete @owner.remove_payment_method(@payment_method) end |
#respond_to_missing?(method_name, include_private = false) ⇒ Boolean
32 33 34 |
# File 'lib/reji/payment_method.rb', line 32 def respond_to_missing?(method_name, include_private = false) super end |