Class: Cb::ResumeApi

Inherits:
Object
  • Object
show all
Defined in:
lib/cb/clients/resume_api.rb

Class Method Summary collapse

Class Method Details

.create(resume) ⇒ Object

TODO: Create a resume

For detailed information around this API please visit: http://www.careerbuilder.com/api/ResumeInfo.aspx



82
83
84
85
86
# File 'lib/cb/clients/resume_api.rb', line 82

def self.create resume
  my_api = Cb::Utils::Api.new
  cb_response = my_api.cb_post(Cb.configuration.uri_resume_create, :body => make_create_xml(resume))
  json_hash = JSON.parse(cb_response.response.body)
end

.delete(resume) ⇒ Object

TODO: Delete a resume

For detailed information around this API please visit: http://www.careerbuilder.com/api/ResumeInfo.aspx



106
107
108
109
110
111
# File 'lib/cb/clients/resume_api.rb', line 106

def self.delete resume
  my_api = Cb::Utils::Api.new
  cb_response = my_api.cb_post(Cb.configuration.uri_resume_delete, :body => make_delete_xml(resume))
  json_hash = JSON.parse(cb_response.response.body)

end

.own_all(external_user_id, ignore_host_site = false) ⇒ Object

Retrieve resumes a user owns.

Returns an array of resumes with external id and title set.

Note: This does not load the resume, a subsequent resume retrieve is required.

For detailed information around this API please visit: http://www.careerbuilder.com/api/ResumeInfo.aspx



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/cb/clients/resume_api.rb', line 17

def self.own_all(external_user_id, ignore_host_site = false)
  my_api = Cb::Utils::Api.new
  params = {"ExternalUserID" => external_user_id}
  if ignore_host_site
    params['IgnoreHostSite'] = 'true'
  end
  cb_response = my_api.cb_get(Cb.configuration.uri_resume_own_all, :query => params)
  json_hash = JSON.parse(cb_response.response.body)

  resumes = []

  unless json_hash.nil?
    json_hash['ResponseOwnResumes']['Resumes']['Resume'].each do |resume_hash|
      resume = Cb::CbResume.new resume_hash
      resume.external_resume_id = resume_hash['ExternalID']
      resume.external_user_id = external_user_id
      resumes << resume
    end
  end

  return resumes
end

.retrieve(resume) ⇒ Object

Retrieve the contents of a resume.

For detailed information around this API please visit: http://www.careerbuilder.com/api/ResumeInfo.aspx



64
65
66
67
68
69
70
71
72
73
74
# File 'lib/cb/clients/resume_api.rb', line 64

def self.retrieve resume
  my_api = Cb::Utils::Api.new
  params = {"ExternalID" => resume.external_resume_id, "ExternalUserID" => resume.external_user_id}
  cb_response = my_api.cb_get(Cb.configuration.uri_resume_retrieve, :query => params)
  json_hash = JSON.parse(cb_response.response.body)

  resume = resume.set_attributes json_hash['ResponseRetrieve']['Resume']
  my_api.append_api_responses resume, json_hash['ResponseRetrieve']

  return resume
end

.retrieve_by_id(resume_external_id, external_user_id) ⇒ Object

Retrieve the contents of a resume by external id.

For detailed information around this API please visit: http://www.careerbuilder.com/api/ResumeInfo.aspx



46
47
48
49
50
51
52
53
54
55
56
# File 'lib/cb/clients/resume_api.rb', line 46

def self.retrieve_by_id resume_external_id, external_user_id
  my_api = Cb::Utils::Api.new
  params = {"ExternalID" => external_id, "ExternalUserID" => external_user_id}
  cb_response = my_api.cb_get(Cb.configuration.uri_resume_retrieve, :query => params)
  json_hash = JSON.parse(cb_response.response.body)

  resume = Cb::CbResume.new json_hash['ResponseRetrieve']['Resume']
  my_api.append_api_responses resume, json_hash['ResponseRetrieve']

  return resume
end

.update(resume) ⇒ Object

TODO: Update a resume

For detailed information around this API please visit: http://www.careerbuilder.com/api/ResumeInfo.aspx



94
95
96
97
98
# File 'lib/cb/clients/resume_api.rb', line 94

def self.update resume
  my_api = Cb::Utils::Api.new
  cb_response = my_api.cb_post(Cb.configuration.uri_resume_update, :body => make_update_xml(resume))
  json_hash = JSON.parse(cb_response.response.body)
end