1
0
Fork 0
discourse-custom-wizard-unl.../lib/custom_wizard/pro/subscription.rb
2021-09-07 20:11:50 +08:00

22 Zeilen
455 B
Ruby

# frozen_string_literal: true
class CustomWizard::ProSubscription
include ActiveModel::Serialization
attr_reader :type,
:updated_at
def initialize(subscription)
if subscription
@type = subscription.type
@updated_at = subscription.updated_at
end
end
def types
%w(community business)
end
def active?
types.include?(type) && updated_at.to_datetime > (Time.zone.now - 2.hours).to_datetime
end
end