Module: Stripe::Callbacks

Includes:
Builder
Defined in:
lib/stripe/callbacks.rb,
lib/stripe/callbacks/builder.rb

Defined Under Namespace

Modules: Builder

Class Method Summary collapse

Class Method Details

._run_callbacks(type, evt, target) ⇒ Object



116
117
118
119
# File 'lib/stripe/callbacks.rb', line 116

def _run_callbacks(type, evt, target)
  run_critical_callbacks type, evt, target
  run_noncritical_callbacks type, evt, target
end

.run_callbacks(evt, target) ⇒ Object



111
112
113
114
# File 'lib/stripe/callbacks.rb', line 111

def run_callbacks(evt, target)
  _run_callbacks evt.type, evt, target
  _run_callbacks 'stripe.event', evt, target
end

.run_critical_callbacks(type, evt, target) ⇒ Object



121
122
123
124
125
# File 'lib/stripe/callbacks.rb', line 121

def run_critical_callbacks(type, evt, target)
  ::Stripe::Callbacks::critical_callbacks[type].each do |callback|
    callback.call(target, evt)
  end
end

.run_noncritical_callbacks(type, evt, target) ⇒ Object



127
128
129
130
131
132
133
134
135
136
# File 'lib/stripe/callbacks.rb', line 127

def run_noncritical_callbacks(type, evt, target)
  ::Stripe::Callbacks::noncritical_callbacks[type].each do |callback|
    begin
      callback.call(target, evt)
    rescue Exception => e
      ::Rails.logger.error e.message
      ::Rails.logger.error e.backtrace.join("\n")
    end
  end
end