Module: WolfCore::Burnett::Onboarding::CandidateOperations

Includes:
HttpOperations
Defined in:
lib/wolf_core/application/burnett/onboarding/candidate_operations.rb

Instance Method Summary collapse

Methods included from HttpOperations

#async_http_get, #async_http_patch, #async_http_post, #async_http_put, #http_get, #http_patch, #http_post, #http_put, #parse_http_response, #parsed_http_get, #parsed_http_patch, #parsed_http_post, #parsed_http_put, #safe_http_get, #safe_http_patch, #safe_http_post, #safe_http_put, #validate_http_response

Methods included from LoggingUtils

#log_object

Methods included from AsyncUtils

#run_async

Methods included from ExceptionOperations

#raise_service_error

Instance Method Details

#create_candidate(erecruit_token:, erecruit_platform_url:, candidate:) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/wolf_core/application/burnett/onboarding/candidate_operations.rb', line 18

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

#create_candidate!(erecruit_token:, erecruit_platform_url:, candidate:, error_message:, error_data: nil) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/wolf_core/application/burnett/onboarding/candidate_operations.rb', line 7

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

#submit_candidate_cv(erecruit_token:, erecruit_platform_url:, candidate_id:, cv_url:) ⇒ Object



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/wolf_core/application/burnett/onboarding/candidate_operations.rb', line 47

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

#update_candidate(erecruit_token:, erecruit_platform_url:, candidate_id:, candidate:) ⇒ Object



37
38
39
40
41
42
43
44
45
# File 'lib/wolf_core/application/burnett/onboarding/candidate_operations.rb', line 37

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

#update_candidate!(erecruit_token:, erecruit_platform_url:, candidate_id:, candidate:, error_message:, error_data: nil) ⇒ Object



26
27
28
29
30
31
32
33
34
35
# File 'lib/wolf_core/application/burnett/onboarding/candidate_operations.rb', line 26

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