Class: Epics::ParseEbics
- Inherits:
-
Faraday::Middleware
- Object
- Faraday::Middleware
- Epics::ParseEbics
- Defined in:
- lib/epics/middleware/parse_ebics.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app = nil, options = {}) ⇒ ParseEbics
constructor
A new instance of ParseEbics.
Constructor Details
#initialize(app = nil, options = {}) ⇒ ParseEbics
Returns a new instance of ParseEbics.
4 5 6 7 |
# File 'lib/epics/middleware/parse_ebics.rb', line 4 def initialize(app = nil, = {}) super(app) @client = [:client] end |
Instance Method Details
#call(env) ⇒ Object
9 10 11 12 13 14 15 |
# 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 |