Class: Quber::Rack

Inherits:
Object
  • Object
show all
Defined in:
lib/quber/rack.rb

Defined Under Namespace

Classes: PayloadError

Instance Method Summary collapse

Instance Method Details

#call(env) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/quber/rack.rb', line 8

def call(env)
  request = ::Rack::Request.new(env)
  payload = extract_payload(request)

  ActiveJob::Base.execute payload

  [200, {}, ['OK']]
rescue PayloadError => e
  [400, {}, [e.cause.message]]
rescue => e
  [500, {}, [e.message]]
end