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
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
74 75 76 |
# File 'app/models/effective/subscription.rb', line 74 def <=>(other) name.to_s <=> other&.name.to_s end |
#active? ⇒ Boolean
78 79 80 |
# File 'app/models/effective/subscription.rb', line 78 def active? status == 'active' end |
#canceled? ⇒ Boolean
86 87 88 |
# File 'app/models/effective/subscription.rb', line 86 def canceled? status == 'canceled' end |
#past_due? ⇒ Boolean
82 83 84 |
# File 'app/models/effective/subscription.rb', line 82 def past_due? status == 'past_due' end |
#plan ⇒ Object
63 64 65 |
# File 'app/models/effective/subscription.rb', line 63 def plan EffectiveOrders.stripe_plans.find { |plan| plan[:id] == stripe_plan_id } end |
#to_s ⇒ Object
59 60 61 |
# File 'app/models/effective/subscription.rb', line 59 def to_s name || 'New Subscription' end |