Change summary
lib/customer.rb | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
Detailed changes
@@ -1,5 +1,7 @@
# frozen_string_literal: true
+require "forwardable"
+
require_relative "./ibr"
require_relative "./payment_methods"
require_relative "./plan"
@@ -23,7 +25,11 @@ class Customer
end
end
+ extend Forwardable
+
attr_reader :customer_id, :balance
+ def_delegator :@plan, :name, :plan_name
+ def_delegators :@plan, :currency, :merchant_account
def initialize(
customer_id,
@@ -46,17 +52,6 @@ class Customer
)
end
- def plan_name
- @plan.name
- end
-
- def currency
- @plan.currency
- end
-
- def merchant_account
- @plan.merchant_account
- end
def payment_methods
@payment_methods ||=