def list_jobs(state, opts = {})
      raise ArgumentError unless [:all, :running, :done].include? state
      state = nil if state == :all

      headers = gen_headers(opts)

      attempt(opts[:attempts]) do
  #      method = opts[:head] ? :head : :get
        method = :get # until added to Manta service
        result = @client.send(method, job_url(), { :state => state }, headers)
        raise unless result.is_a? HTTP::Message

        if result.status == 200
  #        return true, result.headers if method == :head
          return [],   result.headers if result.body.size == 0

          raise unless result.headers['Content-Type'] ==
                       'application/x-json-stream; type=job'

          json_chunks = result.body.split("\n")
          job_entries = json_chunks.map { |i| JSON.parse(i) }

          return job_entries, result.headers
        end

        raise_error(result)
      end
    end
def list_jobs(state, opts = {})
      raise ArgumentError unless [:all, :running, :done].include? state
      state = nil if state == :all

      headers = gen_headers(opts)

      attempt(opts[:attempts]) do
  #      method = opts[:head] ? :head : :get
        method = :get # until added to Manta service
        result = @client.send(method, job_url(), { :state => state }, headers)
        raise unless result.is_a? HTTP::Message

        if result.status == 200
  #        return true, result.headers if method == :head
          return [],   result.headers if result.body.size == 0

          raise unless result.headers['Content-Type'] ==
                       'application/x-json-stream; type=job'

          json_chunks = result.body.split("\n")
          job_entries = json_chunks.map { |i| JSON.parse(i) }

          return job_entries, result.headers
        end

        raise_error(result)
      end
    end
Get lists of Manta jobs.

 The state indicates which kind of jobs to return. :running is for jobs
 that are currently processing, :done and :all should be obvious. Be careful
 of the latter two if you've run a lot of jobs -- the list could be quite
 long.

 Returns an array of hashes, each hash containing some information about a
 job. Also returns received HTTP headers.

 If there was an unrecoverable error, throws an exception. On connection or
 corruption errors, more attempts will be made; the number of attempts can
 be altered by passing in :attempts.