cb-api 1.3.6 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/cb.rb +7 -99
- data/lib/cb/clients/anon_saved_search.rb +42 -0
- data/lib/cb/clients/application.rb +53 -0
- data/lib/cb/clients/application_external.rb +24 -0
- data/lib/cb/clients/category.rb +49 -0
- data/lib/cb/clients/company.rb +34 -0
- data/lib/cb/clients/education.rb +28 -0
- data/lib/cb/clients/email_subscription.rb +55 -0
- data/lib/cb/clients/employee_types.rb +31 -0
- data/lib/cb/clients/job.rb +57 -0
- data/lib/cb/clients/job_branding.rb +21 -0
- data/lib/cb/clients/recommendation.rb +76 -0
- data/lib/cb/clients/saved_search.rb +66 -0
- data/lib/cb/clients/spot.rb +27 -0
- data/lib/cb/clients/talent_network.rb +51 -0
- data/lib/cb/clients/user.rb +94 -0
- data/lib/cb/convenience.rb +83 -0
- data/lib/cb/criteria/job/details.rb +11 -0
- data/lib/cb/criteria/job/search.rb +25 -0
- data/lib/cb/criteria/spot/retrieve.rb +12 -0
- data/lib/cb/exceptions.rb +2 -1
- data/lib/cb/models/implementations/application.rb +92 -0
- data/lib/cb/models/implementations/application_external.rb +28 -0
- data/lib/cb/models/implementations/application_schema.rb +75 -0
- data/lib/cb/models/implementations/branding/media.rb +14 -14
- data/lib/cb/models/implementations/branding/section.rb +14 -15
- data/lib/cb/models/implementations/branding/style.rb +10 -10
- data/lib/cb/models/implementations/branding/styles/base.rb +12 -10
- data/lib/cb/models/implementations/branding/styles/buttons.rb +7 -6
- data/lib/cb/models/implementations/branding/styles/company_info.rb +14 -12
- data/lib/cb/models/implementations/branding/styles/container.rb +7 -6
- data/lib/cb/models/implementations/branding/styles/content.rb +7 -5
- data/lib/cb/models/implementations/branding/styles/css_adapter.rb +39 -41
- data/lib/cb/models/implementations/branding/styles/headings.rb +7 -5
- data/lib/cb/models/implementations/branding/styles/job_details.rb +12 -11
- data/lib/cb/models/implementations/branding/styles/page.rb +7 -5
- data/lib/cb/models/implementations/branding/widget.rb +9 -7
- data/lib/cb/models/implementations/category.rb +24 -0
- data/lib/cb/models/implementations/company.rb +135 -0
- data/lib/cb/models/implementations/education.rb +17 -0
- data/lib/cb/models/implementations/email_subscription.rb +17 -0
- data/lib/cb/models/implementations/employee_type.rb +13 -0
- data/lib/cb/models/implementations/job.rb +167 -0
- data/lib/cb/models/implementations/job_branding.rb +34 -0
- data/lib/cb/models/implementations/saved_search.rb +159 -0
- data/lib/cb/models/implementations/spot.rb +30 -0
- data/lib/cb/models/implementations/talent_network.rb +156 -0
- data/lib/cb/models/implementations/user.rb +58 -0
- data/lib/cb/responses/anonymous_saved_search/create.rb +36 -0
- data/lib/cb/responses/anonymous_saved_search/delete.rb +23 -0
- data/lib/cb/responses/api_response.rb +64 -0
- data/lib/cb/responses/employee_types/search.rb +48 -0
- data/lib/cb/responses/errors.rb +47 -0
- data/lib/cb/responses/metadata.rb +27 -0
- data/lib/cb/responses/saved_search/delete.rb +28 -0
- data/lib/cb/responses/saved_search/list.rb +43 -0
- data/lib/cb/responses/saved_search/singular.rb +50 -0
- data/lib/cb/responses/spot/retrieve_response.rb +31 -20
- data/lib/cb/responses/timing.rb +37 -0
- data/lib/cb/utils/api.rb +2 -2
- data/lib/cb/utils/response_array_extractor.rb +14 -4
- data/lib/cb/version.rb +1 -1
- metadata +114 -69
- data/lib/cb/clients/anon_saved_search_api.rb +0 -41
- data/lib/cb/clients/application_api.rb +0 -78
- data/lib/cb/clients/application_external_api.rb +0 -30
- data/lib/cb/clients/category_api.rb +0 -51
- data/lib/cb/clients/company_api.rb +0 -39
- data/lib/cb/clients/education_api.rb +0 -37
- data/lib/cb/clients/email_subscription_api.rb +0 -68
- data/lib/cb/clients/employee_types_api.rb +0 -48
- data/lib/cb/clients/job_api.rb +0 -70
- data/lib/cb/clients/job_branding_api.rb +0 -24
- data/lib/cb/clients/recommendation_api.rb +0 -98
- data/lib/cb/clients/resume_api.rb +0 -185
- data/lib/cb/clients/saved_search_api.rb +0 -139
- data/lib/cb/clients/spot_api.rb +0 -25
- data/lib/cb/clients/talent_network_api.rb +0 -70
- data/lib/cb/clients/user_api.rb +0 -118
- data/lib/cb/criteria/job_details_criteria.rb +0 -11
- data/lib/cb/criteria/job_search_criteria.rb +0 -29
- data/lib/cb/criteria/spot_retrieve_criteria.rb +0 -12
- data/lib/cb/models/implementations/cb_application.rb +0 -91
- data/lib/cb/models/implementations/cb_application_external.rb +0 -31
- data/lib/cb/models/implementations/cb_application_schema.rb +0 -78
- data/lib/cb/models/implementations/cb_category.rb +0 -22
- data/lib/cb/models/implementations/cb_company.rb +0 -133
- data/lib/cb/models/implementations/cb_education.rb +0 -25
- data/lib/cb/models/implementations/cb_email_subscription.rb +0 -19
- data/lib/cb/models/implementations/cb_employee_type.rb +0 -12
- data/lib/cb/models/implementations/cb_job.rb +0 -175
- data/lib/cb/models/implementations/cb_job_branding.rb +0 -33
- data/lib/cb/models/implementations/cb_resume.rb +0 -221
- data/lib/cb/models/implementations/cb_saved_search.rb +0 -228
- data/lib/cb/models/implementations/cb_spot.rb +0 -32
- data/lib/cb/models/implementations/cb_talent_network.rb +0 -155
- data/lib/cb/models/implementations/cb_user.rb +0 -56
- data/lib/cb/responses/raw_api_response.rb +0 -34
data/lib/cb.rb
CHANGED
@@ -2,117 +2,25 @@ require 'cb/config'
|
|
2
2
|
require 'cb/models/implementations/branding/styles/base'
|
3
3
|
require 'cb/models/implementations/branding/styles/css_adapter'
|
4
4
|
require 'cb/exceptions'
|
5
|
+
require 'cb/convenience'
|
5
6
|
|
6
7
|
def require_directory(relative_path)
|
7
8
|
Dir[File.dirname(__FILE__) + relative_path].each { |file| require file }
|
8
9
|
end
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
required_paths.each { |path| require_directory path }
|
11
|
+
%w(/cb/utils/*.rb /cb/clients/**/*.rb /cb/criteria/**/*.rb /cb/models/**.rb
|
12
|
+
/cb/models/**/*.rb /cb/responses/*.rb /cb/responses/**/*.rb).each { |path| require_directory path }
|
13
13
|
|
14
14
|
module Cb
|
15
|
-
|
15
|
+
extend Convenience::ClassMethods
|
16
|
+
|
17
|
+
def self.configure
|
16
18
|
yield configuration
|
17
19
|
end
|
18
20
|
|
19
21
|
def self.configuration
|
20
22
|
@configuration ||= Cb::Config.new
|
21
23
|
@configuration.set_default_api_uris
|
22
|
-
|
23
|
-
return @configuration
|
24
|
-
end
|
25
|
-
|
26
|
-
# Convenience methods, in case you're lazy... like me :)
|
27
|
-
###############################################################
|
28
|
-
|
29
|
-
#Cb::JobApi
|
30
|
-
def self.job
|
31
|
-
Cb::JobApi
|
32
|
-
end
|
33
|
-
|
34
|
-
#Cb::JobSearchCriteria
|
35
|
-
def self.job_search_criteria
|
36
|
-
Cb::JobSearchCriteria.new
|
37
|
-
end
|
38
|
-
|
39
|
-
#Cb::JobDetailsCriteria
|
40
|
-
def self.job_detail_criteria
|
41
|
-
Cb::JobDetailsCriteria.new
|
42
|
-
end
|
43
|
-
|
44
|
-
#Cb::CategoryApi
|
45
|
-
def self.category
|
46
|
-
Cb::CategoryApi
|
47
|
-
end
|
48
|
-
|
49
|
-
#Cb::CompanyApi
|
50
|
-
def self.company
|
51
|
-
Cb::CompanyApi
|
52
|
-
end
|
53
|
-
|
54
|
-
#Cb::EducationApi
|
55
|
-
def self.education_code
|
56
|
-
Cb::EducationApi
|
57
|
-
end
|
58
|
-
|
59
|
-
#Cb::RecommendationApi
|
60
|
-
def self.recommendation
|
61
|
-
Cb::RecommendationApi
|
62
|
-
end
|
63
|
-
|
64
|
-
#Cb::ResumeApi
|
65
|
-
def self.resume
|
66
|
-
Cb::ResumeApi
|
67
|
-
end
|
68
|
-
|
69
|
-
#Cb::ApplicationApi
|
70
|
-
def self.application
|
71
|
-
Cb::ApplicationApi
|
72
|
-
end
|
73
|
-
|
74
|
-
#Cb::ApplicationExternalApi
|
75
|
-
def self.application_external
|
76
|
-
Cb::ApplicationExternalApi
|
77
|
-
end
|
78
|
-
|
79
|
-
#Cb::Utils::Country
|
80
|
-
def self.country
|
81
|
-
Cb::Utils::Country
|
82
|
-
end
|
83
|
-
|
84
|
-
#Cb::UserApi
|
85
|
-
def self.user
|
86
|
-
Cb::UserApi
|
87
|
-
end
|
88
|
-
|
89
|
-
#Cb::JobBrandingApi
|
90
|
-
def self.job_branding
|
91
|
-
Cb::JobBrandingApi
|
92
|
-
end
|
93
|
-
|
94
|
-
#Cb::EmailSubscriptionApi
|
95
|
-
def self.email_subscription
|
96
|
-
Cb::EmailSubscriptionApi
|
97
|
-
end
|
98
|
-
|
99
|
-
#Cb::SavedSearchApi
|
100
|
-
def self.saved_search_api
|
101
|
-
Cb::SavedSearchApi
|
102
|
-
end
|
103
|
-
|
104
|
-
#Cb::TalentNetworkApi
|
105
|
-
def self.talent_network_api
|
106
|
-
Cb::TalentNetworkApi
|
107
|
-
end
|
108
|
-
|
109
|
-
#Cb::AnonSavedSearchApi
|
110
|
-
def self.anon_saved_search_api
|
111
|
-
Cb::AnonSavedSearchApi
|
112
|
-
end
|
113
|
-
|
114
|
-
#Cb::ApiClients::Spot
|
115
|
-
def self.spot
|
116
|
-
Cb::ApiClients::Spot
|
24
|
+
@configuration
|
117
25
|
end
|
118
26
|
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Cb
|
2
|
+
module Clients
|
3
|
+
|
4
|
+
class AnonSavedSearch
|
5
|
+
def create(*args)
|
6
|
+
body = new_model(*args).create_anon_to_xml
|
7
|
+
json = cb_client.cb_post(create_uri, :body => body)
|
8
|
+
Responses::AnonymousSavedSearch::Create.new(json)
|
9
|
+
end
|
10
|
+
|
11
|
+
def delete(*args)
|
12
|
+
body = new_model(*args).delete_anon_to_xml
|
13
|
+
json = cb_client.cb_post(delete_uri, :body => body)
|
14
|
+
Responses::AnonymousSavedSearch::Delete.new(json)
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def new_model(*args)
|
20
|
+
return args.first if args.respond_to?(:[]) && args.first.is_a?(Models::SavedSearch)
|
21
|
+
Models::SavedSearch.new(extract_args(*args))
|
22
|
+
end
|
23
|
+
|
24
|
+
def extract_args(*args)
|
25
|
+
args.is_a?(Array) && args.count == 1 ? args[0] : args
|
26
|
+
end
|
27
|
+
|
28
|
+
def create_uri
|
29
|
+
Cb.configuration.uri_anon_saved_search_create
|
30
|
+
end
|
31
|
+
|
32
|
+
def delete_uri
|
33
|
+
Cb.configuration.uri_anon_saved_search_delete
|
34
|
+
end
|
35
|
+
|
36
|
+
def cb_client
|
37
|
+
@cb_client ||= Cb.api_client.new
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
module Cb
|
4
|
+
module Clients
|
5
|
+
class Application
|
6
|
+
|
7
|
+
def self.for_job(job)
|
8
|
+
job.is_a?(Cb::Models::Job) ? did = job.did : did = job
|
9
|
+
my_api = Cb::Utils::Api.new
|
10
|
+
json_hash = my_api.cb_get(Cb.configuration.uri_application, :query => {:JobDID => did})
|
11
|
+
|
12
|
+
if json_hash.has_key?('ResponseBlankApplication')
|
13
|
+
if json_hash['ResponseBlankApplication'].has_key?('BlankApplication')
|
14
|
+
app = Cb::Models::ApplicationSchema.new(json_hash['ResponseBlankApplication']['BlankApplication'])
|
15
|
+
end
|
16
|
+
|
17
|
+
my_api.append_api_responses(app, json_hash['ResponseBlankApplication'])
|
18
|
+
end
|
19
|
+
|
20
|
+
my_api.append_api_responses(app, json_hash)
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.submit_registered_app(app)
|
24
|
+
return send_to_api(Cb.configuration.uri_application_registered, app)
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.submit_app(app)
|
28
|
+
return send_to_api(Cb.configuration.uri_application_submit, app)
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.send_to_api(uri, app)
|
32
|
+
raise Cb::IncomingParamIsWrongTypeException unless app.is_a?(Cb::Models::Application)
|
33
|
+
|
34
|
+
my_api = Cb::Utils::Api.new
|
35
|
+
json_hash = my_api.cb_post("#{uri}?ipath=#{app.ipath}", :body => app.to_xml)
|
36
|
+
|
37
|
+
if json_hash.has_key? 'ResponseApplication'
|
38
|
+
if json_hash['ResponseApplication'].has_key? 'RedirectURL'
|
39
|
+
app.redirect_url = json_hash['ResponseApplication']['RedirectURL']
|
40
|
+
else
|
41
|
+
app.redirect_url = ''
|
42
|
+
end
|
43
|
+
|
44
|
+
my_api.append_api_responses(app, json_hash['ResponseApplication'])
|
45
|
+
else
|
46
|
+
app.redirect_url = ''
|
47
|
+
end
|
48
|
+
|
49
|
+
my_api.append_api_responses(app, json_hash)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
module Cb
|
4
|
+
module Clients
|
5
|
+
class ApplicationExternal
|
6
|
+
|
7
|
+
def self.submit_app(app)
|
8
|
+
raise Cb::IncomingParamIsWrongTypeException unless app.is_a?(Cb::Models::ApplicationExternal)
|
9
|
+
|
10
|
+
my_api = Cb::Utils::Api.new
|
11
|
+
xml_hash = my_api.cb_post(Cb.configuration.uri_application_external, :body => app.to_xml)
|
12
|
+
|
13
|
+
if xml_hash.has_key? 'ApplyUrl'
|
14
|
+
app.apply_url = xml_hash['ApplyUrl']
|
15
|
+
else
|
16
|
+
app.apply_url = ''
|
17
|
+
end
|
18
|
+
|
19
|
+
my_api.append_api_responses(app, xml_hash)
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require "json"
|
2
|
+
|
3
|
+
module Cb
|
4
|
+
module Clients
|
5
|
+
class Category
|
6
|
+
|
7
|
+
def self.search
|
8
|
+
my_api = Cb::Utils::Api.new
|
9
|
+
json_hash = my_api.cb_get(Cb.configuration.uri_job_category_search)
|
10
|
+
categoryList = []
|
11
|
+
|
12
|
+
if json_hash.has_key?('ResponseCategories')
|
13
|
+
if json_hash['ResponseCategories'].has_key?('Categories')
|
14
|
+
json_hash['ResponseCategories']['Categories']['Category'].each do |cat|
|
15
|
+
categoryList << Models::Category.new(cat)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
my_api.append_api_responses(categoryList, json_hash['ResponseCategories'])
|
20
|
+
end
|
21
|
+
|
22
|
+
my_api.append_api_responses(categoryList, json_hash)
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.search_by_host_site(host_site)
|
26
|
+
my_api = Cb::Utils::Api.new
|
27
|
+
json_hash = my_api.cb_get(Cb.configuration.uri_job_category_search, :query => {:CountryCode => host_site})
|
28
|
+
categoryList = []
|
29
|
+
|
30
|
+
if json_hash.has_key?('ResponseCategories')
|
31
|
+
if json_hash['ResponseCategories'].has_key?('Categories')
|
32
|
+
if json_hash['ResponseCategories']['Categories']['Category'].is_a?(Array)
|
33
|
+
json_hash['ResponseCategories']['Categories']['Category'].each do |cat|
|
34
|
+
categoryList << Models::Category.new(cat)
|
35
|
+
end
|
36
|
+
elsif json_hash['ResponseCategories']['Categories']['Category'].is_a?(Hash) && json_hash.length < 2
|
37
|
+
categoryList << Models::Category.new(json_hash['ResponseCategories']['Categories']['Category'])
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
my_api.append_api_responses(categoryList, json_hash['ResponseCategories'])
|
42
|
+
end
|
43
|
+
|
44
|
+
my_api.append_api_responses(categoryList, json_hash)
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
module Cb
|
4
|
+
module Clients
|
5
|
+
class Company
|
6
|
+
|
7
|
+
def self.find_by_did(did)
|
8
|
+
my_api = Cb::Utils::Api.new
|
9
|
+
json_hash = my_api.cb_get(Cb.configuration.uri_company_find, :query => {:CompanyDID => did, :hostsite=> Cb.configuration.host_site})
|
10
|
+
|
11
|
+
if json_hash.has_key?('Results')
|
12
|
+
if json_hash['Results'].has_key?('CompanyProfileDetail')
|
13
|
+
company = Models::Company.new(json_hash['Results']['CompanyProfileDetail'])
|
14
|
+
end
|
15
|
+
my_api.append_api_responses(company, json_hash['Results'])
|
16
|
+
end
|
17
|
+
|
18
|
+
my_api.append_api_responses(company, json_hash)
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.find_for(obj)
|
22
|
+
if obj.is_a?(String)
|
23
|
+
did = obj
|
24
|
+
elsif obj.is_a?(Cb::Models::Job)
|
25
|
+
did = obj.company_did
|
26
|
+
end
|
27
|
+
did ||= ''
|
28
|
+
|
29
|
+
find_by_did did unless did.empty?
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
module Cb
|
4
|
+
module Clients
|
5
|
+
class Education
|
6
|
+
|
7
|
+
def self.get_for(country)
|
8
|
+
Cb::Utils::Country.is_valid? country ? country : 'US'
|
9
|
+
my_api = Cb::Utils::Api.new
|
10
|
+
json_hash = my_api.cb_get(Cb.configuration.uri_education_code, :query => {:countrycode => country})
|
11
|
+
|
12
|
+
codes = []
|
13
|
+
if json_hash.has_key?('ResponseEducationCodes')
|
14
|
+
if json_hash['ResponseEducationCodes'].has_key?('EducationCodes') &&
|
15
|
+
json_hash['ResponseEducationCodes']['EducationCodes'].has_key?('Education')
|
16
|
+
json_hash['ResponseEducationCodes']['EducationCodes']['Education'].each do | education |
|
17
|
+
codes << Cb::Models::Education.new(education)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
my_api.append_api_responses(codes, json_hash['ResponseEducationCodes'])
|
21
|
+
end
|
22
|
+
|
23
|
+
my_api.append_api_responses(codes, json_hash)
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
module Cb
|
4
|
+
module Clients
|
5
|
+
class EmailSubscription
|
6
|
+
|
7
|
+
def self.retrieve_by_did(did, host_site = '')
|
8
|
+
my_api = Cb::Utils::Api.new
|
9
|
+
json_hash = my_api.cb_get(Cb.configuration.uri_subscription_retrieve, :query => {:ExternalID => did, :Hostsite => host_site})
|
10
|
+
|
11
|
+
if json_hash.has_key?('SubscriptionValues') && !json_hash['SubscriptionValues'].nil?
|
12
|
+
subscription = Models::EmailSubscription.new(json_hash['SubscriptionValues'])
|
13
|
+
my_api.append_api_responses(subscription, json_hash['SubscriptionValues'])
|
14
|
+
end
|
15
|
+
my_api.append_api_responses(subscription, json_hash)
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.modify_subscription ext_id, host_site, career_resources, product_sponsor_info, applicant_survey_invites, job_recs, unsubscribe_all
|
19
|
+
if unsubscribe_all && unsubscribe_all != 'false'
|
20
|
+
career_resources = product_sponsor_info = applicant_survey_invites = job_recs = false.to_s
|
21
|
+
end
|
22
|
+
|
23
|
+
career_resources = career_resources.nil? ? 'false' : career_resources
|
24
|
+
product_sponsor_info = product_sponsor_info.nil? ? 'false' : product_sponsor_info
|
25
|
+
applicant_survey_invites = applicant_survey_invites.nil? ? 'false' : applicant_survey_invites
|
26
|
+
job_recs = job_recs.nil? ? 'false' : job_recs
|
27
|
+
unsubscribe_all = unsubscribe_all.nil? ? 'false' : unsubscribe_all
|
28
|
+
|
29
|
+
my_api = Cb::Utils::Api.new
|
30
|
+
|
31
|
+
xml_body = "<Request>"
|
32
|
+
xml_body += "<DeveloperKey>" + Cb.configuration.dev_key.to_s + "</DeveloperKey>"
|
33
|
+
xml_body += "<ExternalID>" + ext_id.to_s + "</ExternalID>"
|
34
|
+
xml_body += "<Hostsite>" + host_site.to_s + "</Hostsite>"
|
35
|
+
xml_body += "<CareerResources>" + career_resources.to_s + "</CareerResources>"
|
36
|
+
xml_body += "<ProductSponsorInfo>" + product_sponsor_info.to_s + "</ProductSponsorInfo>"
|
37
|
+
xml_body += "<ApplicantSurveyInvites>" + applicant_survey_invites.to_s + "</ApplicantSurveyInvites>"
|
38
|
+
xml_body += "<JobRecs>" + job_recs.to_s + "</JobRecs>"
|
39
|
+
xml_body += "<UnsubscribeAll>" + unsubscribe_all.to_s + "</UnsubscribeAll>"
|
40
|
+
xml_body += "</Request>"
|
41
|
+
|
42
|
+
|
43
|
+
json_hash = my_api.cb_post(Cb.configuration.uri_subscription_modify,
|
44
|
+
:body => xml_body)
|
45
|
+
|
46
|
+
if json_hash.has_key?('SubscriptionValues') && !json_hash['SubscriptionValues'].nil?
|
47
|
+
subscription = Models::EmailSubscription.new(json_hash['SubscriptionValues'])
|
48
|
+
my_api.append_api_responses(subscription, json_hash['SubscriptionValues'])
|
49
|
+
end
|
50
|
+
my_api.append_api_responses(subscription, json_hash)
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Cb
|
2
|
+
module Clients
|
3
|
+
|
4
|
+
class EmployeeTypes
|
5
|
+
def search
|
6
|
+
json = cb_client.cb_get(endpoint)
|
7
|
+
new_response_object(json)
|
8
|
+
end
|
9
|
+
|
10
|
+
def search_by_hostsite(host_site)
|
11
|
+
json = cb_client.cb_get(endpoint, :query => { :CountryCode => host_site })
|
12
|
+
new_response_object(json)
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def cb_client
|
18
|
+
@client ||= Cb.api_client.new
|
19
|
+
end
|
20
|
+
|
21
|
+
def endpoint
|
22
|
+
Cb.configuration.uri_employee_types
|
23
|
+
end
|
24
|
+
|
25
|
+
def new_response_object(json_response)
|
26
|
+
Responses::EmployeeTypes::Search.new(json_response)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|