Sha256: af69ba5055a961352e714b4348c3c60cf5e6b1bc268bd9426f2023c22553bcf7

Contents?: true

Size: 442 Bytes

Versions: 3

Compression:

Stored size: 442 Bytes

Contents

class StripeModelCallbacks::Plan::UpdatedService < StripeModelCallbacks::BaseEventService
  def execute
    plan = StripePlan.find_or_initialize_by(stripe_id: object.id)
    plan.assign_from_stripe(object)
    plan.deleted_at ||= Time.zone.now if event.type == "plan.deleted"

    if plan.save
      plan.create_activity :deleted if event.type == "plan.deleted"
      succeed!
    else
      fail! plan.errors.full_messages
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
stripe_model_callbacks-0.1.2 app/services/stripe_model_callbacks/plan/updated_service.rb
stripe_model_callbacks-0.1.1 app/services/stripe_model_callbacks/plan/updated_service.rb
stripe_model_callbacks-0.1.0 app/services/stripe_model_callbacks/plan/updated_service.rb