cb-api 0.1.16 → 0.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/cb/clients/application_api.rb +12 -15
- data/lib/cb/config.rb +1 -1
- data/lib/cb/models/cb_application.rb +49 -14
- data/lib/cb/version.rb +1 -1
- metadata +13 -5
- checksums.yaml +0 -15
@@ -2,6 +2,7 @@ require 'json'
|
|
2
2
|
|
3
3
|
module Cb
|
4
4
|
class ApplicationApi
|
5
|
+
|
5
6
|
#############################################################
|
6
7
|
## Get an application for a job
|
7
8
|
## Takes in either a Cb::CbJob, or a string (which should contain a did)
|
@@ -29,19 +30,7 @@ module Cb
|
|
29
30
|
## http://api.careerbuilder.com/ApplicationInfo.aspx
|
30
31
|
#############################################################
|
31
32
|
def self.submit_registered_app(app)
|
32
|
-
|
33
|
-
|
34
|
-
my_api = Cb::Utils::Api.new()
|
35
|
-
cb_response = my_api.cb_post(Cb.configuration.uri_application_registered, :body => app.to_xml)
|
36
|
-
|
37
|
-
json_hash = JSON.parse(cb_response.response.body)
|
38
|
-
begin
|
39
|
-
status = json_hash['ResponseApplication']['ApplicationStatus'] == 'Complete (Test)' unless json_hash.empty?
|
40
|
-
rescue
|
41
|
-
status = false
|
42
|
-
end
|
43
|
-
|
44
|
-
return status
|
33
|
+
return send_to_api(Cb.configuration.uri_application_registered, app)
|
45
34
|
end
|
46
35
|
|
47
36
|
#############################################################
|
@@ -51,11 +40,19 @@ module Cb
|
|
51
40
|
## http://api.careerbuilder.com/ApplicationInfo.aspx
|
52
41
|
#############################################################
|
53
42
|
def self.submit_app(app)
|
43
|
+
return send_to_api(Cb.configuration.uri_application_submit, app)
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.send_to_api(uri, app)
|
54
47
|
raise Cb::IncomingParamIsWrongTypeException unless app.is_a?(Cb::CbApplication)
|
55
48
|
|
56
49
|
my_api = Cb::Utils::Api.new()
|
57
|
-
|
58
|
-
my_api.append_api_responses(app,
|
50
|
+
cb_response = my_api.cb_post("#{uri}?ipath=#{app.ipath}", :body => app.to_xml)
|
51
|
+
my_api.append_api_responses(app, cb_response['ResponseApplication'])
|
52
|
+
|
53
|
+
begin
|
54
|
+
app.redirect_url = cb_response['ResponseApplication']['RedirectURL'] || ''
|
55
|
+
end
|
59
56
|
|
60
57
|
return app
|
61
58
|
end
|
data/lib/cb/config.rb
CHANGED
@@ -29,7 +29,7 @@ module Cb
|
|
29
29
|
@uri_recommendation_for_company ||= '/Employer/JobRecommendation'
|
30
30
|
@uri_application ||= '/v1/application/blank'
|
31
31
|
@uri_application_submit ||= '/v1/Application/submit'
|
32
|
-
@uri_application_registered ||= '/v3/
|
32
|
+
@uri_application_registered ||= '/v3/application/registered'
|
33
33
|
@uri_application_external ||= '/v1/application/external'
|
34
34
|
@uri_user_change_password ||= '/v2/User/ChangePW'
|
35
35
|
@uri_user_delete ||= '/v2/User/delete'
|
@@ -1,17 +1,47 @@
|
|
1
1
|
module Cb
|
2
2
|
class CbApplication
|
3
|
-
|
4
|
-
|
3
|
+
#request params
|
4
|
+
attr_accessor :job_did, :site_id, :ipath, :co_brand, :test,
|
5
|
+
:resume_file_name, :resume,
|
6
|
+
:user_external_id, :user_external_resume_id,
|
5
7
|
:answers
|
6
8
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
@
|
13
|
-
@
|
14
|
-
@
|
9
|
+
#response params
|
10
|
+
#redirect_url is returned from the api for shared apply applications.
|
11
|
+
attr_accessor :redirect_url
|
12
|
+
|
13
|
+
def initialize(args = {})
|
14
|
+
@job_did = args[:job_did]
|
15
|
+
@site_id = args[:site_id] || 'cbnsv'
|
16
|
+
@ipath = args[:ipath] || ''
|
17
|
+
@co_brand = args[:co_brand] || ''
|
18
|
+
@test = args[:test] || 'false'
|
19
|
+
@resume_file_name = args[:resume_file_name] || ''
|
20
|
+
@resume = args[:resume] || ''
|
21
|
+
@user_external_id = args[:user_external_id] || ''
|
22
|
+
@user_external_resume_id = args[:user_external_resume_id] || ''
|
23
|
+
@answers = []
|
24
|
+
@redirect_url = ''
|
25
|
+
end
|
26
|
+
|
27
|
+
def submit
|
28
|
+
if is_registered?
|
29
|
+
Cb.application.submit_registered_app(self)
|
30
|
+
else
|
31
|
+
Cb.application.submit_app(self)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def is_registered?
|
36
|
+
!@user_external_id.blank? && @resume.blank?
|
37
|
+
end
|
38
|
+
|
39
|
+
def is_unregistered?
|
40
|
+
!is_registered?
|
41
|
+
end
|
42
|
+
|
43
|
+
def complete?
|
44
|
+
cb_response.application_status == 'Complete' || cb_response.application_status == 'Complete (Test)'
|
15
45
|
end
|
16
46
|
|
17
47
|
def add_answer(id, text)
|
@@ -23,10 +53,12 @@ module Cb
|
|
23
53
|
|
24
54
|
ret = "#{ret}<DeveloperKey>#{Cb.configuration.dev_key}</DeveloperKey>"
|
25
55
|
ret = "#{ret}<JobDID>#{@job_did}</JobDID>"
|
26
|
-
ret = "#{ret}<Test>#{@test}</Test>"
|
27
|
-
ret = "#{ret}<SiteID>#{@site_id}</SiteID>"
|
28
|
-
ret = "#{ret}<
|
29
|
-
ret = "#{ret}<
|
56
|
+
ret = "#{ret}<Test>#{@test}</Test>" unless @test.blank?
|
57
|
+
ret = "#{ret}<SiteID>#{@site_id}</SiteID>" unless @site_id.blank?
|
58
|
+
#ret = "#{ret}<IPath>#{@ipath}</IPath>" unless @ipath.blank? #this has to be passed by query string because the api is lame.
|
59
|
+
ret = "#{ret}<CoBrand>#{@co_brand}</CoBrand>" unless @co_brand.blank?
|
60
|
+
ret = "#{ret}<HostSite>#{Cb.configuration.host_site}</HostSite>"
|
61
|
+
ret = "#{ret}<Resume><ResumeFileName>#{@resume_file_name}</ResumeFileName><ResumeData>#{@resume}</ResumeData></Resume>" if is_unregistered?
|
30
62
|
|
31
63
|
unless @answers.count == 0
|
32
64
|
ret = "#{ret}<Responses>"
|
@@ -36,6 +68,9 @@ module Cb
|
|
36
68
|
ret = "#{ret}</Responses>"
|
37
69
|
end
|
38
70
|
|
71
|
+
ret = "#{ret}<ExternalUserID>#{@user_external_id}</ExternalUserID>" if is_registered?
|
72
|
+
ret = "#{ret}<ExternalResumeID>#{@user_external_resume_id}</ExternalResumeID>" if is_registered?
|
73
|
+
|
39
74
|
"#{ret}</RequestApplication>"
|
40
75
|
end # to_xml
|
41
76
|
end # CbApplication
|
data/lib/cb/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cb-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.17
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Jesse Retchko
|
@@ -14,11 +15,12 @@ authors:
|
|
14
15
|
autorequire:
|
15
16
|
bindir: bin
|
16
17
|
cert_chain: []
|
17
|
-
date: 2013-07-
|
18
|
+
date: 2013-07-22 00:00:00.000000000 Z
|
18
19
|
dependencies:
|
19
20
|
- !ruby/object:Gem::Dependency
|
20
21
|
name: httparty
|
21
22
|
requirement: !ruby/object:Gem::Requirement
|
23
|
+
none: false
|
22
24
|
requirements:
|
23
25
|
- - ~>
|
24
26
|
- !ruby/object:Gem::Version
|
@@ -26,6 +28,7 @@ dependencies:
|
|
26
28
|
type: :runtime
|
27
29
|
prerelease: false
|
28
30
|
version_requirements: !ruby/object:Gem::Requirement
|
31
|
+
none: false
|
29
32
|
requirements:
|
30
33
|
- - ~>
|
31
34
|
- !ruby/object:Gem::Version
|
@@ -33,6 +36,7 @@ dependencies:
|
|
33
36
|
- !ruby/object:Gem::Dependency
|
34
37
|
name: json
|
35
38
|
requirement: !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
36
40
|
requirements:
|
37
41
|
- - ~>
|
38
42
|
- !ruby/object:Gem::Version
|
@@ -40,6 +44,7 @@ dependencies:
|
|
40
44
|
type: :runtime
|
41
45
|
prerelease: false
|
42
46
|
version_requirements: !ruby/object:Gem::Requirement
|
47
|
+
none: false
|
43
48
|
requirements:
|
44
49
|
- - ~>
|
45
50
|
- !ruby/object:Gem::Version
|
@@ -47,6 +52,7 @@ dependencies:
|
|
47
52
|
- !ruby/object:Gem::Dependency
|
48
53
|
name: nori
|
49
54
|
requirement: !ruby/object:Gem::Requirement
|
55
|
+
none: false
|
50
56
|
requirements:
|
51
57
|
- - ~>
|
52
58
|
- !ruby/object:Gem::Version
|
@@ -54,6 +60,7 @@ dependencies:
|
|
54
60
|
type: :runtime
|
55
61
|
prerelease: false
|
56
62
|
version_requirements: !ruby/object:Gem::Requirement
|
63
|
+
none: false
|
57
64
|
requirements:
|
58
65
|
- - ~>
|
59
66
|
- !ruby/object:Gem::Version
|
@@ -118,25 +125,26 @@ files:
|
|
118
125
|
- README.md
|
119
126
|
homepage: http://api.careerbuilder.com
|
120
127
|
licenses: []
|
121
|
-
metadata: {}
|
122
128
|
post_install_message:
|
123
129
|
rdoc_options: []
|
124
130
|
require_paths:
|
125
131
|
- lib
|
126
132
|
required_ruby_version: !ruby/object:Gem::Requirement
|
133
|
+
none: false
|
127
134
|
requirements:
|
128
135
|
- - ! '>='
|
129
136
|
- !ruby/object:Gem::Version
|
130
137
|
version: '0'
|
131
138
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
139
|
+
none: false
|
132
140
|
requirements:
|
133
141
|
- - ! '>='
|
134
142
|
- !ruby/object:Gem::Version
|
135
143
|
version: '0'
|
136
144
|
requirements: []
|
137
145
|
rubyforge_project:
|
138
|
-
rubygems_version:
|
146
|
+
rubygems_version: 1.8.25
|
139
147
|
signing_key:
|
140
|
-
specification_version:
|
148
|
+
specification_version: 3
|
141
149
|
summary: Ruby wrapper around Careerbuilder Public API.
|
142
150
|
test_files: []
|
checksums.yaml
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
---
|
2
|
-
!binary "U0hBMQ==":
|
3
|
-
metadata.gz: !binary |-
|
4
|
-
MDQ4MGFkZDMyYTE0YTAwODFlNWEyNWI0MWRiMDQwY2U1ODE5YmUyMw==
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
Y2MwZThmYzllYmU0MGNiNzY5MDdlYWMyZGExZTYxNDhhN2FhMzZjMg==
|
7
|
-
!binary "U0hBNTEy":
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
Zjg3YmY3ODg0ZWZiMTVhZWZlYjlmNmE2YzNkZDg3ZTUxMjgwMjJjNmU2NTE5
|
10
|
-
YTBjYTdkN2MyYmVmNzg5M2Q2NDk5MTRlNWM4Y2EyMjcxMzg0NmY1NTBkY2Ux
|
11
|
-
YTJiMmIwNTE4YjE1ZTQ3ZjAzOTgyMmQ1YmYzMjZjMDg2ZmU1YzM=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
MjVmYTczZGUzOTkxYWY2Yzc4MDA0OTkzYjNlZDZhZWUxZGNhYTJkMzkwNGI2
|
14
|
-
ODc5ZjIyMDE2MDY5MGFjYjEyMTFhMzE0MTJhYTE1M2E0M2ZhOWY3M2ZmYTcw
|
15
|
-
MTc4ZWE5YzlkN2NlODFkZTI2YmRjZWM5MzI1NjNmMDMwNzFjYzM=
|