def create_job(job, opts = {})
      raise ArgumentError unless job[:phases] || job['phases']

      headers = gen_headers(opts)
      headers.push([ 'Content-Type', 'application/json; type=job' ])
      data = job.to_json

      attempt(opts[:attempts]) do
        result = @client.post(job_url(), data, headers)
        raise unless result.is_a? HTTP::Message

        if result.status == 201
          location = result.headers['Location']
          raise unless location

          return location, result.headers
        end

        raise_error(result)
      end
    end
def create_job(job, opts = {})
      raise ArgumentError unless job[:phases] || job['phases']

      headers = gen_headers(opts)
      headers.push([ 'Content-Type', 'application/json; type=job' ])
      data = job.to_json

      attempt(opts[:attempts]) do
        result = @client.post(job_url(), data, headers)
        raise unless result.is_a? HTTP::Message

        if result.status == 201
          location = result.headers['Location']
          raise unless location

          return location, result.headers
        end

        raise_error(result)
      end
    end
Creates a job in Manta.

 The job must be a hash, containing at minimum a :phases key. See README.md
 or the Manta docs to see the format and options for setting up a job on
 Manta; this method effectively just converts the job hash to JSON and sends
 to the Manta service.

 Returns the path for the new job, along with 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.