Class: Effective::Subscription
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Effective::Subscription
- Defined in:
- app/models/effective/subscription.rb
Instance Attribute Summary collapse
-
#stripe_subscription ⇒ Object
Returns the value of attribute stripe_subscription.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #active? ⇒ Boolean
- #canceled? ⇒ Boolean
- #past_due? ⇒ Boolean
- #plan ⇒ Object
- #to_s ⇒ Object
- #trialing? ⇒ Boolean
Instance Attribute Details
#stripe_subscription ⇒ Object
Returns the value of attribute stripe_subscription.
5 6 7 |
# File 'app/models/effective/subscription.rb', line 5 def stripe_subscription @stripe_subscription end |
Instance Method Details
#<=>(other) ⇒ Object
79 80 81 |
# File 'app/models/effective/subscription.rb', line 79 def <=>(other) name.to_s <=> other&.name.to_s end |
#active? ⇒ Boolean
87 88 89 |
# File 'app/models/effective/subscription.rb', line 87 def active? status == 'active' end |
#canceled? ⇒ Boolean
95 96 97 |
# File 'app/models/effective/subscription.rb', line 95 def canceled? status == 'canceled' end |
#past_due? ⇒ Boolean
91 92 93 |
# File 'app/models/effective/subscription.rb', line 91 def past_due? status == 'past_due' end |
#plan ⇒ Object
68 69 70 |
# File 'app/models/effective/subscription.rb', line 68 def plan EffectiveOrders.stripe_plans.find { |plan| plan[:id] == stripe_plan_id } end |
#to_s ⇒ Object
64 65 66 |
# File 'app/models/effective/subscription.rb', line 64 def to_s name || 'New Subscription' end |
#trialing? ⇒ Boolean
83 84 85 |
# File 'app/models/effective/subscription.rb', line 83 def trialing? status == 'trialing' end |