cb-api 0.0.15 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/cb.rb +8 -1
- data/lib/cb/clients/application_api.rb +5 -5
- data/lib/cb/clients/job_api.rb +0 -12
- data/lib/cb/criteria/job_details_criteria.rb +11 -0
- data/lib/cb/{job_search_criteria.rb → criteria/job_search_criteria.rb} +0 -0
- data/lib/cb/models/cb_application.rb +35 -0
- data/lib/cb/models/{cb_app.rb → cb_application_schema.rb} +33 -28
- data/lib/cb/models/cb_job.rb +62 -7
- data/lib/cb/version.rb +1 -1
- metadata +6 -5
- data/lib/cb/models/cb_job_application.rb +0 -29
data/lib/cb.rb
CHANGED
@@ -1,8 +1,15 @@
|
|
1
|
+
module Cb
|
2
|
+
module Utils
|
3
|
+
module FluidAttributes
|
4
|
+
end
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
1
8
|
require 'cb/config'
|
2
9
|
Dir[File.dirname(__FILE__) + '/cb/utils/*.rb'].each {| file| require file }
|
3
10
|
Dir[File.dirname(__FILE__) + '/cb/clients/*.rb'].each {| file| require file }
|
11
|
+
Dir[File.dirname(__FILE__) + '/cb/criteria/*.rb'].each {| file| require file }
|
4
12
|
Dir[File.dirname(__FILE__) + '/cb/models/*.rb'].each {| file| require file }
|
5
|
-
require 'cb/job_search_criteria'
|
6
13
|
|
7
14
|
module Cb
|
8
15
|
def self.configure
|
@@ -14,10 +14,10 @@ module Cb
|
|
14
14
|
my_api = Cb::Utils::Api.new()
|
15
15
|
cb_response = my_api.cb_get(Cb.configuration.uri_application, :query => {:JobDID => did})
|
16
16
|
json_hash = JSON.parse(cb_response.response.body)
|
17
|
-
|
18
|
-
my_api.append_api_responses(
|
17
|
+
app = Cb::CbApplicationSchema.new(json_hash['ResponseBlankApplication']['BlankApplication'])
|
18
|
+
my_api.append_api_responses(app, json_hash['ResponseBlankApplication'])
|
19
19
|
|
20
|
-
return
|
20
|
+
return app
|
21
21
|
end
|
22
22
|
|
23
23
|
#############################################################
|
@@ -28,7 +28,7 @@ module Cb
|
|
28
28
|
#############################################################
|
29
29
|
def self.submit_registered_app(app)
|
30
30
|
my_api = Cb::Utils::Api.new()
|
31
|
-
cb_response = my_api.cb_post(Cb.configuration.uri_application_registered, :body =>
|
31
|
+
cb_response = my_api.cb_post(Cb.configuration.uri_application_registered, :body => app)
|
32
32
|
|
33
33
|
json_hash = JSON.parse(cb_response.response.body)
|
34
34
|
begin
|
@@ -49,7 +49,7 @@ module Cb
|
|
49
49
|
#############################################################
|
50
50
|
def self.submit_app(app)
|
51
51
|
my_api = Cb::Utils::Api.new()
|
52
|
-
cb_response = my_api.cb_post(Cb.configuration.uri_application_submit, :body =>
|
52
|
+
cb_response = my_api.cb_post(Cb.configuration.uri_application_submit, :body => app)
|
53
53
|
json_hash = cb_response.parsed_response
|
54
54
|
status = json_hash['ResponseApplication']['ApplicationStatus'] == 'Complete (Test)'
|
55
55
|
end
|
data/lib/cb/clients/job_api.rb
CHANGED
@@ -38,7 +38,6 @@ module Cb
|
|
38
38
|
|
39
39
|
cb_response = my_api.cb_get(Cb.configuration.uri_job_find, :query => params)
|
40
40
|
json_hash = JSON.parse(cb_response.response.body)
|
41
|
-
|
42
41
|
job = CbJob.new(json_hash['ResponseJob']['Job'])
|
43
42
|
my_api.append_api_responses(job, json_hash['ResponseJob'])
|
44
43
|
|
@@ -51,15 +50,4 @@ module Cb
|
|
51
50
|
return find_by_criteria(criteria)
|
52
51
|
end
|
53
52
|
end # JobApi
|
54
|
-
|
55
|
-
class JobDetailsCriteria
|
56
|
-
extend Cb::Utils::FluidAttributes
|
57
|
-
|
58
|
-
fluid_attr_accessor :did, :show_job_skin, :site_id, :lhs, :cobrand, :show_apply_requirements
|
59
|
-
|
60
|
-
def find
|
61
|
-
Cb.job.find_by_did(self.did, self)
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
53
|
end # Cb
|
File without changes
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module Cb
|
2
|
+
class CbApplication
|
3
|
+
attr_accessor :job_did, :site_id, :co_brand, :test,
|
4
|
+
:resume_file_name, :resume_file,
|
5
|
+
:answers
|
6
|
+
|
7
|
+
def initialize(job_did, site_id = '', co_brand = '', resume_file_name = '', resume = nil, test = false)
|
8
|
+
@job_did = job_did
|
9
|
+
@site_id = site_id
|
10
|
+
@co_brand = co_brand
|
11
|
+
@test = test
|
12
|
+
@resume_file_name = resume_file_name
|
13
|
+
@resume = resume
|
14
|
+
@answers = []
|
15
|
+
end
|
16
|
+
|
17
|
+
def add_answer(id, text)
|
18
|
+
@answers << CbApplication::CbAnswer.new(id, text)
|
19
|
+
end
|
20
|
+
|
21
|
+
def to_xml
|
22
|
+
|
23
|
+
end
|
24
|
+
end # CbApplication
|
25
|
+
|
26
|
+
############################################################
|
27
|
+
class CbApplication::CbAnswer
|
28
|
+
attr_accessor :id, :text
|
29
|
+
|
30
|
+
def initialize(id, text)
|
31
|
+
@id = id
|
32
|
+
@text = text
|
33
|
+
end
|
34
|
+
end # CbAnswer
|
35
|
+
end # Cb
|
@@ -1,13 +1,13 @@
|
|
1
1
|
module Cb
|
2
|
-
|
2
|
+
#################################################################
|
3
|
+
## This general purpose object stores anything having to do with
|
4
|
+
## an application. The API objects dealing with application,
|
5
|
+
## will populate one or many of this object.
|
6
|
+
#################################################################
|
7
|
+
class CbApplicationSchema
|
3
8
|
attr_accessor :did, :title, :requirements,
|
4
9
|
:apply_url, :submit_service_url, :is_shared_apply,
|
5
10
|
:total_questions, :total_required_questions, :questions
|
6
|
-
#################################################################
|
7
|
-
## This general purpose object stores anything having to do with
|
8
|
-
## an application. The API objects dealing with application,
|
9
|
-
## will populate one or many of this object.
|
10
|
-
#################################################################
|
11
11
|
|
12
12
|
def initialize(args = {})
|
13
13
|
return if args.nil?
|
@@ -25,22 +25,23 @@ module Cb
|
|
25
25
|
# Question related
|
26
26
|
@total_questions = args['TotalQuestions'] || ''
|
27
27
|
@total_required_questions = args['TotalRequiredQuestions'] || ''
|
28
|
-
@total_questions
|
28
|
+
@total_questions = @total_questions.to_i if Cb::Utils::Api.is_numeric? @total_questions
|
29
29
|
@total_required_questions = @total_required_questions.to_i if Cb::Utils::Api.is_numeric? @total_required_questions
|
30
30
|
|
31
31
|
@questions = []
|
32
32
|
if args.has_key?('Questions')
|
33
33
|
unless args['Questions'].empty?
|
34
34
|
args['Questions']['Question'].each do | qq |
|
35
|
-
@questions <<
|
35
|
+
@questions << CbApplicationSchema::CbQuestionSchema.new(qq)
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end # Initialize
|
40
|
-
end #
|
40
|
+
end # CbApplicationSchema
|
41
41
|
|
42
|
-
|
43
|
-
|
42
|
+
#################################################################
|
43
|
+
class CbApplicationSchema::CbQuestionSchema
|
44
|
+
attr_accessor :id, :type, :required, :format, :text, :answers
|
44
45
|
|
45
46
|
def initialize(args = {})
|
46
47
|
return if args.nil?
|
@@ -50,24 +51,28 @@ module Cb
|
|
50
51
|
@required = (args['IsRequired'].downcase == 'true')
|
51
52
|
@format = args['ExpectedResponseFormat'] || ''
|
52
53
|
@text = args['QuestionText'] || ''
|
54
|
+
|
55
|
+
@answers = []
|
56
|
+
if args.has_key?('Answers')
|
57
|
+
unless args['Answers'].empty?
|
58
|
+
args['Answers']['Answer'].each do | aa |
|
59
|
+
@answers << CbApplicationSchema::CbAnswerSchema.new(aa)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
53
63
|
end
|
54
|
-
end #
|
64
|
+
end # CbQuestionSchema
|
55
65
|
|
56
|
-
|
66
|
+
#################################################################
|
67
|
+
class CbApplicationSchema::CbAnswerSchema
|
68
|
+
attr_accessor :question_id, :id, :text
|
57
69
|
|
70
|
+
def initialize(args = {})
|
71
|
+
return if args.nil?
|
58
72
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
# <AnswerID>Yes</AnswerID>
|
66
|
-
#<AnswerText>Yes</AnswerText>
|
67
|
-
# </Answer>
|
68
|
-
#<Answer>
|
69
|
-
#<QuestionID>MeetsRequirements</QuestionID>
|
70
|
-
# <AnswerID>No</AnswerID>
|
71
|
-
#<AnswerText>No</AnswerText>
|
72
|
-
# </Answer>
|
73
|
-
#</Answers>
|
73
|
+
@question_id = args['QuestionID']
|
74
|
+
@id = args['AnswerID']
|
75
|
+
@text = args['AnswerText']
|
76
|
+
end
|
77
|
+
end # CbAnswerSchema
|
78
|
+
end
|
data/lib/cb/models/cb_job.rb
CHANGED
@@ -1,12 +1,18 @@
|
|
1
1
|
module Cb
|
2
2
|
class CbJob
|
3
|
-
attr_accessor :did, :title, :pay, :
|
3
|
+
attr_accessor :did, :title, :job_skin, :pay, :pay_per, :commission, :bonus,
|
4
|
+
:categories, :category_codes, :degree_required, :experience_required, :travel_required,
|
5
|
+
:industry_codes, :manages_others_code,
|
6
|
+
:contact_email_url, :contact_fax, :contact_name, :contact_phone,
|
4
7
|
:company_name, :company_did, :company_details_url, :company_image_url, :company,
|
5
|
-
:description_teaser, :location, :distance, :latitude, :longitude,
|
8
|
+
:description_teaser, :location, :distance, :latitude, :longitude, :location_formatted,
|
6
9
|
:description, :requirements, :employment_type,
|
7
10
|
:details_url, :service_url, :similar_jobs_url, :apply_url,
|
8
11
|
:begin_date, :end_date, :posted_date,
|
9
|
-
:relevancy, :state, :city
|
12
|
+
:relevancy, :state, :city, :zip
|
13
|
+
|
14
|
+
attr_writer :external_application, :relocation_covered, :manages_others, :is_screener_apply,
|
15
|
+
:is_shared_job
|
10
16
|
|
11
17
|
##############################################################
|
12
18
|
## This general purpose object stores anything having to do
|
@@ -22,8 +28,14 @@ module Cb
|
|
22
28
|
@employment_type = args['EmploymentType'] || ''
|
23
29
|
@latitude = args['LocationLatitude'] || ''
|
24
30
|
@longitude = args['LocationLongitude'] || ''
|
25
|
-
@
|
26
|
-
@job_skin = args['JobSkin']
|
31
|
+
@location_formatted = args['LocationFormatted'] || ''
|
32
|
+
@job_skin = args.has_key?("JobSkin") && !args["JobSkin"].nil? ? args['JobSkin']['#cdata-section'] : ''
|
33
|
+
|
34
|
+
# Compensation
|
35
|
+
@pay = args['PayHighLowFormatted'] || ''
|
36
|
+
@pay_per = args['PayPer'] || ''
|
37
|
+
@commission = args.has_key?("PayCommission") && !args["PayCommission"].nil? ? args['PayCommission']['Money']['FormattedAmount'] : ''
|
38
|
+
@bonus = args.has_key?("PayBonus") && !args["PayBonus"].nil? ? args['PayBonus']['Money']['FormattedAmount'] : ''
|
27
39
|
|
28
40
|
# Job Search related
|
29
41
|
@description_teaser = args['DescriptionTeaser'] || ''
|
@@ -34,12 +46,34 @@ module Cb
|
|
34
46
|
@location = args['Location'] || ''
|
35
47
|
@similar_jobs_url = args['SimilarJobsURL'] || ''
|
36
48
|
|
49
|
+
# Summary
|
50
|
+
@categories = args['Categories'] || ''
|
51
|
+
@category_codes = args['CategoriesCodes'] || ''
|
52
|
+
@degree_required = args['DegreeRequiredCode'] || ''
|
53
|
+
@experience_required = args['ExperienceRequiredCode'] || ''
|
54
|
+
@travel_required = args['TravelRequiredCode'] || ''
|
55
|
+
@relocation_covered = args['RelocationCovered'] || ''
|
56
|
+
@industry_codes = args['IndustryCodes'] || ''
|
57
|
+
@manages_others = args['ManagesOthers'] || ''
|
58
|
+
@manages_others_code = args['ManagesOthersCode'] || ''
|
59
|
+
|
60
|
+
# Contact Info
|
61
|
+
@contact_email_url = args['ContactInfoEmailURL'] || ''
|
62
|
+
@contact_fax = args['ContactInfoFax'] || ''
|
63
|
+
@contact_name = args['ContactInfoName'] || ''
|
64
|
+
@contact_phone = args['ContactInfoPhone'] || ''
|
65
|
+
|
37
66
|
# Job Details related
|
38
67
|
@description = args['Description'] || args['JobDescription'] || ''
|
39
68
|
@requirements = args['JobRequirements'] || ''
|
40
69
|
@begin_date = args['BeginDate'] || ''
|
41
70
|
@end_date = args['EndDate'] || ''
|
71
|
+
|
72
|
+
# Application
|
42
73
|
@apply_url = args['ApplyURL'] || ''
|
74
|
+
@external_application = args['ExternalApplication'] || ''
|
75
|
+
@is_screener_apply = args['IsScreenerApply'] || ''
|
76
|
+
@is_shared_job = args['IsSharedJob'] || ''
|
43
77
|
|
44
78
|
# Company related
|
45
79
|
@company_name = args['Company'] || ''
|
@@ -49,8 +83,9 @@ module Cb
|
|
49
83
|
|
50
84
|
# Recommendations related
|
51
85
|
@relevancy = args['Relevancy'] || ''
|
52
|
-
@state = args['
|
53
|
-
@city = args['
|
86
|
+
@state = args['LocationState'] || ''
|
87
|
+
@city = args['LocationCity'] || ''
|
88
|
+
@zip = args['LocationPostalCode'] || ''
|
54
89
|
@company_name = args['Company']['CompanyName'] unless args['Company'].nil? || args['Company']['CompanyName'].nil?
|
55
90
|
@company_details_url = args['Company']['CompanyDetailsURL'] unless args['Company'].nil? || args['Company']['CompanyDetailsURL'].nil?
|
56
91
|
end
|
@@ -64,5 +99,25 @@ module Cb
|
|
64
99
|
return @company
|
65
100
|
end
|
66
101
|
end
|
102
|
+
|
103
|
+
def external_application?
|
104
|
+
@external_application.downcase == 'true' ? true : false
|
105
|
+
end
|
106
|
+
|
107
|
+
def relocation_covered?
|
108
|
+
@relocation_covered.downcase == 'true' ? true : false
|
109
|
+
end
|
110
|
+
|
111
|
+
def manages_others?
|
112
|
+
@manages_others.downcase == 'true' ? true : false
|
113
|
+
end
|
114
|
+
|
115
|
+
def screener_apply?
|
116
|
+
@is_screener_apply.downcase == 'true' ? true : false
|
117
|
+
end
|
118
|
+
|
119
|
+
def shared_job?
|
120
|
+
@is_shared_job.downcase == 'true' ? true : false
|
121
|
+
end
|
67
122
|
end
|
68
123
|
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.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2013-05-
|
14
|
+
date: 2013-05-13 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: httparty
|
@@ -62,14 +62,15 @@ files:
|
|
62
62
|
- lib/cb/clients/job_api.rb
|
63
63
|
- lib/cb/clients/recommendation_api.rb
|
64
64
|
- lib/cb/config.rb
|
65
|
-
- lib/cb/
|
66
|
-
- lib/cb/
|
65
|
+
- lib/cb/criteria/job_details_criteria.rb
|
66
|
+
- lib/cb/criteria/job_search_criteria.rb
|
67
|
+
- lib/cb/models/cb_application.rb
|
68
|
+
- lib/cb/models/cb_application_schema.rb
|
67
69
|
- lib/cb/models/cb_category.rb
|
68
70
|
- lib/cb/models/cb_company.rb
|
69
71
|
- lib/cb/models/cb_education.rb
|
70
72
|
- lib/cb/models/cb_employee_type.rb
|
71
73
|
- lib/cb/models/cb_job.rb
|
72
|
-
- lib/cb/models/cb_job_application.rb
|
73
74
|
- lib/cb/utils/api.rb
|
74
75
|
- lib/cb/utils/country.rb
|
75
76
|
- lib/cb/utils/fluid_attributes.rb
|
@@ -1,29 +0,0 @@
|
|
1
|
-
module Cb
|
2
|
-
class CbJobApplication
|
3
|
-
attr_accessor :job_did, :site_id, :co_brand, :apply_url, :title, :total_questions,
|
4
|
-
:total_required_questions, :questions, :submit_service_url
|
5
|
-
|
6
|
-
##############################################################
|
7
|
-
## This general purpose object stores anything having to do
|
8
|
-
## with an application. The API objects dealing with application,
|
9
|
-
## will populate this object.
|
10
|
-
##############################################################
|
11
|
-
def initialize(args = {})
|
12
|
-
return if args.nil?
|
13
|
-
|
14
|
-
@job_did = args['JobDID'] || ''
|
15
|
-
@site_id = args['SiteID'] || ''
|
16
|
-
@co_brand = args['CoBrand'] || ''
|
17
|
-
@apply_url = args['ApplyURL'] || ''
|
18
|
-
@title = args['JobTitle'] || ''
|
19
|
-
@total_questions = args['TotalQuestions'] || ''
|
20
|
-
@total_required_questions = args['TotalRequiredQuestions'] || ''
|
21
|
-
@questions = args['Questions'] || ''
|
22
|
-
@submit_service_url = args['ApplicationSubmitServiceURL'] || ''
|
23
|
-
|
24
|
-
#TODO
|
25
|
-
# Questions needs to be an array of data containers (of question)
|
26
|
-
|
27
|
-
end
|
28
|
-
end # CbJobApplication
|
29
|
-
end # Cb
|