cb-api 22.5.0 → 22.6.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c388320407546f44682f60598e856282ac2a8a48
4
- data.tar.gz: 9d8e84236801abe54a931403235020a78a702aa8
3
+ metadata.gz: 7aff53c7029fb4b770eada75260ed3f2be84885b
4
+ data.tar.gz: 45f0d477bcc9d13a91288531159cf44eb3399c26
5
5
  SHA512:
6
- metadata.gz: d4b5d38c5bccbe8ffc3fc55542b59ad2e7e19b930b368c9f4a496652f6d94899cb1eb394312d92ac793bcdde2ca773d87d093be6ccd65b1c55d3b135f1805fc7
7
- data.tar.gz: 2a7b46d8a2c1a361b3b260493e749828e4f9c5841e55935b9af9aae203a283ec78db9f274edbc89f1a03fa64ac2061b6ff4359d1ad7638ce74ea5946b50c304d
6
+ metadata.gz: 588dfc9549c04997f52d7b0e53f7712e3253a58c5d8e14efa1c013f923fcde847ad2c936811301ac2c16a4b3904643462fb32df0d6068c4bbe56f0a1c9d25dcb
7
+ data.tar.gz: a534fcb3d754f1d6c8009a3acbcca59065949b8656f6db7dbab89a991bcf2b456e22630d95942a76dd2539513a1813eb13b5b6a5851c22839f764e808837b6df
@@ -2,6 +2,9 @@ Version History
2
2
  ====
3
3
  * All Version bumps are required to update this file as well!!
4
4
  ----
5
+ * 22.6.2 Updating just to test rubygems publishing from travis
6
+ * 22.6.1 Minor fixes on saved search tests.
7
+ * 22.6.0 Move saved search create to new API. Request changes from XML to JSON.
5
8
  * 22.5.0 Add clients side-by-side existing requests.
6
9
  * 22.4.0 Add optional resume POST param: entry_path
7
10
  * 22.3.2 Add is_dynamic_screener to application form API
@@ -13,9 +13,9 @@ module Cb
13
13
  module Clients
14
14
  class SavedSearch < Base
15
15
  def self.create(saved_search)
16
- body = saved_search.create_to_xml
17
- json = cb_client.cb_post(Cb.configuration.uri_saved_search_create, body: body)
18
- singular_model_response(json, saved_search.external_user_id)
16
+ body = saved_search.create_to_json
17
+ json = cb_client.cb_post(Cb.configuration.uri_saved_search_create, body: body, headers: create_headers)
18
+ Responses::SavedSearch::Create.new(json)
19
19
  end
20
20
 
21
21
  def self.update(saved_search)
@@ -56,6 +56,13 @@ module Cb
56
56
  'HostSite' => (host_site.blank? ? Cb.configuration.host_site : host_site)
57
57
  }
58
58
  end
59
+
60
+ def self.create_headers
61
+ {
62
+ 'developerkey' => Cb.configuration.dev_key,
63
+ 'Content-Type' => 'application/json'
64
+ }
65
+ end
59
66
 
60
67
  def self.retrieve_query(oauth_token)
61
68
  {
@@ -72,12 +79,6 @@ module Cb
72
79
  }
73
80
  end
74
81
 
75
- def self.singular_model_response(json_hash, external_user_id = nil, external_id = nil)
76
- json_hash['ExternalUserID'] = external_user_id unless external_user_id.nil?
77
- json_hash['ExternalID'] = external_id unless external_id.nil?
78
- Responses::SavedSearch::Singular.new(json_hash)
79
- end
80
-
81
82
  def self.replace_uri_field(uri_string, field, replacement)
82
83
  uri_string.gsub(field, replacement)
83
84
  end
@@ -80,8 +80,8 @@ module Cb
80
80
  @uri_resume_post ||= '/consumer/resumedocuments'
81
81
  @uri_resumes ||= '/consumer/resumes'
82
82
  @uri_saved_search_retrieve ||= '/cbapi/savedsearches/:did'
83
- @uri_saved_search_create ||= '/v2/savedsearch/create'
84
- @uri_saved_search_update ||= '/cbapi/SavedSearches'
83
+ @uri_saved_search_create ||= '/cbapi/savedsearches'
84
+ @uri_saved_search_update ||= '/cbapi/savedsearches'
85
85
  @uri_saved_search_delete ||= '/cbapi/savedsearches/:did'
86
86
  @uri_saved_search_list ||= '/cbapi/savedsearches'
87
87
  @uri_subscription_retrieve ||= '/v2/user/subscription/retrieve'
@@ -36,18 +36,18 @@ module Cb
36
36
  @search_parameters = SearchParameters.new(args['SavedSearchParameters'] || {})
37
37
  end
38
38
 
