Class: Cb::SavedSearchApi

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

Class Method Summary collapse

Class Method Details

.create(params) ⇒ Object

Create a Saved Search

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



12
13
14
15
16
17
18
19
20
# File 'lib/cb/clients/saved_search_api.rb', line 12

def self.create params
  my_api = Cb::Utils::Api.new
  cb_response = my_api.cb_post Cb.configuration.uri_saved_search_create, :body => CbSavedSearch.new(params).create_to_xml
  json_hash = JSON.parse cb_response.response.body
  saved_search = CbSavedSearch.new json_hash['SavedJobSearch']
  my_api.append_api_responses saved_search, json_hash['SavedJobSearch']

  return saved_search
end

.delete(params) ⇒ Object

Delete a Saved Search

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



45
46
47
48
49
50
51
52
53
# File 'lib/cb/clients/saved_search_api.rb', line 45

def self.delete params
  my_api = Cb::Utils::Api.new
  cb_response = my_api.cb_post Cb.configuration.uri_saved_search_delete, :body=>CbSavedSearch.new(params).delete_to_xml
  json_hash = JSON.parse cb_response.response.body
  saved_search = CbSavedSearch.new json_hash
  my_api.append_api_responses saved_search, json_hash

  return saved_search
end

.list(developer_key, external_user_id) ⇒ Object

List of Saved Search's

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



85
86
87
88
89
90
91
92
93
# File 'lib/cb/clients/saved_search_api.rb', line 85

def self.list developer_key, external_user_id
  my_api = Cb::Utils::Api.new
  cb_response = my_api.cb_get Cb.configuration.uri_saved_search_list, :query => {:developerkey=>developer_key, :ExternalUserId=>external_user_id}
  json_hash = JSON.parse cb_response.response.body
  saved_search = CbSavedSearch.new json_hash['SavedJobSearches']
  my_api.append_api_responses saved_search, json_hash['SavedJobSearches']

  return json_hash
end

.retrieve(developer_key, external_user_id, external_id, host_site) ⇒ Object

Retrieve a Saved Search

external_id is the unique ID for the specific Saved Search that is being requested from the API. This External_id is found from running a SavedSearchApi.all call. This is a 64 character long ID.

HostSite (From Saved Search List) Required* Developer Key of the owning site for the User is Required*

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



69
70
71
72
73
74
75
76
77
# File 'lib/cb/clients/saved_search_api.rb', line 69

def self.retrieve developer_key, external_user_id, external_id, host_site
  my_api = Cb::Utils::Api.new
  cb_response = my_api.cb_get Cb.configuration.uri_saved_search_retrieve, :query => {:developerkey=> developer_key, :externaluserid=> external_user_id, :externalid=> external_id, :hostsite=> host_site}
  json_hash = JSON.parse cb_response.response.body
  saved_search = CbSavedSearch.new json_hash['SavedJobSearch']
  my_api.append_api_responses saved_search, json_hash['SavedJobSearch']

  return saved_search
end

.update(params) ⇒ Object

Update a Saved Search

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



28
29
30
31
32
33
34
35
36
# File 'lib/cb/clients/saved_search_api.rb', line 28

def self.update params
  my_api = Cb::Utils::Api.new
  cb_response = my_api.cb_post Cb.configuration.uri_saved_search_update, :body => CbSavedSearch.new(params).update_to_xml
  json_hash = JSON.parse cb_response.response.body
  saved_search = CbSavedSearch.new json_hash['SavedJobSearch']
  my_api.append_api_responses saved_search, json_hash['SavedJobSearch']

  return saved_search
end