Class: Cb::SavedSearchApi
- Inherits:
-
Object
- Object
- Cb::SavedSearchApi
- Defined in:
- lib/cb/clients/saved_search_api.rb
Class Method Summary collapse
-
.create(*args) ⇒ Object
Create a Saved Search.
-
.delete(*args) ⇒ Object
Delete a Saved Search.
-
.list(developer_key, external_user_id) ⇒ Object
List of Saved Search's.
-
.retrieve(developer_key, external_user_id, external_id, host_site) ⇒ Object
Retrieve a Saved Search.
-
.update(*args) ⇒ Object
Update a Saved Search.
Class Method Details
.create(*args) ⇒ 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 21 |
# File 'lib/cb/clients/saved_search_api.rb', line 12 def self.create *args args = args[0] if args.is_a?(Array) && args.count == 1 my_api = Cb::Utils::Api.new cb_response = my_api.cb_post Cb.configuration.uri_saved_search_create, :body => CbSavedSearch.new(args).create_to_xml json_hash = JSON.parse cb_response.response.body saved_search = CbSavedSearch.new json_hash['SavedJobSearch']['SavedSearch'] my_api.append_api_responses saved_search, json_hash['SavedJobSearch']['SavedSearch'] return saved_search end |
.delete(*args) ⇒ Object
Delete a Saved Search
For detailed information around this API please visit: http://api.careerbuilder.com/savedsearchinfo.aspx
47 48 49 50 51 52 53 54 55 56 |
# File 'lib/cb/clients/saved_search_api.rb', line 47 def self.delete *args args = args[0] if args.is_a?(Array) && args.count == 1 my_api = Cb::Utils::Api.new cb_response = my_api.cb_post Cb.configuration.uri_saved_search_delete, :body=>CbSavedSearch.new(args).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
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/cb/clients/saved_search_api.rb', line 88 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_searches = [] unless json_hash.empty? if json_hash['SavedJobSearches']['SavedSearches']['SavedSearch'].is_a?(Array) json_hash['SavedJobSearches']['SavedSearches']['SavedSearch'].each do |saved_search| saved_searches << CbSavedSearch.new(saved_search) end elsif json_hash['SavedJobSearches']['SavedSearches']['SavedSearch'].is_a?(Hash) && json_hash.length < 2 saved_searches << CbSavedSearch.new(json_hash['SavedJobSearches']['SavedSearches']['SavedSearch']) end end my_api.append_api_responses saved_searches, json_hash['SavedJobSearches'] return saved_searches 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
72 73 74 75 76 77 78 79 80 |
# File 'lib/cb/clients/saved_search_api.rb', line 72 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']['SavedSearch'] my_api.append_api_responses saved_search, json_hash['SavedJobSearch']['SavedSearch'] return saved_search end |
.update(*args) ⇒ Object
Update a Saved Search
For detailed information around this API please visit: http://api.careerbuilder.com/savedsearchinfo.aspx
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/cb/clients/saved_search_api.rb', line 29 def self.update *args args = args[0] if args.is_a?(Array) && args.count == 1 my_api = Cb::Utils::Api.new cb_response = my_api.cb_post Cb.configuration.uri_saved_search_update, :body => CbSavedSearch.new(args).update_to_xml json_hash = JSON.parse cb_response.response.body saved_search = CbSavedSearch.new json_hash['SavedJobSearch']['SavedSearch'] my_api.append_api_responses saved_search, json_hash['SavedJobSearch']['SavedSearch'] return saved_search end |