class SteelWheel::Handler

Public Class Methods

halt_flow?(object, id) click to toggle source
# File lib/steel_wheel/handler.rb, line 13
def self.halt_flow?(object, id)
  !object.valid?
end
handle(input:, flow: :main, &block) click to toggle source
# File lib/steel_wheel/handler.rb, line 36
def self.handle(input:, flow: :main, &block)
  call(input: input, flow: flow) do |callbacks|
    callbacks.flow_initialized(&block) if block
  end
end

Public Instance Methods

on_command_failure() click to toggle source
# File lib/steel_wheel/handler.rb, line 27
def on_command_failure
  output.status = output.command.http_status
  output.errors.merge!(output.command.errors)
end
on_params_failure() click to toggle source
# File lib/steel_wheel/handler.rb, line 17
def on_params_failure
  output.status = :bad_request
  output.errors.merge!(output.params.errors)
end
on_query_failure() click to toggle source
# File lib/steel_wheel/handler.rb, line 22
def on_query_failure
  output.status = output.query.http_status
  output.errors.merge!(output.query.errors)
end
on_success() click to toggle source
# File lib/steel_wheel/handler.rb, line 32
def on_success
  # NOOP
end