0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-10 12:22:54 +01:00
discourse-custom-wizard/lib/custom_wizard/subscription/subscription.rb

23 Zeilen
470 B
Ruby

2021-09-07 14:11:50 +02:00
# frozen_string_literal: true
2021-09-24 11:58:42 +02:00
class CustomWizard::Subscription::Subscription
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
2021-10-22 20:24:28 +02:00
%w(none standard business)
2021-08-18 08:59:43 +02:00
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
2021-09-07 14:11:50 +02:00
end