Class: Gold::ShopifyPlan
- Inherits:
-
Object
- Object
- Gold::ShopifyPlan
- Defined in:
- app/models/gold/shopify_plan.rb
Overview
Describes a Shopify plan that a shop is tied to. This may change over the lifetime of the shop. While this is a relatively simple wrapper around the plan name string, it provides some nice query methods.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
-
#affiliate? ⇒ Boolean
Returns true if this is a development (non-live) shop.
-
#bad? ⇒ Boolean
The opposite of ‘#good?`.
-
#cancelled? ⇒ Boolean
Returns true if this shop has cancelled their Shopify subscription.
-
#dormant? ⇒ Boolean
Returns true if this shop is currently paused by the merchant.
-
#frozen? ⇒ Boolean
Returns true if this shop has been frozen by Shopify for non-payment.
-
#good? ⇒ Boolean
Returns whether this shop should be allowed to create an account currently.
-
#initialize(plan) ⇒ ShopifyPlan
constructor
A new instance of ShopifyPlan.
-
#paying? ⇒ Boolean
Returns whether this shop is on a paid plan and is in good standing currently.
-
#staff? ⇒ Boolean
Returns true if this is a shop owned by Shopify staff.
- #to_s ⇒ Object
Constructor Details
#initialize(plan) ⇒ ShopifyPlan
Returns a new instance of ShopifyPlan.
6 7 8 |
# File 'app/models/gold/shopify_plan.rb', line 6 def initialize(plan) @plan = plan end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
14 15 16 |
# File 'app/models/gold/shopify_plan.rb', line 14 def ==(other) plan == other.plan end |
#affiliate? ⇒ Boolean
Returns true if this is a development (non-live) shop.
22 23 24 |
# File 'app/models/gold/shopify_plan.rb', line 22 def affiliate? plan == "affiliate" end |
#bad? ⇒ Boolean
The opposite of ‘#good?`
62 63 64 |
# File 'app/models/gold/shopify_plan.rb', line 62 def bad? frozen? || cancelled? end |
#cancelled? ⇒ Boolean
Returns true if this shop has cancelled their Shopify subscription.
39 40 41 |
# File 'app/models/gold/shopify_plan.rb', line 39 def cancelled? plan == "cancelled" end |
#dormant? ⇒ Boolean
Returns true if this shop is currently paused by the merchant. Their online store is not accessible in this situation.
45 46 47 |
# File 'app/models/gold/shopify_plan.rb', line 45 def dormant? plan == "dormant" end |
#frozen? ⇒ Boolean
Returns true if this shop has been frozen by Shopify for non-payment.
34 35 36 |
# File 'app/models/gold/shopify_plan.rb', line 34 def frozen? plan == "frozen" end |
#good? ⇒ Boolean
Returns whether this shop should be allowed to create an account currently.
57 58 59 |
# File 'app/models/gold/shopify_plan.rb', line 57 def good? !bad? end |
#paying? ⇒ Boolean
Returns whether this shop is on a paid plan and is in good standing currently. A paying shop is able to accept charges.
51 52 53 |
# File 'app/models/gold/shopify_plan.rb', line 51 def !(affiliate? || staff? || frozen? || cancelled?) end |
#staff? ⇒ Boolean
Returns true if this is a shop owned by Shopify staff. This specifically excludes Shopify Business shops, as we believe those are paid stores that Shopify employees use for their own businesses.
29 30 31 |
# File 'app/models/gold/shopify_plan.rb', line 29 def staff? plan == "staff" end |
#to_s ⇒ Object
10 11 12 |
# File 'app/models/gold/shopify_plan.rb', line 10 def to_s plan end |