cb-api 22.4.0 → 22.5.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/email_subscriptions.rb +67 -0
- data/lib/cb/clients/job.rb +19 -3
- data/lib/cb/clients/job_search.rb +37 -0
- data/lib/cb/clients/resumes.rb +125 -4
- data/lib/cb/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c388320407546f44682f60598e856282ac2a8a48
|
4
|
+
data.tar.gz: 9d8e84236801abe54a931403235020a78a702aa8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4b5d38c5bccbe8ffc3fc55542b59ad2e7e19b930b368c9f4a496652f6d94899cb1eb394312d92ac793bcdde2ca773d87d093be6ccd65b1c55d3b135f1805fc7
|
7
|
+
data.tar.gz: 2a7b46d8a2c1a361b3b260493e749828e4f9c5841e55935b9af9aae203a283ec78db9f274edbc89f1a03fa64ac2061b6ff4359d1ad7638ce74ea5946b50c304d
|
data/CHANGELOG.md
CHANGED
@@ -2,8 +2,9 @@ Version History
|
|
2
2
|
====
|
3
3
|
* All Version bumps are required to update this file as well!!
|
4
4
|
----
|
5
|
+
* 22.5.0 Add clients side-by-side existing requests.
|
5
6
|
* 22.4.0 Add optional resume POST param: entry_path
|
6
|
-
* 22.3.2 Add is_dynamic_screener to application form API
|
7
|
+
* 22.3.2 Add is_dynamic_screener to application form API
|
7
8
|
* 22.3.1 Return an empty array for NoMethodError on recs.
|
8
9
|
* 22.3.0 Update validator to handle errors node being nested in the response.
|
9
10
|
* 22.2.1 Add error checking and raising back on Job call
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# Copyright 2017 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_relative 'base'
|
12
|
+
module Cb
|
13
|
+
module Clients
|
14
|
+
class EmailSubscriptions < Base
|
15
|
+
class << self
|
16
|
+
def get(args = {})
|
17
|
+
cb_client.cb_get(Cb.configuration.uri_subscription_retrieve, query: query(args), headers: headers(args))
|
18
|
+
end
|
19
|
+
|
20
|
+
def post(args = {})
|
21
|
+
@unsubscribe_all = args[:unsubscribe_all]
|
22
|
+
cb_client.cb_post(Cb.configuration.uri_subscription_modify, body: body(args), headers: post_headers(args))
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def query(args = {})
|
28
|
+
{
|
29
|
+
ExternalID: args[:external_id],
|
30
|
+
HostSite: args[:host_site] || Cb.configuration.host_site
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
def post_headers(args = {})
|
35
|
+
headers(args).merge('Content-Type' => 'application/xml')
|
36
|
+
end
|
37
|
+
|
38
|
+
def body(args = {})
|
39
|
+
<<-eos.gsub /^\s+/, ""
|
40
|
+
<Request>
|
41
|
+
<DeveloperKey>#{Cb.configuration.dev_key}</DeveloperKey>
|
42
|
+
<ExternalID>#{args[:external_id]}</ExternalID>
|
43
|
+
<Hostsite>#{args[:host_site] || Cb.configuration.host_site}</Hostsite>
|
44
|
+
<CareerResources>#{validate args[:career_resources]}</CareerResources>
|
45
|
+
<ProductSponsorInfo>#{validate args[:product_sponsor_info]}</ProductSponsorInfo>
|
46
|
+
<ApplicantSurveyInvites>#{validate args[:applicant_survey_invites]}</ApplicantSurveyInvites>
|
47
|
+
<JobRecs>#{validate args[:job_recs]}</JobRecs>
|
48
|
+
<DJR>#{validate args[:djr]}</DJR>
|
49
|
+
<ResumeViewed>#{validate args[:resume_viewed]}</ResumeViewed>
|
50
|
+
<ApplicationViewed>#{validate args[:application_viewed]}</ApplicationViewed>
|
51
|
+
<UnsubscribeAll>#{args[:unsubscribe_all]}</UnsubscribeAll>
|
52
|
+
</Request>
|
53
|
+
eos
|
54
|
+
end
|
55
|
+
|
56
|
+
def validate(value)
|
57
|
+
return value unless unsubscribe_all?
|
58
|
+
false.to_s
|
59
|
+
end
|
60
|
+
|
61
|
+
def unsubscribe_all?
|
62
|
+
@unsubscribe_all
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
data/lib/cb/clients/job.rb
CHANGED
@@ -13,19 +13,35 @@ module Cb
|
|
13
13
|
module Clients
|
14
14
|
class Job < Base
|
15
15
|
class << self
|
16
|
-
def get(args={})
|
16
|
+
def get(args = {})
|
17
17
|
response = cb_client.cb_get(Cb.configuration.uri_job_find, query: args)
|
18
18
|
not_found_check(response)
|
19
19
|
response
|
20
20
|
end
|
21
|
-
|
21
|
+
|
22
|
+
def report(args = {})
|
23
|
+
cb_client.cb_post(Cb.configuration.uri_report_job, body: report_body(args))
|
24
|
+
end
|
25
|
+
|
22
26
|
private
|
23
|
-
|
27
|
+
|
24
28
|
def not_found_check(response)
|
25
29
|
return if response.nil?
|
26
30
|
errors = Cb::Responses::Errors.new(response['ResponseJob'], false).parsed.join
|
27
31
|
raise Cb::DocumentNotFoundError, errors if errors.downcase.include? 'job was not found'
|
28
32
|
end
|
33
|
+
|
34
|
+
def report_body(args = {})
|
35
|
+
<<-eos.gsub /^\s+/, ""
|
36
|
+
<Request>
|
37
|
+
<DeveloperKey>#{Cb.configuration.dev_key}</DeveloperKey>
|
38
|
+
<JobDID>#{args[:job_id]}</JobDID>
|
39
|
+
<UserID>#{args[:user_id]}</UserID>
|
40
|
+
<ReportType>#{args[:report_type]}</ReportType>
|
41
|
+
<Comments>#{args[:comments]}</Comments>
|
42
|
+
</Request>
|
43
|
+
eos
|
44
|
+
end
|
29
45
|
end
|
30
46
|
end
|
31
47
|
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# Copyright 2017 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_relative 'base'
|
12
|
+
module Cb
|
13
|
+
module Clients
|
14
|
+
class JobSearch < Base
|
15
|
+
class << self
|
16
|
+
def get(args = {})
|
17
|
+
cb_client.cb_get(Cb.configuration.uri_job_search, query: query(args), headers: headers(args))
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def headers(args = {})
|
23
|
+
{
|
24
|
+
'Accept' => 'application/json;version=3.0',
|
25
|
+
'Authorization' => "Bearer #{ args[:oauth_token] }",
|
26
|
+
'Content-Type' => 'application/json',
|
27
|
+
'HostSite' => args[:host_site] || args[:HostSite] || Cb.configuration.host_site
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
def query(args = {})
|
32
|
+
args.reject { |k, _| k == :oauth_token }
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/lib/cb/clients/resumes.rb
CHANGED
@@ -12,10 +12,131 @@ require_relative 'base'
|
|
12
12
|
module Cb
|
13
13
|
module Clients
|
14
14
|
class Resumes < Base
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
class << self
|
16
|
+
def get(args = {})
|
17
|
+
uri = Cb.configuration.uri_resumes
|
18
|
+
query_params = args[:site] ? { site: args[:site] } : {}
|
19
|
+
cb_client.cb_get(uri, headers: headers(args), query: query_params)
|
20
|
+
end
|
21
|
+
|
22
|
+
def post(args = {})
|
23
|
+
cb_client.cb_post(Cb.configuration.uri_resume_post, body: post_body(args), headers: headers(args))
|
24
|
+
end
|
25
|
+
|
26
|
+
def delete(args = {})
|
27
|
+
cb_client.cb_delete(Cb.configuration.uri_resume_delete.sub(':resume_hash', args[:resume_hash].to_s), query: { externalUserId: args[:external_user_id] }, headers: headers(args))
|
28
|
+
end
|
29
|
+
|
30
|
+
def put(args = {})
|
31
|
+
cb_client.cb_put(Cb.configuration.uri_resume_put.gsub(':resume_hash', args[:resume_hash].to_s), headers: headers(args), body: put_body(args))
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def post_body(args = {})
|
37
|
+
{
|
38
|
+
desiredJobTitle: args[:desired_job_title],
|
39
|
+
privacySetting: args[:privacy_setting],
|
40
|
+
resumeFileData: args[:resume_file_data],
|
41
|
+
resumeFileName: args[:resume_file_name],
|
42
|
+
hostSite: args[:host_site],
|
43
|
+
entryPath: args[:entry_path]
|
44
|
+
}.to_json
|
45
|
+
end
|
46
|
+
|
47
|
+
def headers(args = {})
|
48
|
+
{
|
49
|
+
'HostSite' => args[:host_site] || Cb.configuration.host_site,
|
50
|
+
'Content-Type' => 'application/json;version=1.0',
|
51
|
+
'Authorization' => "Bearer #{ args[:oauth_token] }"
|
52
|
+
}
|
53
|
+
end
|
54
|
+
|
55
|
+
def put_body(args = {})
|
56
|
+
{
|
57
|
+
userIdentifier: args[:user_identifier],
|
58
|
+
resumeHash: args[:resume_hash],
|
59
|
+
desiredJobTitle: args[:desired_job_title],
|
60
|
+
privacySetting: args[:privacy_setting],
|
61
|
+
workExperience: extract_work_experience(args),
|
62
|
+
salaryInformation: extract_salary_information(args),
|
63
|
+
educations: extract_educations(args),
|
64
|
+
skillsAndQualifications: extract_skills_and_qualifications(args),
|
65
|
+
relocations: extract_relocations(args),
|
66
|
+
governmentAndMilitary: extract_government_and_military(args)
|
67
|
+
}.to_json
|
68
|
+
end
|
69
|
+
|
70
|
+
def extract_work_experience(args = {})
|
71
|
+
return [] if args[:work_experience].blank?
|
72
|
+
args[:work_experience].map do |experience|
|
73
|
+
{
|
74
|
+
jobTitle: experience[:job_title],
|
75
|
+
companyName: experience[:company_name],
|
76
|
+
employmentType: experience[:employment_type],
|
77
|
+
startDate: experience[:start_date],
|
78
|
+
endDate: experience[:end_date],
|
79
|
+
currentlyEmployedHere: experience[:currently_employed_here],
|
80
|
+
id: experience[:id]
|
81
|
+
}
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
def extract_salary_information(args = {})
|
86
|
+
salary = args[:salary_information]
|
87
|
+
return {} if salary.blank?
|
88
|
+
{
|
89
|
+
mostRecentPayAmount: salary[:most_recent_pay_amount],
|
90
|
+
perHourOrPerYear: salary[:per_hour_or_per_year],
|
91
|
+
currencyCode: salary[:currency_code],
|
92
|
+
workExperienceId: salary[:work_experience_id],
|
93
|
+
annualBonus: salary[:annual_bonus],
|
94
|
+
annualCommission: salary[:annual_commission]
|
95
|
+
}
|
96
|
+
end
|
97
|
+
|
98
|
+
def extract_educations(args = {})
|
99
|
+
return [] if args[:educations].blank?
|
100
|
+
args[:educations].map do |education|
|
101
|
+
{
|
102
|
+
schoolName: education[:school_name],
|
103
|
+
majorOrProgram: education[:major_or_program],
|
104
|
+
degree: education[:degree],
|
105
|
+
graduationDate: education[:graduation_date]
|
106
|
+
}
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
def extract_skills_and_qualifications(args = {})
|
111
|
+
skills = args[:skills_and_qualifications]
|
112
|
+
return {} if skills.blank?
|
113
|
+
{
|
114
|
+
accreditationsAndCertifications: skills[:accreditations_and_certifications],
|
115
|
+
languagesSpoken: skills[:languages_spoken],
|
116
|
+
hasManagementExperience: skills[:has_management_experience],
|
117
|
+
sizeOfTeamManaged: skills[:size_of_team_managed]
|
118
|
+
}
|
119
|
+
end
|
120
|
+
|
121
|
+
def extract_relocations(args = {})
|
122
|
+
return [] unless args[:relocations]
|
123
|
+
args[:relocations].map do |relocate|
|
124
|
+
{
|
125
|
+
city: relocate[:city],
|
126
|
+
adminArea: relocate[:admin_area],
|
127
|
+
countryCode: relocate[:country_code]
|
128
|
+
}
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
def extract_government_and_military(args = {})
|
133
|
+
government = args[:government_and_military]
|
134
|
+
return {} if government.blank?
|
135
|
+
{
|
136
|
+
hasSecurityClearance: government[:has_security_clearance],
|
137
|
+
militaryExperience: government[:military_experience]
|
138
|
+
}
|
139
|
+
end
|
19
140
|
end
|
20
141
|
end
|
21
142
|
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.5.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: 2017-
|
11
|
+
date: 2017-04-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -218,10 +218,12 @@ files:
|
|
218
218
|
- lib/cb/clients/company.rb
|
219
219
|
- lib/cb/clients/cover_letters.rb
|
220
220
|
- lib/cb/clients/data_list.rb
|
221
|
+
- lib/cb/clients/email_subscriptions.rb
|
221
222
|
- lib/cb/clients/expired_job.rb
|
222
223
|
- lib/cb/clients/job.rb
|
223
224
|
- lib/cb/clients/job_branding.rb
|
224
225
|
- lib/cb/clients/job_insights.rb
|
226
|
+
- lib/cb/clients/job_search.rb
|
225
227
|
- lib/cb/clients/recommendation.rb
|
226
228
|
- lib/cb/clients/recommendations.rb
|
227
229
|
- lib/cb/clients/resume_insights.rb
|