Sha256: 1c18915a9e6cc9dd986a4d57845a7e835d52ff5c0704570c1391e100e4b1d12d

Contents?: true

Size: 502 Bytes

Versions: 14

Compression:

Stored size: 502 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)
      else
        yield Stripe::Event.retrieve(id)
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
stripe-rails-1.0.2 app/models/stripe/event_dispatch.rb
stripe-rails-1.0.1 app/models/stripe/event_dispatch.rb
stripe-rails-1.0.0 app/models/stripe/event_dispatch.rb
stripe-rails-0.4.1 app/models/stripe/event_dispatch.rb
stripe-rails-0.4.0 app/models/stripe/event_dispatch.rb
stripe-rails-0.3.1 app/models/stripe/event_dispatch.rb
stripe-rails-0.3.0 app/models/stripe/event_dispatch.rb
stripe-rails-0.2.6 app/models/stripe/event_dispatch.rb
stripe-rails-0.2.5 app/models/stripe/event_dispatch.rb
stripe-rails-0.2.4 app/models/stripe/event_dispatch.rb
stripe-rails-0.2.3 app/models/stripe/event_dispatch.rb
stripe-rails-0.2.2 app/models/stripe/event_dispatch.rb
stripe-rails-0.2.1 app/models/stripe/event_dispatch.rb
stripe-rails-0.2.0 app/models/stripe/event_dispatch.rb