Class: RestMan::Request::ProcessResult

Inherits:
ActiveMethod::Base
  • Object
show all
Defined in:
lib/restman/request/process_result.rb

Instance Method Summary collapse

Instance Method Details

#call(&block) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/restman/request/process_result.rb', line 9

def call(&block)
  if raw_response
    unless tempfile
      raise ArgumentError.new('tempfile is required')
    end
    response = RawResponse.new(tempfile, res, request, start_time)
  else
    response = Response.create(res.body, res, request, start_time)
  end

  response.log_response

  if block_given?
    block.call(response, request, res, & block)
  else
    response.return!(&block)
  end
end