Exception: Poodle::PaymentError
- Defined in:
- lib/poodle/errors/payment_error.rb
Overview
Exception raised when payment is required (402 Payment Required)
Instance Attribute Summary collapse
-
#upgrade_url ⇒ String?
readonly
URL to upgrade subscription.
Attributes inherited from Error
Class Method Summary collapse
-
.monthly_limit_exceeded ⇒ PaymentError
Create a PaymentError for monthly limit exceeded (alias for monthly_limit_reached).
-
.monthly_limit_reached ⇒ PaymentError
Create a PaymentError for monthly limit reached.
-
.subscription_expired ⇒ PaymentError
Create a PaymentError for subscription expired.
-
.trial_limit_reached ⇒ PaymentError
Create a PaymentError for trial limit reached.
Instance Method Summary collapse
-
#initialize(message = "Payment required", upgrade_url: nil, context: {}) ⇒ PaymentError
constructor
Initialize a new PaymentError.
Methods inherited from Error
Constructor Details
#initialize(message = "Payment required", upgrade_url: nil, context: {}) ⇒ PaymentError
Initialize a new PaymentError
24 25 26 27 |
# File 'lib/poodle/errors/payment_error.rb', line 24 def initialize( = "Payment required", upgrade_url: nil, context: {}) @upgrade_url = upgrade_url super(, context: context.merge(upgrade_url: upgrade_url), status_code: 402) end |
Instance Attribute Details
#upgrade_url ⇒ String? (readonly)
Returns URL to upgrade subscription.
17 18 19 |
# File 'lib/poodle/errors/payment_error.rb', line 17 def upgrade_url @upgrade_url end |
Class Method Details
.monthly_limit_exceeded ⇒ PaymentError
Create a PaymentError for monthly limit exceeded (alias for monthly_limit_reached)
65 66 67 68 69 70 71 |
# File 'lib/poodle/errors/payment_error.rb', line 65 def self.monthly_limit_exceeded new( "Monthly email limit exceeded. Please upgrade your plan to send more emails.", upgrade_url: "https://app.usepoodle.com/upgrade", context: { error_type: "monthly_limit_exceeded" } ) end |
.monthly_limit_reached ⇒ PaymentError
Create a PaymentError for monthly limit reached
54 55 56 57 58 59 60 |
# File 'lib/poodle/errors/payment_error.rb', line 54 def self.monthly_limit_reached new( "Monthly email limit reached. Please upgrade your plan to send more emails.", upgrade_url: "https://app.usepoodle.com/upgrade", context: { error_type: "monthly_limit_reached" } ) end |
.subscription_expired ⇒ PaymentError
Create a PaymentError for subscription expired
32 33 34 35 36 37 38 |
# File 'lib/poodle/errors/payment_error.rb', line 32 def self.subscription_expired new( "Subscription expired. Please renew your subscription to continue sending emails.", upgrade_url: "https://app.usepoodle.com/upgrade", context: { error_type: "subscription_expired" } ) end |
.trial_limit_reached ⇒ PaymentError
Create a PaymentError for trial limit reached
43 44 45 46 47 48 49 |
# File 'lib/poodle/errors/payment_error.rb', line 43 def self.trial_limit_reached new( "Trial limit reached. Please upgrade to a paid plan to continue sending emails.", upgrade_url: "https://app.usepoodle.com/upgrade", context: { error_type: "trial_limit_reached" } ) end |