Sha256: 94b39d1532abb874aaf07a1418621c815c07c5e58398159526f556b16dee9cd8

Contents?: true

Size: 452 Bytes

Versions: 5

Compression:

Stored size: 452 Bytes

Contents

class StripeModelCallbacks::Price::UpdatedService < StripeModelCallbacks::BaseEventService
  def perform
    price = StripePrice.find_or_initialize_by(stripe_id: object.id)
    price.assign_from_stripe(object)
    price.deleted_at ||= Time.zone.now if event.type == "price.deleted"

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
stripe_model_callbacks-0.1.7 app/services/stripe_model_callbacks/price/updated_service.rb
stripe_model_callbacks-0.1.6 app/services/stripe_model_callbacks/price/updated_service.rb
stripe_model_callbacks-0.1.5 app/services/stripe_model_callbacks/price/updated_service.rb
stripe_model_callbacks-0.1.4 app/services/stripe_model_callbacks/price/updated_service.rb
stripe_model_callbacks-0.1.3 app/services/stripe_model_callbacks/price/updated_service.rb