Class: JazzHR::Job

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ Job

Returns a new instance of Job.



29
30
31
32
33
# File 'lib/jazz_hr/job.rb', line 29

def initialize(attributes)
  attributes.each do |attribute, value|
    self.send("#{attribute}=", value)
  end
end

Instance Attribute Details

#board_codeObject

Returns the value of attribute board_code.



23
24
25
# File 'lib/jazz_hr/job.rb', line 23

def board_code
  @board_code
end

#cityObject

Returns the value of attribute city.



23
24
25
# File 'lib/jazz_hr/job.rb', line 23

def city
  @city
end

#country_idObject

Returns the value of attribute country_id.



23
24
25
# File 'lib/jazz_hr/job.rb', line 23

def country_id
  @country_id
end

#departmentObject

Returns the value of attribute department.



23
24
25
# File 'lib/jazz_hr/job.rb', line 23

def department
  @department
end

#descriptionObject

Returns the value of attribute description.



23
24
25
# File 'lib/jazz_hr/job.rb', line 23

def description
  @description
end

#hiring_leadObject

Returns the value of attribute hiring_lead.



23
24
25
# File 'lib/jazz_hr/job.rb', line 23

def hiring_lead
  @hiring_lead
end

#idObject

Returns the value of attribute id.



23
24
25
# File 'lib/jazz_hr/job.rb', line 23

def id
  @id
end

#internal_codeObject

Returns the value of attribute internal_code.



23
24
25
# File 'lib/jazz_hr/job.rb', line 23

def internal_code
  @internal_code
end

#job_applicantsObject

Returns the value of attribute job_applicants.



23
24
25
# File 'lib/jazz_hr/job.rb', line 23

def job_applicants
  @job_applicants
end

#maximum_salaryObject

Returns the value of attribute maximum_salary.



23
24
25
# File 'lib/jazz_hr/job.rb', line 23

def maximum_salary
  @maximum_salary
end

#minimum_salaryObject

Returns the value of attribute minimum_salary.



23
24
25
# File 'lib/jazz_hr/job.rb', line 23

def minimum_salary
  @minimum_salary
end

#notesObject

Returns the value of attribute notes.



23
24
25
# File 'lib/jazz_hr/job.rb', line 23

def notes
  @notes
end

#original_open_dateObject

Returns the value of attribute original_open_date.



23
24
25
# File 'lib/jazz_hr/job.rb', line 23

def original_open_date
  @original_open_date
end

#questionnaireObject

Returns the value of attribute questionnaire.



23
24
25
# File 'lib/jazz_hr/job.rb', line 23

def questionnaire
  @questionnaire
end

#send_to_job_boardsObject

Returns the value of attribute send_to_job_boards.



23
24
25
# File 'lib/jazz_hr/job.rb', line 23

def send_to_job_boards
  @send_to_job_boards
end

#stateObject

Returns the value of attribute state.



23
24
25
# File 'lib/jazz_hr/job.rb', line 23

def state
  @state
end

#statusObject

Returns the value of attribute status.



23
24
25
# File 'lib/jazz_hr/job.rb', line 23

def status
  @status
end

#team_idObject

Returns the value of attribute team_id.



23
24
25
# File 'lib/jazz_hr/job.rb', line 23

def team_id
  @team_id
end

#titleObject

Returns the value of attribute title.



23
24
25
# File 'lib/jazz_hr/job.rb', line 23

def title
  @title
end

#typeObject

Returns the value of attribute type.



23
24
25
# File 'lib/jazz_hr/job.rb', line 23

def type
  @type
end

#zipObject

Returns the value of attribute zip.



23
24
25
# File 'lib/jazz_hr/job.rb', line 23

def zip
  @zip
end

Class Method Details

.find(client:, id:) ⇒ Object

Raises:



14
15
16
17
18
19
20
21
# File 'lib/jazz_hr/job.rb', line 14

def self.find(client:, id:)
  raise Error.new("No job ID supplied") if id.nil?

  job_attributes = client.get(path: "/jobs/#{id}")
  return nil if job_attributes["id"] != id

  new(job_attributes)
end

.search(client:) ⇒ Object



3
4
5
6
7
8
9
10
11
12
# File 'lib/jazz_hr/job.rb', line 3

def self.search(client:)
  response = client.get(path: "/jobs")
  if response.is_a? Array
    response.map do |job_attributes|
      new(job_attributes)
    end
  else
    [new(response)]
  end
end