cb-api 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZjNhZGFmOWFmNWE4ZTA0OTFhNzEwNDdmZmNkYjNmZTMwNmQ1ZDFlYw==
4
+ ZDg4MmFkNzJiYzBhYTUwMmVmYzgzOTdhNDJiMzY5OGMzZTU1NjAwMA==
5
5
  data.tar.gz: !binary |-
6
- ZTBkMzE4YzViY2ZkMGEwODIzNTU1MzY2N2M4NjcwOTQ4ODFmMWQ1OQ==
6
+ MTgyNzFjOTMxNTNjYTdiZjIwZDQyYjY5Mzc5ODM0NDllNzQ5YWFmZQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NTJjMWVlMWFhMjlhN2UzNmUwMDUyYjdjYmMzOTdmMmViMGYyYjk2MjkzZTBm
10
- MTI0MjZjZTU5MjQzMTUyOGUwZTM1MDI3MTlhYzcwMWM3N2M5ZjEwZjNhZmM4
11
- YzczNDkzZDE5ZDI2ODZlYjdkM2YzZjM4NjBiYzBlMmI2MThmMGU=
9
+ ZmUxNjMzY2E3OWFkMmJmYzE3MjNlMjJmOTYxY2NjYzBhNTM2MDI2YjBhNWVl
10
+ ZWE1ZGE1YzFhMzVmNzM1Yzk4ZThhYTIzY2FhMDNjZWE1YmJlNTU1MzE0MmRh
11
+ YTg1NmMwNGYyMGJhNDEwNzRmMzQzM2VhMDRmYWQzZjE1MDNlZmM=
12
12
  data.tar.gz: !binary |-
13
- MDAzMTg1YjZmZWI0NDlkZGUwODcyYjFhZjQ3ZTg4ZmU1ODk1ZjBmYjE0YzMw
14
- ZDEzYjQ3NjY4MmJiNWQ1NDg4ZjE2OTJiY2U3MjUyNmI5ZGFmYTVjYTdiZGI3
15
- MmU0MDVhYzk2MDYyYTJkZjIyN2JiNDY2Njk0NTVhMDk2ODhmZDI=
13
+ YjljM2RiMDZkN2U3YmM2NjcyYzMwOTU0YzNjYzE1MTlhMmVmYzhkMGY5MGU4
14
+ NzQ0M2IxMmRhYjMxYWQ0N2YyNDgzZmQ5NDMzMzY1NWZiNDc5MjRmMGNlMDU4
15
+ YTdiMGMzNzNhMjQ3ODdjOTFhYWQyYjI1MWFjZjZiODlkYzIwNjU=
@@ -9,12 +9,13 @@ module Cb
9
9
  ## For detailed information around this API please visit:
10
10
  ## http://api.careerbuilder.com/savedsearchinfo.aspx
11
11
  #############################################################
12
- def self.create params
12
+ def self.create *args
13
+ args = args[0] if args.is_a?(Array) && args.count == 1
13
14
  my_api = Cb::Utils::Api.new
14
- cb_response = my_api.cb_post Cb.configuration.uri_saved_search_create, :body => CbSavedSearch.new(params).create_to_xml
15
+ cb_response = my_api.cb_post Cb.configuration.uri_saved_search_create, :body => CbSavedSearch.new(args).create_to_xml
15
16
  json_hash = JSON.parse cb_response.response.body
16
- saved_search = CbSavedSearch.new json_hash['SavedJobSearch']
17
- my_api.append_api_responses saved_search, json_hash['SavedJobSearch']
17
+ saved_search = CbSavedSearch.new json_hash['SavedJobSearch']['SavedSearch']
18
+ my_api.append_api_responses saved_search, json_hash['SavedJobSearch']['SavedSearch']
18
19
 
19
20
  return saved_search
20
21
  end
@@ -25,12 +26,13 @@ module Cb
25
26
  ## For detailed information around this API please visit:
26
27
  ## http://api.careerbuilder.com/savedsearchinfo.aspx
27
28
  #############################################################
