25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/teamtailor/parser.rb', line 25
def parse
data.map do |record|
case record&.dig('type')
when 'candidates' then Teamtailor::Candidate.new(record, included)
when 'jobs' then Teamtailor::Job.new(record, included)
when 'users' then Teamtailor::User.new(record, included)
when 'job-applications' then Teamtailor::JobApplication.new(record, included)
when 'companies' then Teamtailor::Company.new(record, included)
when 'stages' then Teamtailor::Stage.new(record, included)
when 'reject-reasons' then Teamtailor::RejectReason.new(record, included)
when 'departments' then Teamtailor::Department.new(record, included)
when 'locations' then Teamtailor::Location.new(record, included)
when 'custom-fields' then Teamtailor::CustomField.new(record, included)
when 'custom-field-selects' then Teamtailor::CustomField.new(record, included)
when 'custom-field-values' then Teamtailor::CustomFieldValue.new(record, included)
when 'referrals' then Teamtailor::Referral.new(record, included)
when 'partner-results' then Teamtailor::PartnerResult.new(record, included)
when 'requisitions' then Teamtailor::Requisition.new(record, included)
when 'requisition-step-verdicts' then Teamtailor::RequisitionStepVerdict.new(record, included)
else
raise Teamtailor::UnknownResponseTypeError, record&.dig('type')
end
end
end
|