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
82 83 84 |
# File 'app/models/effective/subscription.rb', line 82 def <=>(other) name.to_s <=> other&.name.to_s end |
#active? ⇒ Boolean
90 91 92 |
# File 'app/models/effective/subscription.rb', line 90 def active? status == 'active' end |
#canceled? ⇒ Boolean
98 99 100 |
# File 'app/models/effective/subscription.rb', line 98 def canceled? status == 'canceled' end |
#past_due? ⇒ Boolean
94 95 96 |
# File 'app/models/effective/subscription.rb', line 94 def past_due? status == 'past_due' end |
#plan ⇒ Object
71 72 73 |
# File 'app/models/effective/subscription.rb', line 71 def plan EffectiveOrders.stripe_plans.find { |plan| plan[:id] == stripe_plan_id } end |
#to_s ⇒ Object
67 68 69 |
# File 'app/models/effective/subscription.rb', line 67 def to_s name || 'New Subscription' end |
#trialing? ⇒ Boolean
86 87 88 |
# File 'app/models/effective/subscription.rb', line 86 def trialing? status == 'trialing' end |