class Epics::ParseEbics

Public Class Methods

new(app = nil, options = {}) click to toggle source
Calls superclass method
# File lib/epics/middleware/parse_ebics.rb, line 4
def initialize(app = nil, options = {})
  super(app)
  @client = options[:client]
end

Public Instance Methods

call(env) click to toggle source
# File lib/epics/middleware/parse_ebics.rb, line 9
def call(env)
  @app.call(env).on_complete do |response|
    response.body = ::Epics::Response.new(@client, response.body)
    raise(Epics::Error::TechnicalError, response.body.technical_code) if response.body.technical_error?
    raise(Epics::Error::BusinessError, response.body.business_code)   if response.body.business_error?
  end
end