Sha256: 33b6eafbea0be4a9cd9719a612b5827e9cd87eb3fd62bedeca6b427bf2c7238f

Contents?: true

Size: 357 Bytes

Versions: 2

Compression:

Stored size: 357 Bytes

Contents

module Tang
  class UpdatePlan
    def self.call(plan)
      if !plan.valid?
        return plan
      end

      begin
        p = Stripe::Plan.retrieve(plan.stripe_id)
        p.name = plan.name
        p.save
      rescue Stripe::StripeError => e
        plan.errors.add(:base, :invalid, message: e.message)
      end

      return plan
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tang-0.2.2 app/services/tang/update_plan.rb
tang-0.2.1 app/services/tang/update_plan.rb