Class: PaystackGateway::Plans::FetchPlanResponse

Inherits:
Response
  • Object
show all
Defined in:
lib/paystack_gateway/plans.rb

Overview

Response from GET /plan/:code endpoint.

Instance Method Summary collapse

Methods inherited from Response

coerce_data

Instance Method Details

#active_subscription_codes(email: nil) ⇒ Object



51
52
53
54
55
56
57
58
59
# File 'lib/paystack_gateway/plans.rb', line 51

def active_subscription_codes(email: nil)
  subscriptions =
    if email
      active_subscriptions.select { _1.customer.email.casecmp?(email) }
    else
      active_subscriptions
    end
  subscriptions.map(&:subscription_code)
end

#active_subscriptionsObject



49
# File 'lib/paystack_gateway/plans.rb', line 49

def active_subscriptions = subscriptions.select { _1.status.to_sym == :active }