Class: ICIMS::Job

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/icims/job.rb

Constant Summary collapse

DEFAULT_FIELDS =
%w(id updateddate folder jobtitle positioncategory positiontype joblocation additionallocations overview)

Class Method Summary collapse

Class Method Details

.approved(portal_ids: [], fields: []) ⇒ Object



26
27
28
29
30
31
32
33
34
# File 'lib/icims/job.rb', line 26

def approved portal_ids: [], fields: []
  portal_ids = ICIMS.portal_ids unless portal_ids.any?
  portal_ids.map do |id|
    search([
      { name: "job.folder",   value: ['D31001'], operator: "=" },
      { name: "job.postedto", value: [id],       operator: "=" }
    ], fields: fields)
  end.flatten
end

.find(job_id, fields: []) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/icims/job.rb', line 11

def find job_id, fields: []
  fields = DEFAULT_FIELDS unless fields.any?
  if job_id.is_a?(Array)
    fetch_records(job_id, fields)
  else
    fetch_single(job_id, fields)
  end
end

.search(filters, fields: []) ⇒ Object



20
21
22
23
24
# File 'lib/icims/job.rb', line 20

def search filters, fields: []
  fields = DEFAULT_FIELDS unless fields.any?
  ids = fetch_ids(filters)
  fetch_records(ids, fields)
end