Sha256: be74af0599600bf1f32f0b9caed58bad775f0666e9005ca30b1881fda44168d4

Contents?: true

Size: 460 Bytes

Versions: 1

Compression:

Stored size: 460 Bytes

Contents

class ApplicationApi < Lux::Api

  # called at the end of response
  def decorate_response!(data=nil)
    @response = data if data
    if Lux.page
      @response[:ip] = Lux.page.request.ip
      @response[:user] = Lux.page.var.user ? Lux.page.var.user.email : nil
      @response[:http_status] = Lux.page.status(200)
      @response[:error] ||= 'Bad request' if Lux.page.status != 200
    end
    @response
  end

  def after
    decorate_response!
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lux-fw-0.1.17 ./lib/lux/api/lib/application_api.rb