def export_scan(scan_id, zip_file = nil)
      http              = AJAX.https(self)
      headers           = { 'Cookie' => "nexposeCCSessionID=#{@session_id}", 'Accept-Encoding' => 'identity' }
      resp              = http.get("/data/scan/#{scan_id}/export", headers)

      case resp
      when Net::HTTPSuccess
        if zip_file
          ::File.open(zip_file, 'wb') { |file| file.write(resp.body) }
        else
          resp.body
        end
      when Net::HTTPForbidden
        raise Nexpose::PermissionError.new(resp)
      else
        raise Nexpose::APIError.new(resp, "#{resp.class}: Unrecognized response.")
      end
    end
def export_scan(scan_id, zip_file = nil)
      http              = AJAX.https(self)
      headers           = { 'Cookie' => "nexposeCCSessionID=#{@session_id}", 'Accept-Encoding' => 'identity' }
      resp              = http.get("/data/scan/#{scan_id}/export", headers)

      case resp
      when Net::HTTPSuccess
        if zip_file
          ::File.open(zip_file, 'wb') { |file| file.write(resp.body) }
        else
          resp.body
        end
      when Net::HTTPForbidden
        raise Nexpose::PermissionError.new(resp)
      else
        raise Nexpose::APIError.new(resp, "#{resp.class}: Unrecognized response.")
      end
    end
Export the data associated with a single scan, and optionally store it in
 a zip-compressed file under the provided name.

 @param [Fixnum] scan_id Scan ID to remove data for.
 @param [String] zip_file Filename to export scan data to.
 @return [Fixnum] On success, returned the number of bytes written to
   zip_file, if provided. Otherwise, returns raw ZIP binary data.