class Teamtailor::Parser
Attributes
payload[R]
Public Class Methods
new(payload)
click to toggle source
# File lib/teamtailor/parser.rb, line 57 def initialize(payload) @payload = payload end
parse(payload)
click to toggle source
# File lib/teamtailor/parser.rb, line 22 def self.parse(payload) new(payload).parse end
Public Instance Methods
parse()
click to toggle source
# File lib/teamtailor/parser.rb, line 26 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) when "uploads" then Teamtailor::Upload.new(record, included) else raise Teamtailor::UnknownResponseTypeError, record&.dig("type") end end end
Private Instance Methods
data()
click to toggle source
# File lib/teamtailor/parser.rb, line 61 def data [payload&.dig("data")].flatten end
included()
click to toggle source
# File lib/teamtailor/parser.rb, line 65 def included payload&.dig("included") end