1
0
Fork 0
discourse-custom-wizard-unl.../lib/custom_wizard/pro/subscription.rb

21 Zeilen
424 B
Ruby

class CustomWizard::ProSubscription
include ActiveModel::Serialization
attr_reader :type,
:updated_at
2021-09-01 04:19:00 +02:00
def initialize(subscription)
if subscription
@type = subscription.type
@updated_at = subscription.updated_at
end
end
2021-08-18 08:59:43 +02:00
def types
%w(community business)
end
def active?
2021-09-01 04:19:00 +02:00
types.include?(type) && updated_at.to_datetime > (Time.zone.now - 2.hours).to_datetime
end
end