Class: Ecoportal::API::V1::People

Inherits:
Object
  • Object
show all
Defined in:
lib/eco/api/common/version_patches/ecoportal_api/external_people.rb

Instance Method Summary collapse

Instance Method Details

#job {|operation| ... } ⇒ Object

Yields:

  • (operation)


6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/eco/api/common/version_patches/ecoportal_api/external_people.rb', line 6

def job
  operation = Common::BatchOperation.new("/people", person_class, logger: client.logger)
  yield operation
  # The batch operation is responsible for logging the output

  job_id = create_job(operation)
  status = wait_for_job_completion(job_id)

  if status&.complete?
    operation.process_response job_result(job_id, operation)
  else
    raise "Job `#{job_id}` not complete. Probably timeout after #{JOB_TIMEOUT + 60} seconds. Current status: #{status}"
  end
end