Sha256: 8c532af786c6c0be0fcc87fb19647c7d404006eb1172f67ca460291b2931493f

Contents?: true

Size: 530 Bytes

Versions: 11

Compression:

Stored size: 530 Bytes

Contents

# frozen_string_literal: true

class Epics::ParseEbics < Faraday::Middleware
  def initialize(app = nil, options = {})
    super(app)
    @client = options[:client]
  end

  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
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
epics-2.7.0 lib/epics/middleware/parse_ebics.rb
epics-2.6.0 lib/epics/middleware/parse_ebics.rb
epics-2.5.0 lib/epics/middleware/parse_ebics.rb
epics-2.4.0 lib/epics/middleware/parse_ebics.rb
epics-2.3.0 lib/epics/middleware/parse_ebics.rb
epics-2.2.0 lib/epics/middleware/parse_ebics.rb
epics-2.1.2 lib/epics/middleware/parse_ebics.rb
epics-2.1.1 lib/epics/middleware/parse_ebics.rb
epics-2.1.0 lib/epics/middleware/parse_ebics.rb
epics-2.0.0 lib/epics/middleware/parse_ebics.rb
epics-1.8.1 lib/epics/middleware/parse_ebics.rb