Class: Effective::Subscription

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/effective/subscription.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#stripe_subscriptionObject

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

Returns:

  • (Boolean)


90
91
92
# File 'app/models/effective/subscription.rb', line 90

def active?
  status == 'active'
end

#canceled?Boolean

Returns:

  • (Boolean)


98
99
100
# File 'app/models/effective/subscription.rb', line 98

def canceled?
  status == 'canceled'
end

#past_due?Boolean

Returns:

  • (Boolean)


94
95
96
# File 'app/models/effective/subscription.rb', line 94

def past_due?
  status == 'past_due'
end

#planObject



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_sObject



67
68
69
# File 'app/models/effective/subscription.rb', line 67

def to_s
  name || 'New Subscription'
end

#trialing?Boolean

Returns:

  • (Boolean)


86
87
88
# File 'app/models/effective/subscription.rb', line 86

def trialing?
  status == 'trialing'
end