cb-api 5.5.2 → 5.6.0
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.
@@ -15,6 +15,12 @@ module Cb
|
|
15
15
|
response cb_call(:put, criteria)
|
16
16
|
end
|
17
17
|
|
18
|
+
def form(job_id)
|
19
|
+
url = Cb.configuration.uri_application_form.sub(':did', job_id)
|
20
|
+
response_hash = api_client.cb_get(url, headers: headers)
|
21
|
+
Responses::ApplicationForm.new(response_hash)
|
22
|
+
end
|
23
|
+
|
18
24
|
private
|
19
25
|
|
20
26
|
def cb_call(http_method, criteria)
|
data/lib/cb/config.rb
CHANGED
@@ -6,7 +6,7 @@ module Cb
|
|
6
6
|
:uri_education_code, :uri_employee_types,
|
7
7
|
:uri_recommendation_for_job, :uri_recommendation_for_user,
|
8
8
|
:uri_recommendation_for_company,
|
9
|
-
:uri_application, :uri_application_submit,
|
9
|
+
:uri_application, :uri_application_submit, :uri_application_form,
|
10
10
|
:uri_application_external,
|
11
11
|
:uri_application_registered, :uri_user_change_password, :uri_user_temp_password,
|
12
12
|
:uri_user_delete, :uri_user_retrieve, :uri_user_check_existing,
|
@@ -40,6 +40,7 @@ module Cb
|
|
40
40
|
@uri_application_submit ||= '/v1/Application/submit'
|
41
41
|
@uri_application_registered ||= '/v3/application/registered'
|
42
42
|
@uri_application_external ||= '/v1/application/external'
|
43
|
+
@uri_application_form ||= '/cbapi/job/:did/applicationform'
|
43
44
|
@uri_user_change_password ||= '/v2/User/ChangePW'
|
44
45
|
@uri_user_delete ||= '/v2/User/delete'
|
45
46
|
@uri_user_retrieve ||= '/v2/user/retrieve'
|
@@ -0,0 +1,104 @@
|
|
1
|
+
module Cb
|
2
|
+
module Models
|
3
|
+
class Application
|
4
|
+
|
5
|
+
class Form < ApiResponseModel
|
6
|
+
attr_reader :job_did, :job_title, :is_shared_apply, :question_list, :requirements,
|
7
|
+
:degree_required, :travel_required, :experience_required, :external_application,
|
8
|
+
:total_questions, :total_required_questions
|
9
|
+
|
10
|
+
protected
|
11
|
+
|
12
|
+
def required_fields
|
13
|
+
%w(
|
14
|
+
JobDID JobTitle IsSharedApply QuestionList Requirements DegreeRequired TravelRequired
|
15
|
+
ExperienceRequired ExternalApplication TotalQuestions TotalRequiredQuestions
|
16
|
+
)
|
17
|
+
end
|
18
|
+
|
19
|
+
def set_model_properties
|
20
|
+
@job_did = api_response['JobDID']
|
21
|
+
@job_title = api_response['JobTitle']
|
22
|
+
@is_shared_apply = api_response['IsSharedApply']
|
23
|
+
@requirements = api_response['Requirements']
|
24
|
+
@degree_required = api_response['DegreeRequired']
|
25
|
+
@travel_required = api_response['TravelRequired']
|
26
|
+
@total_questions = api_response['TotalQuestions'].to_i
|
27
|
+
@total_required_questions = api_response['TotalRequiredQuestions'].to_i
|
28
|
+
@experience_required = api_response['ExperienceRequired']
|
29
|
+
@external_application = api_response['ExternalApplication']
|
30
|
+
@question_list = extracted_questions
|
31
|
+
end
|
32
|
+
|
33
|
+
def extracted_questions
|
34
|
+
questions = iterable_questions? ? response_questions : Array.new
|
35
|
+
questions.map { |question_hash| Question.new(question_hash) }
|
36
|
+
end
|
37
|
+
|
38
|
+
def iterable_questions?
|
39
|
+
!response_questions.nil? && !response_questions.empty? && response_questions.respond_to?(:map)
|
40
|
+
end
|
41
|
+
|
42
|
+
def response_questions
|
43
|
+
api_response['QuestionList']
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
class Question < ApiResponseModel
|
48
|
+
attr_reader :expected_response_format, :is_required, :question_id, :question_text,
|
49
|
+
:question_type, :answers, :max_characters, :min_characters
|
50
|
+
|
51
|
+
protected
|
52
|
+
|
53
|
+
def required_fields
|
54
|
+
%w(ExpectedResponseFormat IsRequired QuestionID QuestionText QuestionType Answers)
|
55
|
+
end
|
56
|
+
|
57
|
+
def set_model_properties
|
58
|
+
@is_required = api_response['IsRequired']
|
59
|
+
@question_id = api_response['QuestionID']
|
60
|
+
@question_text = api_response['QuestionText']
|
61
|
+
@question_type = api_response['QuestionType']
|
62
|
+
@answers = extracted_answers
|
63
|
+
@min_characters = extracted_int_or_nil('minCharacters')
|
64
|
+
@max_characters = extracted_int_or_nil('maxCharacters')
|
65
|
+
@expected_response_format = api_response['ExpectedResponseFormat']
|
66
|
+
end
|
67
|
+
|
68
|
+
def extracted_answers
|
69
|
+
answers = iterable_answers? ? response_answers : Array.new
|
70
|
+
answers.map { |answer_hash| Answer.new(answer_hash) }
|
71
|
+
end
|
72
|
+
|
73
|
+
def iterable_answers?
|
74
|
+
!response_answers.nil? && !response_answers.empty? && response_answers.respond_to?(:map)
|
75
|
+
end
|
76
|
+
|
77
|
+
def response_answers
|
78
|
+
api_response['Answers']
|
79
|
+
end
|
80
|
+
|
81
|
+
def extracted_int_or_nil(key)
|
82
|
+
api_response.has_key?(key) ? api_response[key].to_i : nil
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
class Answer < ApiResponseModel
|
87
|
+
attr_reader :answer_id, :answer_text, :question_id
|
88
|
+
|
89
|
+
protected
|
90
|
+
|
91
|
+
def required_fields
|
92
|
+
%w(AnswerID AnswerText QuestionID)
|
93
|
+
end
|
94
|
+
|
95
|
+
def set_model_properties
|
96
|
+
@answer_id = api_response['AnswerID']
|
97
|
+
@answer_text = api_response['AnswerText']
|
98
|
+
@question_id = api_response['QuestionID']
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'cb/responses/api_response'
|
2
|
+
|
3
|
+
module Cb
|
4
|
+
module Responses
|
5
|
+
class ApplicationForm < ApiResponse
|
6
|
+
|
7
|
+
protected
|
8
|
+
|
9
|
+
def hash_containing_metadata
|
10
|
+
response
|
11
|
+
end
|
12
|
+
|
13
|
+
def validate_api_hash
|
14
|
+
required_response_field('Results', response)
|
15
|
+
end
|
16
|
+
|
17
|
+
def extract_models
|
18
|
+
response['Results'].map { |app_form_data| Cb::Models::Application::Form.new(app_form_data) }
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
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: 5.
|
4
|
+
version: 5.6.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-03-
|
12
|
+
date: 2014-03-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|
@@ -215,6 +215,7 @@ files:
|
|
215
215
|
- lib/cb/responses/metadata.rb
|
216
216
|
- lib/cb/responses/job/singular.rb
|
217
217
|
- lib/cb/responses/job/search.rb
|
218
|
+
- lib/cb/responses/application/application_form.rb
|
218
219
|
- lib/cb/responses/spot/retrieve_response.rb
|
219
220
|
- lib/cb/responses/api_response.rb
|
220
221
|
- lib/cb/responses/user/check_existing.rb
|
@@ -231,6 +232,7 @@ files:
|
|
231
232
|
- lib/cb/models/implementations/job_branding.rb
|
232
233
|
- lib/cb/models/implementations/application.rb
|
233
234
|
- lib/cb/models/implementations/application/resume.rb
|
235
|
+
- lib/cb/models/implementations/application/form.rb
|
234
236
|
- lib/cb/models/implementations/application/cover_letter.rb
|
235
237
|
- lib/cb/models/implementations/application/response.rb
|
236
238
|
- lib/cb/models/implementations/job.rb
|