lib/wolf_core/application/burnett/onboarding/candidate_operations.rb
module WolfCore
module Burnett
module Onboarding
module CandidateOperations
include WolfCore::HttpOperations
def create_candidate!(erecruit_token:, erecruit_platform_url:, candidate:, error_message:, error_data: nil)
response = safe_http_post(
headers: { "Authorization" => "Bearer #{erecruit_token}" },
url: "#{erecruit_platform_url}/Candidate",
body: candidate,
error_message: error_message,
error_data: error_data
)
response.body
end
def create_candidate(erecruit_token:, erecruit_platform_url:, candidate:)
parsed_http_post(
headers: { "Authorization" => "Bearer #{erecruit_token}" },
url: "#{erecruit_platform_url}/Candidate",
body: candidate
)
end
def update_candidate!(erecruit_token:, erecruit_platform_url:, candidate_id:, candidate:, error_message:, error_data: nil)
response = safe_http_put(
headers: { "Authorization" => "Bearer #{erecruit_token}" },
url: "#{erecruit_platform_url}/Candidate/#{candidate_id}",
body: candidate,
error_message: error_message,
error_data: error_data,
)
response.body
end
def update_candidate(erecruit_token:, erecruit_platform_url:, candidate_id:, candidate:)
parsed_http_put(
headers: { "Authorization" => "Bearer #{erecruit_token}" },
url: "#{erecruit_platform_url}/Candidate/#{candidate_id}",
body: candidate,
error_message: error_message,
error_data: error_data,
)
end
def submit_candidate_cv(erecruit_token:, erecruit_platform_url:, candidate_id:, cv_url:)
filename, bytes = bytes_from_url(cv_url).values_at(:filename, :bytes)
parsed_http_post(
headers: {
'Authorization' => "Bearer #{erecruit_token}",
'Content-Type' => "form-data"
},
url: "#{erecruit_platform_url}/Attachment",
body: {
aboutType: "Candidate",
referenceID: candidate_id,
attachmentTypeID: "Resume",
name: filename,
Resume: bytes
}
)
end
end
end
end
end