28
- def self.update params
29
+ def self.update *args
30
+ args = args[0] if args.is_a?(Array) && args.count == 1
29
31
  my_api = Cb::Utils::Api.new
30
- cb_response = my_api.cb_post Cb.configuration.uri_saved_search_update, :body => CbSavedSearch.new(params).update_to_xml
32
+ cb_response = my_api.cb_post Cb.configuration.uri_saved_search_update, :body => CbSavedSearch.new(args).update_to_xml
31
33
  json_hash = JSON.parse cb_response.response.body
32
- saved_search = CbSavedSearch.new json_hash['SavedJobSearch']
33
- my_api.append_api_responses saved_search, json_hash['SavedJobSearch']
34
+ saved_search = CbSavedSearch.new json_hash['SavedJobSearch']['SavedSearch']
35
+ my_api.append_api_responses saved_search, json_hash['SavedJobSearch']['SavedSearch']
34
36
 
35
37
  return saved_search
36
38
  end
@@ -42,9 +44,10 @@ module Cb
42
44
  ## http://api.careerbuilder.com/savedsearchinfo.aspx
43
45
  #############################################################
44
46
 
45
- def self.delete params
47
+ def self.delete *args
48
+ args = args[0] if args.is_a?(Array) && args.count == 1
46
49
  my_api = Cb::Utils::Api.new
47
- cb_response = my_api.cb_post Cb.configuration.uri_saved_search_delete, :body=>CbSavedSearch.new(params).delete_to_xml
50
+ cb_response = my_api.cb_post Cb.configuration.uri_saved_search_delete, :body=>CbSavedSearch.new(args).delete_to_xml
48
51
  json_hash = JSON.parse cb_response.response.body
49
52
  saved_search = CbSavedSearch.new json_hash
50
53
  my_api.append_api_responses saved_search, json_hash
@@ -70,8 +73,8 @@ module Cb
70
73
  my_api = Cb::Utils::Api.new
71
74
  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}
72
75
  json_hash = JSON.parse cb_response.response.body
73
- saved_search = CbSavedSearch.new json_hash['SavedJobSearch']
74
- my_api.append_api_responses saved_search, json_hash['SavedJobSearch']
76
+ saved_search = CbSavedSearch.new json_hash['SavedJobSearch']['SavedSearch']
77
+ my_api.append_api_responses saved_search, json_hash['SavedJobSearch']['SavedSearch']
75
78
 
76
79
  return saved_search
77
80
  end
@@ -86,10 +89,21 @@ module Cb
86
89
  my_api = Cb::Utils::Api.new
87
90
  cb_response = my_api.cb_get Cb.configuration.uri_saved_search_list, :query => {:developerkey=>developer_key, :ExternalUserId=>external_user_id}
88
91
  json_hash = JSON.parse cb_response.response.body
89
- saved_search = CbSavedSearch.new json_hash['SavedJobSearches']
90
- my_api.append_api_responses saved_search, json_hash['SavedJobSearches']
91
92
 
92
- return json_hash
93
+ saved_searches = []
94
+ unless json_hash.empty?
95
+ if json_hash['SavedJobSearches']['SavedSearches']['SavedSearch'].is_a?(Array)
96
+ json_hash['SavedJobSearches']['SavedSearches']['SavedSearch'].each do |saved_search|
97
+ saved_searches << CbSavedSearch.new(saved_search)
98
+ end
99
+ elsif json_hash['SavedJobSearches']['SavedSearches']['SavedSearch'].is_a?(Hash) && json_hash.length < 2
100
+ saved_searches << CbSavedSearch.new(json_hash['SavedJobSearches']['SavedSearches']['SavedSearch'])
101
+ end
102
+ end
103
+
104
+ my_api.append_api_responses saved_searches, json_hash['SavedJobSearches']
105
+
106
+ return saved_searches
93
107
  end
94
108
 
95
109
  end
@@ -5,39 +5,40 @@ module Cb
5
5
  :emp_type, :exclude_company_names, :exclude_job_titles, :exclude_national, :industry_codes,
6
6
  :keywords, :order_by, :order_direction, :radius, :pay_high, :pay_low, :posted_within,
