cb-api 0.2.8 → 0.2.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/cb.rb +4 -0
- data/lib/cb/clients/recommendation_api.rb +5 -4
- data/lib/cb/clients/saved_search_api.rb +9 -4
- data/lib/cb/clients/talent_network_api.rb +54 -7
- data/lib/cb/config.rb +9 -2
- data/lib/cb/models/cb_job.rb +23 -1
- data/lib/cb/models/cb_saved_search.rb +2 -1
- data/lib/cb/models/cb_talent_network.rb +158 -0
- data/lib/cb/utils/api.rb +8 -2
- data/lib/cb/utils/validator.rb +28 -0
- data/lib/cb/version.rb +1 -1
- metadata +10 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZTE0YTQ1OTdhMWEzODVkMzRiNGVkY2M2ZTE4N2QyY2VhNWM4ZTY5Mw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MTJhM2FiODZmY2EwZjE3MmFhMzljYjkxMjBlNjA3MzNhYzE4MDUyYg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MzRkNDQ4MmZiMGRhNGRkZDY4OWY5ZmUzNzgyZDI0MDczMWMzYzU0Zjg4MmM5
|
10
|
+
YjYxNDA4MWQ2MWVjNjFmMGI3ZGIyMTRhNGU0NjFiZjlkYjE4ZTkwMjJhYTgy
|
11
|
+
Mzg5M2EwODA0ZTg5YjA3MWViOTIxZjcxYmRlYWVlMDJjYTA2YzA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
N2JiNjhiZDI4YzZhN2M2ZDUxOWM1ODZlNThiZTQ1NjNiZDdmMWMxOGRjOGE1
|
14
|
+
ODIwOGYwNTNmN2I0Yzk1ZTE4MzE4ZjMyNTExYjZiNzdkOTUzZjg5MDBiMWEz
|
15
|
+
MGU5YjYwYWVkNjQ5YjhhMmY0NDg0NjcxYTk3NTI5YmEwN2ViMmI=
|
data/lib/cb.rb
CHANGED
@@ -8,10 +8,11 @@ module Cb
|
|
8
8
|
## For detailed information around this API please visit:
|
9
9
|
## http://api.careerbuilder.com/Recommendations.aspx
|
10
10
|
#############################################################
|
11
|
-
def self.for_job(did, site_id = '', co_brand = '')
|
11
|
+
def self.for_job(did, countlimit = '25', site_id = '', co_brand = '')
|
12
12
|
my_api = Cb::Utils::Api.new()
|
13
13
|
cb_response = my_api.cb_get(Cb.configuration.uri_recommendation_for_job,
|
14
|
-
:query => {:JobDID => did, :
|
14
|
+
:query => {:JobDID => did, :CountLimit => countlimit, :SiteID => site_id,
|
15
|
+
:CoBrand => co_brand, :HostSite => Cb.configuration.host_site})
|
15
16
|
json_hash = JSON.parse(cb_response.response.body)
|
16
17
|
|
17
18
|
jobs = []
|
@@ -32,10 +33,10 @@ module Cb
|
|
32
33
|
## For detailed information around this API please visit:
|
33
34
|
## http://api.careerbuilder.com/Recommendations.aspx
|
34
35
|
#############################################################
|
35
|
-
def self.for_user(external_id, site_id = '', co_brand = '')
|
36
|
+
def self.for_user(external_id, countlimit = '25', site_id = '', co_brand = '')
|
36
37
|
my_api = Cb::Utils::Api.new()
|
37
38
|
cb_response = my_api.cb_get(Cb.configuration.uri_recommendation_for_user,
|
38
|
-
:query => {:ExternalID => external_id, :SiteID => site_id, :CoBrand => co_brand,
|
39
|
+
:query => {:ExternalID => external_id, :CountLimit => countlimit, :SiteID => site_id, :CoBrand => co_brand,
|
39
40
|
:HostSite => Cb.configuration.host_site})
|
40
41
|
json_hash = JSON.parse(cb_response.response.body)
|
41
42
|
|
@@ -14,8 +14,13 @@ module Cb
|
|
14
14
|
my_api = Cb::Utils::Api.new
|
15
15
|
cb_response = my_api.cb_post Cb.configuration.uri_saved_search_create, :body => CbSavedSearch.new(args).create_to_xml
|
16
16
|
json_hash = JSON.parse cb_response.response.body
|
17
|
-
|
18
|
-
|
17
|
+
unless json_hash['SavedJobSearch']['SavedSearch'].nil?
|
18
|
+
saved_search = CbSavedSearch.new json_hash['SavedJobSearch']['SavedSearch']
|
19
|
+
else
|
20
|
+
saved_search = CbSavedSearch.new json_hash['SavedJobSearch']
|
21
|
+
end
|
22
|
+
|
23
|
+
my_api.append_api_responses saved_search, json_hash['SavedJobSearch']
|
19
24
|
|
20
25
|
return saved_search
|
21
26
|
end
|
@@ -31,8 +36,8 @@ module Cb
|
|
31
36
|
my_api = Cb::Utils::Api.new
|
32
37
|
cb_response = my_api.cb_post Cb.configuration.uri_saved_search_update, :body => CbSavedSearch.new(args).update_to_xml
|
33
38
|
json_hash = JSON.parse cb_response.response.body
|
34
|
-
saved_search = CbSavedSearch.new json_hash['SavedJobSearch']
|
35
|
-
my_api.append_api_responses saved_search, json_hash['SavedJobSearch']
|
39
|
+
saved_search = CbSavedSearch.new json_hash['SavedJobSearch']
|
40
|
+
my_api.append_api_responses saved_search, json_hash['SavedJobSearch']
|
36
41
|
|
37
42
|
return saved_search
|
38
43
|
end
|
@@ -1,28 +1,75 @@
|
|
1
1
|
module Cb
|
2
|
-
class
|
2
|
+
class TalentNetworkApi
|
3
3
|
####################################################
|
4
4
|
## Documentation:
|
5
5
|
## http://api.careerbuilder.com/TalentNetwork.aspx
|
6
6
|
####################################################
|
7
7
|
|
8
|
-
def self.join_form_questions(tndid
|
8
|
+
def self.join_form_questions(tndid)
|
9
9
|
## Load the join form questions for a TalentNetworkDID
|
10
|
-
responsetype = 'xml' if responsetype.blank?
|
11
10
|
my_api = Cb::Utils::Api.new()
|
12
|
-
cb_response = my_api.
|
11
|
+
cb_response = my_api.cb_get_secure("#{Cb.configuration.uri_tn_join_questions}/#{tndid}/json")
|
12
|
+
json_hash = JSON.parse(cb_response.response.body)
|
13
|
+
|
14
|
+
tn_questions_collection = TalentNetwork.new(json_hash)
|
15
|
+
my_api.append_api_responses(tn_questions_collection, json_hash)
|
16
|
+
|
17
|
+
return tn_questions_collection
|
13
18
|
end
|
14
19
|
|
15
|
-
def self.join_form_branding
|
20
|
+
def self.join_form_branding(tndid)
|
16
21
|
## Gets branding information (stylesheets, copytext, etc...) for the join form.
|
22
|
+
my_api = Cb::Utils::Api.new
|
23
|
+
|
24
|
+
cb_response = my_api.cb_get_secure("#{Cb.configuration.uri_tn_join_form_branding}/#{tndid}/json")
|
25
|
+
json_hash = JSON.parse(cb_response.response.body)
|
26
|
+
|
27
|
+
tn_join_form_branding = TalentNetwork::JoinFormBranding.new(json_hash['Branding'])
|
28
|
+
my_api.append_api_responses(tn_join_form_branding, json_hash)
|
29
|
+
|
30
|
+
return tn_join_form_branding
|
31
|
+
|
17
32
|
end
|
18
33
|
|
19
|
-
def self.join_form_geography
|
34
|
+
def self.join_form_geography(tnlanguage="USEnglish")
|
20
35
|
## Gets locations needed to fill the Geography question from the Join Form Question API
|
36
|
+
my_api = Cb::Utils::Api.new
|
37
|
+
cb_response = my_api.cb_get_secure("#{Cb.configuration.uri_tn_join_form_geo}", :query=>{:TNLanguage=>"#{tnlanguage}"})
|
38
|
+
json_hash = JSON.parse(cb_response.response.body)
|
39
|
+
|
40
|
+
geo_dropdown = TalentNetwork::JoinFormGeo.new(json_hash)
|
41
|
+
my_api.append_api_responses(geo_dropdown, json_hash)
|
42
|
+
|
43
|
+
return geo_dropdown
|
21
44
|
end
|
22
45
|
|
23
|
-
def self.member_create
|
46
|
+
def self.member_create(args={})
|
24
47
|
## Creates a member based on the form built with the Join Form Questions API call
|
48
|
+
my_api = Cb::Utils::Api.new
|
49
|
+
tn_member = TalentNetwork::Member.new(args)
|
50
|
+
cb_response = my_api.cb_post("#{Cb.configuration.uri_tn_member_create}/json", :body => tn_member.to_xml )
|
51
|
+
json_hash = JSON.parse(cb_response.response.body)
|
52
|
+
|
53
|
+
my_api.append_api_responses(tn_member, json_hash)
|
54
|
+
|
55
|
+
if cb_response.success? && cb_response['Errors'].size == 0
|
56
|
+
return cb_response["MemberDID"]
|
57
|
+
end
|
58
|
+
|
59
|
+
return cb_response['Errors'].first
|
25
60
|
end
|
26
61
|
|
62
|
+
def self.tn_job_information(job_did, join_form_intercept="true")
|
63
|
+
my_api = Cb::Utils::Api.new
|
64
|
+
cb_response = my_api.cb_get_secure("#{Cb.configuration.uri_tn_job_info}/#{job_did}/json", :query=> {
|
65
|
+
:RequestJoinFormIntercept=>join_form_intercept})
|
66
|
+
json_hash = JSON.parse(cb_response.response.body)
|
67
|
+
|
68
|
+
tn_job_info = TalentNetwork::JobInfo.new(json_hash['Response'])
|
69
|
+
my_api.append_api_responses(tn_job_info, json_hash)
|
70
|
+
|
71
|
+
return tn_job_info
|
72
|
+
|
73
|
+
end
|
27
74
|
end #TalentNetworkJoinQuestions
|
28
75
|
end #module
|
data/lib/cb/config.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Cb
|
2
2
|
class Config
|
3
|
-
attr_accessor :dev_key, :debug_api, :time_out, :use_json, :host_site,
|
3
|
+
attr_accessor :dev_key, :base_uri, :base_uri_secure, :debug_api, :time_out, :use_json, :host_site,
|
4
4
|
:uri_job_search, :uri_job_find,
|
5
5
|
:uri_company_find, :uri_job_category_search,
|
6
6
|
:uri_education_code, :uri_employee_types,
|
@@ -15,7 +15,8 @@ module Cb
|
|
15
15
|
:uri_resume_create, :uri_resume_update, :uri_resume_delete,
|
16
16
|
:uri_saved_search_retrieve, :uri_saved_search_create, :uri_saved_search_update, :uri_saved_search_list, :uri_saved_search_delete,
|
17
17
|
:uri_saved_job_search_create,
|
18
|
-
:uri_job_branding, :uri_tn_join_questions,
|
18
|
+
:uri_job_branding, :uri_tn_join_questions, :uri_tn_job_info, :uri_tn_join_form_geo,
|
19
|
+
:uri_tn_join_form_branding, :uri_tn_member_create,
|
19
20
|
:uri_subscription_retrieve, :uri_subscription_modify
|
20
21
|
|
21
22
|
def initialize
|
@@ -52,6 +53,10 @@ module Cb
|
|
52
53
|
@uri_saved_search_delete ||= '/v1/savedsearch/delete'
|
53
54
|
@uri_saved_search_list ||= '/v1/savedsearch/list'
|
54
55
|
@uri_tn_join_questions ||= '/talentnetwork/config/join/questions'
|
56
|
+
@uri_tn_job_info ||= '/talentnetwork/internal/job'
|
57
|
+
@uri_tn_join_form_geo ||= '/tn/JoinForm/Geo'
|
58
|
+
@uri_tn_join_form_branding ||= '/talentnetwork/config/layout/branding'
|
59
|
+
@uri_tn_member_create ||= '/talentnetwork/member/create'
|
55
60
|
@uri_subscription_retrieve ||= '/v1/user/subscription/retrieve'
|
56
61
|
@uri_subscription_modify ||= '/v1/user/subscription'
|
57
62
|
@uri_saved_job_search_create ||= '/v2/savedsearch/create'
|
@@ -102,6 +107,8 @@ module Cb
|
|
102
107
|
def set_defaults
|
103
108
|
|
104
109
|
@dev_key = 'ruby-cb-api' # Get a developer key at http://api.careerbuilder.com
|
110
|
+
@base_uri = 'http://api.careerbuilder.com'
|
111
|
+
@base_uri_secure = 'https://api.careerbuilder.com'
|
105
112
|
@debug_api = false
|
106
113
|
@time_out = 5
|
107
114
|
@use_json = true
|
data/lib/cb/models/cb_job.rb
CHANGED
@@ -9,7 +9,8 @@ module Cb
|
|
9
9
|
:description, :requirements, :employment_type,
|
10
10
|
:details_url, :service_url, :similar_jobs_url, :apply_url,
|
11
11
|
:begin_date, :end_date, :posted_date,
|
12
|
-
:relevancy, :state, :city, :zip
|
12
|
+
:relevancy, :state, :city, :zip,
|
13
|
+
:can_be_quick_applied
|
13
14
|
|
14
15
|
attr_writer :external_application, :relocation_covered, :manages_others, :is_screener_apply,
|
15
16
|
:is_shared_job
|
@@ -81,6 +82,7 @@ module Cb
|
|
81
82
|
@external_application = args['ExternalApplication'] || ''
|
82
83
|
@is_screener_apply = args['IsScreenerApply'] || ''
|
83
84
|
@is_shared_job = args['IsSharedJob'] || ''
|
85
|
+
@can_be_quick_applied = args['CanBeQuickApplied'] || ''
|
84
86
|
|
85
87
|
# Company related
|
86
88
|
@company_name = args['Company'] || ''
|
@@ -126,5 +128,25 @@ module Cb
|
|
126
128
|
def shared_job?
|
127
129
|
@is_shared_job.downcase == 'true' ? true : false
|
128
130
|
end
|
131
|
+
|
132
|
+
def can_be_quick_applied?
|
133
|
+
@can_be_quick_applied.downcase == 'true' ? true : false
|
134
|
+
end
|
135
|
+
|
136
|
+
def city
|
137
|
+
if @city.empty?
|
138
|
+
return @location['City']
|
139
|
+
else
|
140
|
+
return @city
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
def state
|
145
|
+
if @state.empty?
|
146
|
+
return @location['State']
|
147
|
+
else
|
148
|
+
return @state
|
149
|
+
end
|
150
|
+
end
|
129
151
|
end
|
130
152
|
end
|
@@ -5,7 +5,7 @@ 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, :job_search_url, :jrdid
|
8
|
+
:external_user_id, :dev_key, :job_search_url, :jrdid, :errors
|
9
9
|
|
10
10
|
def initialize(args={})
|
11
11
|
@hostsite = args['HostSite'] || ''
|
@@ -40,6 +40,7 @@ module Cb
|
|
40
40
|
@dev_key = args['DeveloperKey'] || ''
|
41
41
|
@job_search_url = args['JobSearchUrl'] || ''
|
42
42
|
@jrdid = args['JRDID'] || ''
|
43
|
+
@errors = args['Errors'] || nil
|
43
44
|
end
|
44
45
|
|
45
46
|
def create_to_xml
|
@@ -0,0 +1,158 @@
|
|
1
|
+
module Cb
|
2
|
+
class TalentNetwork
|
3
|
+
attr_accessor :join_form_questions
|
4
|
+
def initialize(args={})
|
5
|
+
@join_form_questions = Array.new
|
6
|
+
if args.has_key?('JoinQuestions')
|
7
|
+
args['JoinQuestions'].each do |question|
|
8
|
+
@join_form_questions << TalentNetwork::Questions.new(question)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
class TalentNetwork::Member
|
15
|
+
attr_accessor :dev_key, :tn_did, :preferred_language, :accept_privacy, :accept_terms, :resume_word_doc,
|
16
|
+
:join_values
|
17
|
+
|
18
|
+
def initialize(args={})
|
19
|
+
@dev_key = args['DeveloperKey'] || Cb.configuration.dev_key
|
20
|
+
@tn_did = args['TNDID'] || ''
|
21
|
+
@preferred_language = args['PreferredLanguage'] || 'USEnglish'
|
22
|
+
@accept_privacy = args['AcceptPrivacy'] || true
|
23
|
+
@accept_terms = args['AcceptTerms'] || true
|
24
|
+
@resume_word_doc = args['ResumeWordDoc'] || ''
|
25
|
+
@join_values = Hash.new
|
26
|
+
if args.has_key?('JoinValues')
|
27
|
+
@join_values = Hash[args['JoinValues'].each_slice(2).to_a]
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def to_xml
|
32
|
+
ret = "<Request>"
|
33
|
+
ret += "<DeveloperKey>#{@dev_key}</DeveloperKey>"
|
34
|
+
ret += "<TalentNetworkDID>#{@tn_did}</TalentNetworkDID>"
|
35
|
+
ret += "<PreferredLanguage>#{@preferred_language}</PreferredLanguage>"
|
36
|
+
ret += "<AcceptPrivacy>#{@accept_privacy}</AcceptPrivacy>"
|
37
|
+
ret += "<AcceptTerms>#{@accept_terms}</AcceptTerms>"
|
38
|
+
ret += "<ResumeWordDoc>#{@resume_word_doc}</ResumeWordDoc>"
|
39
|
+
ret += "<JoinValues>"
|
40
|
+
@join_values.each { | k,v |
|
41
|
+
ret += "<JoinValue>"
|
42
|
+
ret += "<Key>#{k}</Key>"
|
43
|
+
ret += "<Value>#{v}</Value>"
|
44
|
+
ret += "</JoinValue>"
|
45
|
+
}
|
46
|
+
ret += "</JoinValues>"
|
47
|
+
ret += "</Request>"
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
|
52
|
+
class TalentNetwork::Questions
|
53
|
+
attr_accessor :text, :form_value, :option_display_type, :order, :required, :options
|
54
|
+
|
55
|
+
def initialize(args={})
|
56
|
+
@text = args['Text'] || ''
|
57
|
+
@form_value = args['FormValue'] || ''
|
58
|
+
@option_display_type = args['OptionDisplayType'] || ''
|
59
|
+
@order = args['Order'] || ''
|
60
|
+
@required = args['Required'].to_s || ''
|
61
|
+
@options = Array.new
|
62
|
+
if args.has_key?('Options')
|
63
|
+
args['Options'].each do |option_values|
|
64
|
+
@options << TalentNetwork::Options.new(option_values)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
class TalentNetwork::Options
|
71
|
+
attr_accessor :value, :order, :display_text
|
72
|
+
|
73
|
+
def initialize(args={})
|
74
|
+
@value = args['Value'] || ''
|
75
|
+
@order = args['Order'] || ''
|
76
|
+
@display_text = args['DisplayText'] || ''
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
class TalentNetwork::JobInfo
|
81
|
+
attr_accessor :join_form_url, :tn_did, :join_form_intercept_enabled
|
82
|
+
|
83
|
+
def initialize(args={})
|
84
|
+
@join_form_url = args['JoinFormUrl'] || ''
|
85
|
+
@tn_did = args['sTNDID'] || ''
|
86
|
+
@join_form_intercept_enabled = args['JoinFormInterceptEnabled'].to_s || ''
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
class TalentNetwork::JoinFormGeo
|
91
|
+
attr_accessor :countries, :states
|
92
|
+
|
93
|
+
def initialize(args={})
|
94
|
+
@countries = Hash.new
|
95
|
+
@states = Hash.new
|
96
|
+
|
97
|
+
if args.has_key?('Countries')
|
98
|
+
@countries = TalentNetwork::JoinFormGeoLocation.new(args['Countries'])
|
99
|
+
end
|
100
|
+
|
101
|
+
if args.has_key?('States')
|
102
|
+
@states = TalentNetwork::JoinFormGeoLocation.new(args['States'])
|
103
|
+
end
|
104
|
+
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
class TalentNetwork::JoinFormGeoLocation
|
109
|
+
attr_accessor :geo_hash
|
110
|
+
|
111
|
+
def initialize(args={})
|
112
|
+
value = Array.new
|
113
|
+
display_val = Array.new
|
114
|
+
@geo_hash = Hash.new
|
115
|
+
|
116
|
+
if args.has_key?('Value')
|
117
|
+
args['Value'].each do |val|
|
118
|
+
value << val
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
if args.has_key?('Display')
|
123
|
+
args['Display'].each do |display|
|
124
|
+
display_val << display
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
unless value.nil? || display_val.nil?
|
129
|
+
@geo_hash = convert_to_hash(display_val,value)
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
private
|
134
|
+
def convert_to_hash(keys, values)
|
135
|
+
geo_hash = Hash.new
|
136
|
+
geo_hash = Hash[keys.zip(values)]
|
137
|
+
|
138
|
+
return geo_hash
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
class TalentNetwork::JoinFormBranding
|
143
|
+
attr_accessor :stylesheet_url, :join_logo_image_url, :join_custom_msg_html, :button_color,
|
144
|
+
:mobile_logo_image_url, :nav_color, :site_path
|
145
|
+
|
146
|
+
def initialize(args={})
|
147
|
+
@stylesheet_url = args['StylesheetURL'] || ''
|
148
|
+
@join_logo_image_url = args['JoinLogoImageURL'] || ''
|
149
|
+
@join_custom_msg_html = args['JoinCustomMsgHTML'] || ''
|
150
|
+
@button_color = args['ButtonColor'] || ''
|
151
|
+
@mobile_logo_image_url = args['MobileLogoImageURL'] || ''
|
152
|
+
@nav_color = args['NavColor'] || ''
|
153
|
+
@site_path = args['SitePath'] || ''
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
|
158
|
+
end
|
data/lib/cb/utils/api.rb
CHANGED
@@ -15,12 +15,17 @@ module Cb
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def cb_get(*args, &block)
|
18
|
-
self.class.base_uri
|
18
|
+
self.class.base_uri Cb.configuration.base_uri
|
19
|
+
self.class.get(*args, &block)
|
20
|
+
end
|
21
|
+
|
22
|
+
def cb_get_secure(*args, &block)
|
23
|
+
self.class.base_uri Cb.configuration.base_uri_secure
|
19
24
|
self.class.get(*args, &block)
|
20
25
|
end
|
21
26
|
|
22
27
|
def cb_post(*args, &block)
|
23
|
-
self.class.base_uri
|
28
|
+
self.class.base_uri Cb.configuration.base_uri_secure
|
24
29
|
self.class.post(*args, &block)
|
25
30
|
end
|
26
31
|
|
@@ -77,6 +82,7 @@ module Cb
|
|
77
82
|
def get_meta_name_for(api_key)
|
78
83
|
key_map = {
|
79
84
|
'Errors' => 'errors',
|
85
|
+
'ApiError' => 'api_error',
|
80
86
|
'TimeResponseSent' => 'time_sent',
|
81
87
|
'TimeElapsed' => 'time_elapsed',
|
82
88
|
'TotalPages' => 'total_pages',
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
module Cb
|
4
|
+
module ResponseValidator
|
5
|
+
|
6
|
+
def self.validate(response)
|
7
|
+
if response.blank? || response.response.body.blank?
|
8
|
+
return false
|
9
|
+
end
|
10
|
+
|
11
|
+
if response.code != 200
|
12
|
+
return false
|
13
|
+
end
|
14
|
+
|
15
|
+
begin
|
16
|
+
json = JSON.parse(response.response.body)
|
17
|
+
if json.keys.any? && json[json.keys[0]].empty?
|
18
|
+
return false
|
19
|
+
end
|
20
|
+
rescue JSON::ParserError
|
21
|
+
return false
|
22
|
+
end
|
23
|
+
|
24
|
+
return true
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/cb/version.rb
CHANGED
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.
|
4
|
+
version: 0.2.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jesse Retchko
|
@@ -12,10 +12,13 @@ authors:
|
|
12
12
|
- Kyle Bumpus
|
13
13
|
- Jon Molinaro
|
14
14
|
- Ben Schmaltz
|
15
|
+
- Raul Gil
|
16
|
+
- Christina Chatham
|
17
|
+
- Alex Hristov
|
15
18
|
autorequire:
|
16
19
|
bindir: bin
|
17
20
|
cert_chain: []
|
18
|
-
date: 2013-08-
|
21
|
+
date: 2013-08-22 00:00:00.000000000 Z
|
19
22
|
dependencies:
|
20
23
|
- !ruby/object:Gem::Dependency
|
21
24
|
name: httparty
|
@@ -69,6 +72,9 @@ email:
|
|
69
72
|
- David.Posey@Careerbuilder.com
|
70
73
|
- Kyle.Bumpus@Careerbuilder.com
|
71
74
|
- Ben.Schmaltz@Careerbuilder.com
|
75
|
+
- Raul.Gil@Careerbuilder.com
|
76
|
+
- Christina.Chatham@Careerbuilder.com
|
77
|
+
- Alex.Hristov@Careerbuilder.com
|
72
78
|
executables: []
|
73
79
|
extensions: []
|
74
80
|
extra_rdoc_files: []
|
@@ -115,12 +121,14 @@ files:
|
|
115
121
|
- lib/cb/models/cb_job_branding.rb
|
116
122
|
- lib/cb/models/cb_resume.rb
|
117
123
|
- lib/cb/models/cb_saved_search.rb
|
124
|
+
- lib/cb/models/cb_talent_network.rb
|
118
125
|
- lib/cb/models/cb_user.rb
|
119
126
|
- lib/cb/utils/api.rb
|
120
127
|
- lib/cb/utils/country.rb
|
121
128
|
- lib/cb/utils/fluid_attributes.rb
|
122
129
|
- lib/cb/utils/meta_values.rb
|
123
130
|
- lib/cb/utils/string.rb
|
131
|
+
- lib/cb/utils/validator.rb
|
124
132
|
- lib/cb/version.rb
|
125
133
|
- lib/cb.rb
|
126
134
|
- README.md
|