Module: Sem4r::BulkMutateJobAccountExtension

Included in:
Account
Defined in:
lib/sem4r/bulk_mutate_job/bulk_mutate_job_account_extension.rb

Instance Method Summary collapse

Instance Method Details

#job_delete(job_id) ⇒ Object



40
41
42
43
44
45
46
47
48
# File 'lib/sem4r/bulk_mutate_job/bulk_mutate_job_account_extension.rb', line 40

def job_delete(job_id)
  job = BulkMutateJob.new
  job.instance_eval { @id = job_id }
  operation = JobOperation.remove(job)

  soap_message = service.bulk_mutate_job.mutate(credentials, operation.to_xml("operation"))
  add_counters(soap_message.counters)
  self
end

#job_mutate(bulk_mutate_job) ⇒ Object



50
51
52
53
54
55
# File 'lib/sem4r/bulk_mutate_job/bulk_mutate_job_account_extension.rb', line 50

def job_mutate(bulk_mutate_job)
  soap_message = service.bulk_mutate_job.mutate(credentials, bulk_mutate_job.to_xml("operation"))
  add_counters(soap_message.counters)
  el = soap_message.response.at_xpath("//rval")
  BulkMutateJob.from_element(el)
end

#job_result(job_id) ⇒ Object



29
30
31
32
33
34
35
36
37
38
# File 'lib/sem4r/bulk_mutate_job/bulk_mutate_job_account_extension.rb', line 29

def job_result(job_id)
  selector = BulkMutateJobSelector.new do
    jobId job_id
    stats true
    history true
  end
  soap_message = service.bulk_mutate_job.get(credentials, selector.to_xml)
  add_counters(soap_message.counters)
  self
end

#jobs(refresh = false) ⇒ Object



65
66
67
68
# File 'lib/sem4r/bulk_mutate_job/bulk_mutate_job_account_extension.rb', line 65

def jobs(refresh = false)
  _jobs unless @jobs and !refresh
  @jobs
end

#p_jobsObject



57
58
59
60
61
62
63
# File 'lib/sem4r/bulk_mutate_job/bulk_mutate_job_account_extension.rb', line 57

def p_jobs
  puts "#{jobs.length} bulk mutate jobs"
  jobs.each do |job|
    puts job.to_s
  end
  self
end