Class: SAPOCI::Connect::Middleware::BackgroundSearch

Inherits:
Faraday::Response::Middleware
  • Object
show all
Defined in:
lib/sapoci/connect/middleware/background_search.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, options = {}) ⇒ BackgroundSearch

Returns a new instance of BackgroundSearch.



5
6
7
8
# File 'lib/sapoci/connect/middleware/background_search.rb', line 5

def initialize(app, options = {})
  @options = options
  super(app)
end

Instance Method Details

#call(env) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/sapoci/connect/middleware/background_search.rb', line 10

def call(env)
  @app.call(env).on_complete do |resp|
    case env[:status]
    when 200
      env[:sapoci] = SAPOCI::Document.from_html(env[:body])
    else
    end
  end
end