Class: SubscriptionClientSubscription
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- SubscriptionClientSubscription
- Defined in:
- app/models/subscription_client_subscription.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.update_period ⇒ Object
32 33 34 |
# File 'app/models/subscription_client_subscription.rb', line 32 def self.update_period Time.zone.now - 2.days end |
Instance Method Details
#active ⇒ Object
16 17 18 |
# File 'app/models/subscription_client_subscription.rb', line 16 def active subscribed && updated_at.to_datetime > self.class.update_period.to_datetime end |
#deactivate! ⇒ Object
20 21 22 |
# File 'app/models/subscription_client_subscription.rb', line 20 def deactivate! update(subscribed: false) end |
#resource_name ⇒ Object
24 25 26 |
# File 'app/models/subscription_client_subscription.rb', line 24 def resource_name resource.name end |
#supplier_name ⇒ Object
28 29 30 |
# File 'app/models/subscription_client_subscription.rb', line 28 def supplier_name resource.supplier.name end |