Module: WolfCore::Integrations::JobseekerApiOperations

Includes:
HttpOperations
Defined in:
lib/wolf_core/application/integrations/jobseeker_api_operations.rb

Instance Method Summary collapse

Methods included from HttpOperations

#async_http_get, #async_http_post, #async_http_put, #http_get, #http_post, #http_put, #parse_http_response, #parsed_http_get, #parsed_http_post, #parsed_http_put, #safe_http_get, #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_jobseeker(wolf_token:, jobseeker:, tenant:, wolf_platform_url:) ⇒ Object



39
40
41
42
43
44
45
46
# File 'lib/wolf_core/application/integrations/jobseeker_api_operations.rb', line 39

def create_jobseeker(wolf_token:, jobseeker:, tenant:, wolf_platform_url:)
  parsed_http_post(
    headers: { "Authorization" => "Bearer #{wolf_token}" },
    query: { tenant: tenant },
    url: "#{wolf_platform_url}/api/v2/jobseekers",
    body: jobseeker
  )
end

#create_jobseeker!(wolf_token:, jobseeker:, tenant:, wolf_platform_url:, error_message:) ⇒ Object



29
30
31
32
33
34
35
36
37
# File 'lib/wolf_core/application/integrations/jobseeker_api_operations.rb', line 29

def create_jobseeker!(wolf_token:, jobseeker:, tenant:, wolf_platform_url:, error_message:)
  safe_http_post(
    headers: { "Authorization" => "Bearer #{wolf_token}" },
    query: { tenant: tenant },
    url: "#{wolf_platform_url}/api/v2/jobseekers",
    body: jobseeker,
    error_message: error_message
  )
end

#fetch_jobseeker(wolf_token:, jobseeker_id:, tenant:, wolf_platform_url:) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/wolf_core/application/integrations/jobseeker_api_operations.rb', line 17

def fetch_jobseeker(wolf_token:, jobseeker_id:, tenant:, wolf_platform_url:)
  response = parsed_http_get(
    headers: { "Authorization" => "Bearer #{wolf_token}" },
    url: "#{wolf_platform_url}/api/v2/jobseekers/#{jobseeker_id}",
    query: { tenant: tenant }
  )
  response_body = response.body
  return unless response_body.instance_of?(Hash)

  response_body.dig("data", "table", "jobseeker")
end

#fetch_jobseeker!(wolf_token:, jobseeker_id:, tenant:, wolf_platform_url:, error_message:) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/wolf_core/application/integrations/jobseeker_api_operations.rb', line 6

def fetch_jobseeker!(wolf_token:, jobseeker_id:, tenant:, wolf_platform_url:, error_message:)
  response = safe_http_get(
    headers: { "Authorization" => "Bearer #{wolf_token}" },
    url: "#{wolf_platform_url}/api/v2/jobseekers/#{jobseeker_id}",
    query: { tenant: tenant },
    error_message: error_message
  )
  response_body = response.body
  response_body.dig("data", "table", "jobseeker")
end

#update_jobseeker(wolf_token:, jobseeker:, tenant:, wolf_platform_url:, jobseeker_id:) ⇒ Object



58
59
60
61
62
63
64
65
# File 'lib/wolf_core/application/integrations/jobseeker_api_operations.rb', line 58

def update_jobseeker(wolf_token:, jobseeker:, tenant:, wolf_platform_url:, jobseeker_id:)
  parsed_http_put(
    headers: { "Authorization" => "Bearer #{wolf_token}" },
    query: { tenant: tenant },
    url: "#{wolf_platform_url}/api/v2/jobseekers/#{jobseeker_id}",
    body: jobseeker
  )
end

#update_jobseeker!(wolf_token:, jobseeker:, tenant:, wolf_platform_url:, error_message:, jobseeker_id:) ⇒ Object



48
49
50
51
52
53
54
55
56
# File 'lib/wolf_core/application/integrations/jobseeker_api_operations.rb', line 48

def update_jobseeker!(wolf_token:, jobseeker:, tenant:, wolf_platform_url:, error_message:, jobseeker_id:)
  safe_http_put(
    headers: { "Authorization" => "Bearer #{wolf_token}" },
    query: { tenant: tenant },
    url: "#{wolf_platform_url}/api/v2/jobseekers/#{jobseeker_id}",
    body: jobseeker,
    error_message: error_message
  )
end