cb-api 22.1.0 → 22.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -1
- data/lib/cb/clients/recommendations.rb +72 -0
- data/lib/cb/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7211a1acb643357ca3b627c577a068fb1f8bc36
|
4
|
+
data.tar.gz: 502d48c44c2fe0c17fac18e06b3f02599f6b9132
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9fea5ca598d6bd559038830e50bb2d5c8620e1c6089a793a0ab5ba634a381513d1207f8f8ff49466125900abeb4a62214e0691cef91977d7d0fc3c1d9ec7ab3b
|
7
|
+
data.tar.gz: f71b0af9bd5831c4afd13de7a006cda9877e8bedb9d5977e717c9b18c127eb2c73c8a229af543e61ab813d133cafc0b812c6317c5b0de6055c6e37ffcc8491a2
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,7 @@ Version History
|
|
2
2
|
====
|
3
3
|
* All Version bumps are required to update this file as well!!
|
4
4
|
----
|
5
|
+
* 22.2.0 Add new Recommendations client (alongside existing Recommendation client) that returns a hash
|
5
6
|
* 22.1.0 Headers can be set on api instantiation.
|
6
7
|
* 22.0.0 Return a hash from Job rather than a model
|
7
8
|
* 21.4.2 Catch branding exceptions so that we don't blow up the job details call. The side effect of a second API call is silly anyway
|
@@ -79,6 +80,6 @@ Version History
|
|
79
80
|
* 14.0.1 Introduced a changelog (finally)
|
80
81
|
* 14.0.0 Rename location_code / zip to postal_code on the Cb::Models::User model to be more i18n friendly
|
81
82
|
* 13.0.1 This change is to turn off metadata parsing and raise exception if the api response does not contain metadata.
|
82
|
-
* This means we can optionally control wether or not a specific API call expects metadata to come back
|
83
|
+
* This means we can optionally control wether or not a specific API call expects metadata to come back
|
83
84
|
* 13.0.0 Adds a new resume recommendations call and removes the old one *(BREAKING)*
|
84
85
|
* https://github.com/careerbuilder/ruby-cb-api/pull/154/files
|
@@ -0,0 +1,72 @@
|
|
1
|
+
# Copyright 2016 CareerBuilder, LLC
|
2
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
3
|
+
# you may not use this file except in compliance with the License.
|
4
|
+
# You may obtain a copy of the License at
|
5
|
+
#
|
6
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
7
|
+
# Unless required by applicable law or agreed to in writing, software
|
8
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
9
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
10
|
+
# See the License for the specific language governing permissions and limitations under the License.
|
11
|
+
require 'json'
|
12
|
+
require_relative 'base'
|
13
|
+
module Cb
|
14
|
+
module Clients
|
15
|
+
class Recommendations < Base
|
16
|
+
class << self
|
17
|
+
def for_job(*args)
|
18
|
+
hash_args = normalize_args(args)
|
19
|
+
hash_args = hash_defaults(hash_args)
|
20
|
+
json_hash = cb_client.cb_get(Cb.configuration.uri_recommendation_for_job,
|
21
|
+
query: hash_args)
|
22
|
+
|
23
|
+
{
|
24
|
+
jobs: create_jobs(json_hash, 'Job'),
|
25
|
+
request: json_hash['ResponseRecommendJob']['Request'],
|
26
|
+
recid: json_hash['ResponseRecommendJob']['Request']['RequestEvidenceID'],
|
27
|
+
errors: json_hash['ResponseRecommendJob']['Errors']
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
def for_user(*args)
|
32
|
+
hash_args = normalize_args(args)
|
33
|
+
hash_args = hash_defaults(hash_args)
|
34
|
+
json_hash = cb_client.cb_get(Cb.configuration.uri_recommendation_for_user,
|
35
|
+
query: hash_args)
|
36
|
+
|
37
|
+
{
|
38
|
+
jobs: create_jobs(json_hash, 'User'),
|
39
|
+
request: json_hash['ResponseRecommendUser']['Request'],
|
40
|
+
recid: json_hash['ResponseRecommendUser']['Request']['RequestEvidenceID'],
|
41
|
+
errors: json_hash['ResponseRecommendUser']['Errors']
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
private
|
46
|
+
|
47
|
+
def normalize_args(args)
|
48
|
+
return args[0] if args[0].class == Hash
|
49
|
+
{
|
50
|
+
ExternalID: args[0],
|
51
|
+
JobDID: args[0],
|
52
|
+
CountLimit: args[1] || '25',
|
53
|
+
SiteID: args[2] || '',
|
54
|
+
CoBrand: args[3] || ''
|
55
|
+
}
|
56
|
+
end
|
57
|
+
|
58
|
+
def hash_defaults(hash)
|
59
|
+
hash[:CountLimit] ||= '25'
|
60
|
+
hash[:HostSite] ||= Cb.configuration.host_site
|
61
|
+
hash
|
62
|
+
end
|
63
|
+
|
64
|
+
def create_jobs(json_hash, type)
|
65
|
+
[json_hash["ResponseRecommend#{type}"]['RecommendJobResults']['RecommendJobResult']].flatten.map do |api_job|
|
66
|
+
Models::Job.new(api_job)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
data/lib/cb/version.rb
CHANGED
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.
|
4
|
+
version: 22.2.0
|
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: 2016-12-
|
11
|
+
date: 2016-12-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -223,6 +223,7 @@ files:
|
|
223
223
|
- lib/cb/clients/job_branding.rb
|
224
224
|
- lib/cb/clients/job_insights.rb
|
225
225
|
- lib/cb/clients/recommendation.rb
|
226
|
+
- lib/cb/clients/recommendations.rb
|
226
227
|
- lib/cb/clients/resume_insights.rb
|
227
228
|
- lib/cb/clients/resumes.rb
|
228
229
|
- lib/cb/clients/saved_jobs.rb
|