lib/reji/payment_method.rb in reji-1.0.0 vs lib/reji/payment_method.rb in reji-1.1.0
- old
+ new
@@ -1,11 +1,13 @@
# frozen_string_literal: true
module Reji
class PaymentMethod
def initialize(owner, payment_method)
- raise Reji::InvalidPaymentMethodError.invalid_owner(payment_method, owner) if owner.stripe_id != payment_method.customer
+ if owner.stripe_id != payment_method.customer
+ raise Reji::InvalidPaymentMethodError.invalid_owner(payment_method, owner)
+ end
@owner = owner
@payment_method = payment_method
end
@@ -13,20 +15,22 @@
def delete
@owner.remove_payment_method(@payment_method)
end
# Get the Stripe model instance.
- def owner
- @owner
- end
+ attr_reader :owner
# Get the Stripe PaymentMethod instance.
def as_stripe_payment_method
@payment_method
end
# Dynamically get values from the Stripe PaymentMethod.
def method_missing(key)
@payment_method[key]
+ end
+
+ def respond_to_missing?(method_name, include_private = false)
+ super
end
end
end