class Cb::Clients::Resumes

Public Class Methods

delete(args = {}) click to toggle source
# File lib/cb/clients/resumes.rb, line 26
def delete(args = {})
  cb_client.cb_delete(Cb.configuration.uri_resume_delete.sub(':resume_hash', args[:resume_hash].to_s), query: { externalUserId: args[:external_user_id] }, headers: headers(args))
end
get(args = {}) click to toggle source
# File lib/cb/clients/resumes.rb, line 16
def get(args = {})
  uri = Cb.configuration.uri_resumes
  query_params = args[:site] ? { site: args[:site] } : {}
  cb_client.cb_get(uri, headers: headers(args), query: query_params)
end
post(args = {}) click to toggle source
# File lib/cb/clients/resumes.rb, line 22
def post(args = {})
  cb_client.cb_post(Cb.configuration.uri_resume_post, body: post_body(args), headers: headers(args))
end
put(args = {}) click to toggle source
# File lib/cb/clients/resumes.rb, line 30
def put(args = {})
  cb_client.cb_put(Cb.configuration.uri_resume_put.gsub(':resume_hash', args[:resume_hash].to_s), headers: headers(args), body: put_body(args))
end

Private Class Methods

extract_educations(args = {}) click to toggle source
# File lib/cb/clients/resumes.rb, line 102
def extract_educations(args = {})
  return [] if args[:educations].blank?
  args[:educations].map do |education|
    {
      schoolName: education[:school_name],
      majorOrProgram: education[:major_or_program],
      degree: education[:degree],
      graduationDate: education[:graduation_date]
    }
  end
end
extract_government_and_military(args = {}) click to toggle source
# File lib/cb/clients/resumes.rb, line 136
def extract_government_and_military(args = {})
  government = args[:government_and_military]
  return {} if government.blank?
  {
    hasSecurityClearance: government[:has_security_clearance],
    militaryExperience: government[:military_experience]
  }
end
extract_relocations(args = {}) click to toggle source
# File lib/cb/clients/resumes.rb, line 125
def extract_relocations(args = {})
  return [] unless args[:relocations]
  args[:relocations].map do |relocate|
    {
      city: relocate[:city],
      adminArea: relocate[:admin_area],
      countryCode: relocate[:country_code]
    }
  end
end
extract_salary_information(args = {}) click to toggle source
# File lib/cb/clients/resumes.rb, line 89
def extract_salary_information(args = {})
  salary = args[:salary_information]
  return {} if salary.blank?
  {
    mostRecentPayAmount: salary[:most_recent_pay_amount],
    perHourOrPerYear: salary[:per_hour_or_per_year],
    currencyCode: salary[:currency_code],
    workExperienceId: salary[:work_experience_id],
    annualBonus: salary[:annual_bonus],
    annualCommission: salary[:annual_commission]
  }
end
extract_skills_and_qualifications(args = {}) click to toggle source
# File lib/cb/clients/resumes.rb, line 114
def extract_skills_and_qualifications(args = {})
  skills = args[:skills_and_qualifications]
  return {} if skills.blank?
  {
    accreditationsAndCertifications: skills[:accreditations_and_certifications],
    languagesSpoken: skills[:languages_spoken],
    hasManagementExperience: skills[:has_management_experience],
    sizeOfTeamManaged: skills[:size_of_team_managed]
  }
end
extract_work_experience(args = {}) click to toggle source
# File lib/cb/clients/resumes.rb, line 73
def extract_work_experience(args = {})
  return [] if args[:work_experience].blank?
  args[:work_experience].map do |experience|
    {
      jobTitle: experience[:job_title],
      companyName: experience[:company_name],
      employmentType: experience[:employment_type],
      startDate: experience[:start_date],
      endDate: experience[:end_date],
      currentlyEmployedHere: experience[:currently_employed_here],
      experienceDetail: experience[:work_activities],
      id: experience[:id]
    }
  end
end
headers(args = {}) click to toggle source
# File lib/cb/clients/resumes.rb, line 47
def headers(args = {})
  {
    'HostSite' => args[:host_site] || Cb.configuration.host_site,
    'Content-Type' => 'application/json;version=1.0',
    'Authorization' => "Bearer #{ args[:oauth_token] }"
  }
end
post_body(args = {}) click to toggle source
# File lib/cb/clients/resumes.rb, line 36
def post_body(args = {})
  {
    desiredJobTitle: args[:desired_job_title],
    privacySetting: args[:privacy_setting],
    resumeFileData: args[:resume_file_data],
    resumeFileName: args[:resume_file_name],
    hostSite: args[:host_site],
    entryPath: args[:entry_path]
  }.to_json
end
put_body(args = {}) click to toggle source
# File lib/cb/clients/resumes.rb, line 55
def put_body(args = {})
  {
    userIdentifier: args[:user_identifier],
    resumeHash: args[:resume_hash],
    desiredJobTitle: args[:desired_job_title],
    privacySetting: args[:privacy_setting],
    workExperience: extract_work_experience(args),
    salaryInformation: extract_salary_information(args),
    educations: extract_educations(args),
    skillsAndQualifications: extract_skills_and_qualifications(args),
    relocations: extract_relocations(args),
    governmentAndMilitary: extract_government_and_military(args),
    resumeFileData: args[:resume_file_data],
    resumeFileName: args[:resume_file_name],
    replaceEducationAndExperience: args[:replace_education_and_experience] == 'true'
  }.to_json
end