Class: PaystackGateway::Plans::ListPlansResponse

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

Overview

Response from GET /plan endpoint.

Instance Method Summary collapse

Methods inherited from Response

coerce_data

Instance Method Details

#active_plansObject



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

def active_plans = data.select { |plan| !plan.is_deleted && !plan.is_archived }

#find_active_plan_by_name(name) ⇒ Object



34
35
36
# File 'lib/paystack_gateway/plans.rb', line 34

def find_active_plan_by_name(name)
  active_plans.sort_by { -Time.parse(_1.createdAt).to_i }.find { _1.name == name }
end