Sha256: 4dcf8f9c062560bebc0dff03e5b017e1b25233d06a5bfaaaca1be15c973d8b21

Contents?: true

Size: 760 Bytes

Versions: 1

Compression:

Stored size: 760 Bytes

Contents

module RestMan
  class Request
    class ProcessResult < ActiveMethod::Base

      argument :res
      argument :start_time 
      argument :tempfile, default: nil

      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

      private

      def raw_response
        request.raw_response
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rest-man-1.1.0 lib/restman/request/process_result.rb