Method: Pay::Subscription#swap

Defined in:
app/models/pay/subscription.rb

#swap(plan) ⇒ Object

Raises:

  • (ArgumentError)


112
113
114
115
116
# File 'app/models/pay/subscription.rb', line 112

def swap(plan)
  raise ArgumentError, "plan must be a string. Got `#{plan.inspect}` instead." unless plan.is_a?(String)
  payment_processor.swap(plan)
  update(processor_plan: plan, ends_at: nil, status: :active)
end