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 22 23 24 25 26 |
# 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 unless json_hash['SavedJobSearch']['SavedSearch'].nil? saved_search = CbSavedSearch.new json_hash['SavedJobSearch']['SavedSearch'] else saved_search = CbSavedSearch.new json_hash['SavedJobSearch'] end my_api.append_api_responses saved_search, json_hash['SavedJobSearch'] 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
52 53 54 55 56 57 58 59 60 61 |
# File 'lib/cb/clients/saved_search_api.rb', line 52 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
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/cb/clients/saved_search_api.rb', line 93 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_hash = json_hash['SavedJobSearches']['SavedSearches'] saved_searches = [] unless saved_search_hash.nil? if saved_search_hash['SavedSearch'].is_a?(Array) saved_search_hash['SavedSearch'].each do |saved_search| saved_searches << CbSavedSearch.new(saved_search) end elsif saved_search_hash['SavedSearch'].is_a?(Hash) && json_hash.length < 2 saved_searches << CbSavedSearch.new(saved_search_hash['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
77 78 79 80 81 82 83 84 85 |
# File 'lib/cb/clients/saved_search_api.rb', line 77 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
34 35 36 37 38 39 40 41 42 43 |
# File 'lib/cb/clients/saved_search_api.rb', line 34 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'] my_api.append_api_responses saved_search, json_hash['SavedJobSearch'] return saved_search end |