39
- def create_to_xml
40
- <<-eos
41
- <Request>
42
- <HostSite>#{host_site}</HostSite>
43
- <Cobrand>#{cobrand}</Cobrand>
44
- <SearchName>#{search_name}</SearchName>
45
- #{search_parameters.to_xml}
46
- <IsDailyEmail>#{is_daily_email.to_s.upcase}</IsDailyEmail>
47
- <ExternalUserID>#{external_user_id}</ExternalUserID>
48
- <DeveloperKey>#{Cb.configuration.dev_key}</DeveloperKey>
49
- </Request>
50
- eos
39
+ def create_to_json
40
+ hash = {
41
+ 'SiteID' => site_id,
42
+ 'Cobrand' => cobrand,
43
+ 'EmailDeliveryDay' => email_delivery_day,
44
+ 'IsDailyEmail' => is_daily_email,
45
+ 'userOAuthToken' => user_oauth_token,
46
+ 'HostSite' => host_site,
47
+ 'SearchName' => search_name,
48
+ 'SavedSearchParameters' => search_parameters.to_hash
49
+ }
50
+ hash.to_json
51
51
  end
52
52
 
53
53
  def create_anon_to_xml
@@ -74,6 +74,7 @@ module Cb
74
74
  'HostSite' => host_site,
75
75
  'SiteID' => site_id,
76
76
  'Cobrand' => cobrand,
77
+ 'EmailDeliveryDay' => email_delivery_day,
77
78
  'IsDailyEmail' => is_daily_email,
78
79
  'userOAuthToken' => user_oauth_token,
79
80
  'SavedSearchParameters' => search_parameters.to_hash
@@ -11,46 +11,29 @@
11
11
  module Cb
12
12
  module Responses
13
13
  module SavedSearch
14
- class Singular < ApiResponse
14
+ class Create < ApiResponse
15
15
  protected
16
16
 
17
17
  def validate_api_hash
18
- required_response_field(root_node, response)
19
- required_response_field(model_node, response[root_node])
18
+ required_response_field(collection_node, response)
20
19
  end
21
20
 
22
21
  def hash_containing_metadata
23
- response[root_node]
22
+ response
24
23
  end
25
24
 
26
25
  def extract_models
27
- # these IDs comes back in weird places in the response hash,
28
- # we need to move them around a little bit so things work correctly.
29
- model_hash[user_id_node] = response[user_id_node]
30
- model_hash[search_id_node] = response[search_id_node]
31
26
  Models::SavedSearch.new(model_hash)
32
27
  end
33
28
 
34
29
  private
35
30
 
36
- def root_node
37
- 'SavedJobSearch'
38
- end
39
-
40
- def model_node
41
- 'SavedSearch'
42
- end
43
-
44
- def user_id_node
45
- 'ExternalUserID'
46
- end
47
-
48
- def search_id_node
49
- 'ExternalID'
31
+ def collection_node
32
+ 'Results'
50
33
  end
51
34
 
52
35
  def model_hash
53
- response[root_node][model_node]
36
+ response[collection_node][0]
54
37
  end
55
38
  end
56
39
  end
@@ -34,9 +34,10 @@ module Cb
34
34
  outputjson: Cb.configuration.use_json.to_s
35
35
 
36
36
  self.class.default_timeout Cb.configuration.time_out
37
- self.class.headers.merge! ({ 'developerkey' => Cb.configuration.dev_key })
38
- self.class.headers.merge! ({ 'accept-encoding' => 'deflate, gzip' }) unless Cb.configuration.debug_api
39
- self.class.headers.merge! headers
37
+ h = { 'developerkey' => Cb.configuration.dev_key }
38
+ h.merge! ({ 'accept-encoding' => 'deflate, gzip' }) unless Cb.configuration.debug_api
39
+ h.merge! headers
40
+ self.class.headers(h)
40
41
  end
41
42
 
42
43
  def cb_get(path, options = {}, &block)
@@ -9,5 +9,5 @@
9
9
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
10
  # See the License for the specific language governing permissions and limitations under the License.
11
11
  module Cb
12
- VERSION = '22.5.0'
12
+ VERSION = '22.6.2'
13
13
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cb-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 22.5.0
4
+ version: 22.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - The CareerBuilder.com Niche and Consumer Development teams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-04 00:00:00.000000000 Z
11
+ date: 2017-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -328,10 +328,10 @@ files:
328
328
  - lib/cb/responses/nil_model.rb
329
329
  - lib/cb/responses/resumes/resume.rb
330
330
  - lib/cb/responses/resumes/resume_document.rb
331
+ - lib/cb/responses/saved_search/create.rb
331
332
  - lib/cb/responses/saved_search/delete.rb
332
333
  - lib/cb/responses/saved_search/list.rb
333
334
  - lib/cb/responses/saved_search/retrieve.rb
334
- - lib/cb/responses/saved_search/singular.rb
335
335
  - lib/cb/responses/saved_search/update.rb
336
336
  - lib/cb/responses/timing.rb
337
337
  - lib/cb/responses/user/change_password.rb
@@ -371,7 +371,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
371
371
  version: '0'
372
372
  requirements: []
373
373
  rubyforge_project:
374
- rubygems_version: 2.5.1
374
+ rubygems_version: 2.4.5
375
375
  signing_key:
376
376
  specification_version: 4
377
377
  summary: Ruby wrapper around Careerbuilder Public API.