7
7
  :pay_info_only, :location, :job_category, :company, :city, :state, :is_daily_email, :external_id,
8
- :external_user_id, :dev_key
8
+ :external_user_id, :dev_key, :jrdid
9
9
 
10
10
  def initialize(args={})
11
- @hostsite = args[:HostSite] || ''
12
- @cobrand = args[:Cobrand] || ''
13
- @search_name = args[:SearchName] || ''
14
- @site_id = args[:SiteId] || ''
15
- @boolean_operator = args[:BooleanOperator] || ''
16
- @category = args[:Category] || ''
17
- @education_code = args[:EducationCode] || ''
18
- @specific_education = args[:SpecificEducation] || false
19
- @emp_type = args[:EmpType] || ''
20
- @exclude_company_names = args[:ExcludeCompanyNames] || ''
21
- @exclude_job_titles = args[:ExcludeJobTitles] || ''
22
- @exclude_national = args[:ExcludeNational] || false
23
- @industry_codes = args[:IndustryCodes] || ''
24
- @keywords = args[:Keywords] || ''
25
- @order_by = args[:OrderBy] || ''
26
- @order_direction = args[:OrderDirection] || ''
27
- @radius = args[:Radius] || 30
28
- @pay_high = args[:PayHigh] || 0
29
- @pay_low = args[:PayLow] || 0
30
- @posted_within = args[:PostedWithin] || 30
31
- @pay_info_only = args[:PayInfoOnly] || false
32
- @location = args[:Location] || ''
33
- @job_category = args[:JobCategory] || ''
34
- @company = args[:Company] || ''
35
- @city = args[:City] || ''
36
- @state = args[:State] || ''
37
- @is_daily_email = args[:IsDailyEmail] || ''
38
- @external_id = args[:ExternalID] || ''
39
- @external_user_id = args[:ExternalUserID] || ''
40
- @dev_key = args[:DeveloperKey] || "#{Cb.configuration.dev_key}"
11
+ @hostsite = args['HostSite'] || ''
12
+ @cobrand = args['Cobrand'] || ''
13
+ @search_name = args['SearchName'] || ''
14
+ @site_id = args['SiteId'] || ''
15
+ @boolean_operator = args['BooleanOperator'] || ''
16
+ @category = args['Category'] || ''
17
+ @education_code = args['EducationCode'] || ''
18
+ @specific_education = args['SpecificEducation'] || false
19
+ @emp_type = args['EmpType'] || ''
20
+ @exclude_company_names = args['ExcludeCompanyNames'] || ''
21
+ @exclude_job_titles = args['ExcludeJobTitles'] || ''
22
+ @exclude_national = args['ExcludeNational'] || false
23
+ @industry_codes = args['IndustryCodes'] || ''
24
+ @keywords = args['Keywords'] || ''
25
+ @order_by = args['OrderBy'] || ''
26
+ @order_direction = args['OrderDirection'] || ''
27
+ @radius = args['Radius'] || 30
28
+ @pay_high = args['PayHigh'] || 0
29
+ @pay_low = args['PayLow'] || 0
30
+ @posted_within = args['PostedWithin'] || 30
31
+ @pay_info_only = args['PayInfoOnly'] || false
32
+ @location = args['Location'] || ''
33
+ @job_category = args['JobCategory'] || ''
34
+ @company = args['Company'] || ''
35
+ @city = args['City'] || ''
36
+ @state = args['State'] || ''
37
+ @is_daily_email = args['IsDailyEmail'] || ''
38
+ @external_id = args['ExternalID'] || ''
39
+ @external_user_id = args['ExternalUserID'] || ''
40
+ @dev_key = args['DeveloperKey'] || ''
41
+ @jrdid = args['JRDID'] || ''
41
42
  end
42
43
 
43
44
  def create_to_xml
data/lib/cb/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Cb
2
- VERSION = '0.2.1'
2
+ VERSION = '0.2.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cb-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jesse Retchko
@@ -15,7 +15,7 @@ authors:
15
15
  autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
- date: 2013-07-31 00:00:00.000000000 Z
18
+ date: 2013-08-01 00:00:00.000000000 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: httparty