Sha256: dcf0f17bebd04e4d40e983fc654b27642b08316184efcf913660ad31ebdb92ec

Contents?: true

Size: 514 Bytes

Versions: 10

Compression:

Stored size: 514 Bytes

Contents

require 'stripe/event'
module Stripe
  module EventDispatch
    def dispatch_stripe_event(params)
      retrieve_stripe_event(params) do |evt|
        target = evt.data.object
        ::Stripe::Callbacks.run_callbacks(evt, target)
      end
    end

    def retrieve_stripe_event(params)
      id = params['id']
      if id == 'evt_00000000000000' #this is a webhook test
        yield Stripe::Event.construct_from(params.to_unsafe_h)
      else
        yield Stripe::Event.retrieve(id)
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
stripe-rails-1.4.2 app/models/stripe/event_dispatch.rb
stripe-rails-1.4.1 app/models/stripe/event_dispatch.rb
stripe-rails-1.4.0 app/models/stripe/event_dispatch.rb
stripe-rails-1.3.0 app/models/stripe/event_dispatch.rb
stripe-rails-1.2.2 app/models/stripe/event_dispatch.rb
stripe-rails-1.2.1 app/models/stripe/event_dispatch.rb
stripe-rails-1.2.0 app/models/stripe/event_dispatch.rb
stripe-rails-1.1.2 app/models/stripe/event_dispatch.rb
stripe-rails-1.1.1 app/models/stripe/event_dispatch.rb
stripe-rails-1.1.0 app/models/stripe/event_dispatch.rb