cb-api 20.6.0 → 21.0.0.pre1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +1 -0
  3. data/lib/cb/{requests/data_lists/desired_job_type.rb → clients/browser_id.rb} +8 -8
  4. data/lib/cb/clients/data_list.rb +40 -0
  5. data/lib/cb/config.rb +2 -18
  6. data/lib/cb/convenience.rb +4 -16
  7. data/lib/cb/exceptions.rb +7 -2
  8. data/lib/cb/utils/response_map.rb +1 -16
  9. data/lib/cb/utils/validator.rb +13 -2
  10. data/lib/cb/version.rb +1 -1
  11. metadata +6 -44
  12. data/lib/cb/clients/category.rb +0 -55
  13. data/lib/cb/clients/education.rb +0 -35
  14. data/lib/cb/clients/employee_types.rb +0 -36
  15. data/lib/cb/clients/industry.rb +0 -23
  16. data/lib/cb/models/implementations/category.rb +0 -34
  17. data/lib/cb/models/implementations/cover_letter.rb +0 -25
  18. data/lib/cb/models/implementations/data_lists/resume_data_list.rb +0 -26
  19. data/lib/cb/models/implementations/education.rb +0 -27
  20. data/lib/cb/models/implementations/employee_type.rb +0 -23
  21. data/lib/cb/models/implementations/industry.rb +0 -32
  22. data/lib/cb/models/implementations/work_status.rb +0 -33
  23. data/lib/cb/requests/category/search.rb +0 -33
  24. data/lib/cb/requests/cover_letter/delete.rb +0 -38
  25. data/lib/cb/requests/cover_letter/list.rb +0 -31
  26. data/lib/cb/requests/cover_letter/retrieve.rb +0 -34
  27. data/lib/cb/requests/cover_letter/update.rb +0 -40
  28. data/lib/cb/requests/data_lists/countries.rb +0 -23
  29. data/lib/cb/requests/data_lists/data_list_base.rb +0 -50
  30. data/lib/cb/requests/data_lists/education_codes.rb +0 -23
  31. data/lib/cb/requests/data_lists/languages.rb +0 -23
  32. data/lib/cb/requests/data_lists/state.rb +0 -38
  33. data/lib/cb/requests/education/get.rb +0 -33
  34. data/lib/cb/requests/resumes/language_codes.rb +0 -34
  35. data/lib/cb/requests/resumes/list.rb +0 -34
  36. data/lib/cb/requests/work_status/list.rb +0 -33
  37. data/lib/cb/responses/category/search.rb +0 -53
  38. data/lib/cb/responses/cover_letter/delete.rb +0 -27
  39. data/lib/cb/responses/cover_letter/list.rb +0 -39
  40. data/lib/cb/responses/cover_letter/retrieve.rb +0 -39
  41. data/lib/cb/responses/cover_letter/status.rb +0 -31
  42. data/lib/cb/responses/cover_letter/update.rb +0 -27
  43. data/lib/cb/responses/data_list/state.rb +0 -31
  44. data/lib/cb/responses/data_lists/resume_data_list.rb +0 -41
  45. data/lib/cb/responses/education/get.rb +0 -53
  46. data/lib/cb/responses/employee_types/search.rb +0 -55
  47. data/lib/cb/responses/industry/search.rb +0 -55
  48. data/lib/cb/responses/resumes/language_codes.rb +0 -45
  49. data/lib/cb/responses/resumes/resume_list.rb +0 -31
  50. data/lib/cb/responses/work_status/list.rb +0 -43
@@ -1,39 +0,0 @@
1
- # Copyright 2015 CareerBuilder, LLC
2
- # Licensed under the Apache License, Version 2.0 (the "License");
3
- # you may not use this file except in compliance with the License.
4
- # You may obtain a copy of the License at
5
- #
6
- # http://www.apache.org/licenses/LICENSE-2.0
7
- # Unless required by applicable law or agreed to in writing, software
8
- # distributed under the License is distributed on an "AS IS" BASIS,
9
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
- # See the License for the specific language governing permissions and limitations under the License.
11
- module Cb
12
- module Responses
13
- module CoverLetter
14
- class Retrieve < ApiResponse
15
- private
16
-
17
- def extract_models
18
- Models::CoverLetter.new api_cover_letter unless api_cover_letter.nil?
19
- end
20
-
21
- def validate_api_hash
22
- required_response_field(root_node, response)
23
- end
24
-
25
- def hash_containing_metadata
26
- response
27
- end
28
-
29
- def api_cover_letter
30
- response[root_node]['CoverLetter']
31
- end
32
-
33
- def root_node
34
- 'ResponseRetrieve'
35
- end
36
- end
37
- end
38
- end
39
- end
@@ -1,31 +0,0 @@
1
- # Copyright 2015 CareerBuilder, LLC
2
- # Licensed under the Apache License, Version 2.0 (the "License");
3
- # you may not use this file except in compliance with the License.
4
- # You may obtain a copy of the License at
5
- #
6
- # http://www.apache.org/licenses/LICENSE-2.0
7
- # Unless required by applicable law or agreed to in writing, software
8
- # distributed under the License is distributed on an "AS IS" BASIS,
9
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
- # See the License for the specific language governing permissions and limitations under the License.
11
- module Cb
12
- module Responses
13
- module CoverLetter
14
- module Status
15
- def status
16
- response[root_node]['Status']
17
- end
18
-
19
- private
20
-
21
- def validate_api_hash
22
- required_response_field(root_node, response)
23
- end
24
-
25
- def hash_containing_metadata
26
- response
27
- end
28
- end
29
- end
30
- end
31
- end
@@ -1,27 +0,0 @@
1
- # Copyright 2015 CareerBuilder, LLC
2
- # Licensed under the Apache License, Version 2.0 (the "License");
3
- # you may not use this file except in compliance with the License.
4
- # You may obtain a copy of the License at
5
- #
6
- # http://www.apache.org/licenses/LICENSE-2.0
7
- # Unless required by applicable law or agreed to in writing, software
8
- # distributed under the License is distributed on an "AS IS" BASIS,
9
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
- # See the License for the specific language governing permissions and limitations under the License.
11
- require_relative 'status'
12
- require_relative '../nil_model'
13
-
14
- module Cb
15
- module Responses
16
- module CoverLetter
17
- class Update < ApiResponse
18
- include Cb::Responses::CoverLetter::Status
19
- include Cb::Responses::NilModel
20
-
21
- def root_node
22
- 'ResponseUserUpdate'
23
- end
24
- end
25
- end
26
- end
27
- end
@@ -1,31 +0,0 @@
1
- # Copyright 2015 CareerBuilder, LLC
2
- # Licensed under the Apache License, Version 2.0 (the "License");
3
- # you may not use this file except in compliance with the License.
4
- # You may obtain a copy of the License at
5
- #
6
- # http://www.apache.org/licenses/LICENSE-2.0
7
- # Unless required by applicable law or agreed to in writing, software
8
- # distributed under the License is distributed on an "AS IS" BASIS,
9
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
- # See the License for the specific language governing permissions and limitations under the License.
11
- module Cb
12
- module Responses
13
- class State < ApiResponse
14
- def validate_api_hash
15
- required_response_field(root_node, response)
16
- end
17
-
18
- def extract_models
19
- response[root_node].map { |state| Models::State.new(state) }
20
- end
21
-
22
- def hash_containing_metadata
23
- response
24
- end
25
-
26
- def root_node
27
- 'Results'
28
- end
29
- end
30
- end
31
- end
@@ -1,41 +0,0 @@
1
- # Copyright 2015 CareerBuilder, LLC
2
- # Licensed under the Apache License, Version 2.0 (the "License");
3
- # you may not use this file except in compliance with the License.
4
- # You may obtain a copy of the License at
5
- #
6
- # http://www.apache.org/licenses/LICENSE-2.0
7
- # Unless required by applicable law or agreed to in writing, software
8
- # distributed under the License is distributed on an "AS IS" BASIS,
9
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
- # See the License for the specific language governing permissions and limitations under the License.
11
- module Cb
12
- module Responses
13
- class ResumeDataList < ApiResponse
14
- protected
15
-
16
- def validate_api_hash
17
- required_response_field('TotalResults', response)
18
- required_response_field('ReturnedResults', response)
19
- required_response_field(collection_node, response)
20
- end
21
-
22
- def hash_containing_metadata
23
- response['Errors']
24
- end
25
-
26
- def extract_models
27
- model_hash.map! { |list_item| Models::ResumeDataList.new(list_item) }
28
- end
29
-
30
- private
31
-
32
- def collection_node
33
- 'Results'
34
- end
35
-
36
- def model_hash
37
- response[collection_node]
38
- end
39
- end
40
- end
41
- end
@@ -1,53 +0,0 @@
1
- # Copyright 2015 CareerBuilder, LLC
2
- # Licensed under the Apache License, Version 2.0 (the "License");
3
- # you may not use this file except in compliance with the License.
4
- # You may obtain a copy of the License at
5
- #
6
- # http://www.apache.org/licenses/LICENSE-2.0
7
- # Unless required by applicable law or agreed to in writing, software
8
- # distributed under the License is distributed on an "AS IS" BASIS,
9
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
- # See the License for the specific language governing permissions and limitations under the License.
11
- require 'cb/responses/api_response'
12
-
13
- module Cb
14
- module Responses
15
- module Education
16
- class Get < ApiResponse
17
- protected
18
-
19
- def hash_containing_metadata
20
- response
21
- end
22
-
23
- def validate_api_hash
24
- required_response_field(response_node, response)
25
- required_response_field(education_codes_node, response[response_node])
26
- required_response_field(education_array_node, response[response_node][education_codes_node])
27
- end
28
-
29
- def extract_models
30
- model_array.map { |category| Cb::Models::Education.new(category) }
31
- end
32
-
33
- private
34
-
35
- def response_node
36
- 'ResponseEducationCodes'
37
- end
38
-
39
- def education_codes_node
40
- 'EducationCodes'
41
- end
42
-
43
- def education_array_node
44
- 'Education'
45
- end
46
-
47
- def model_array
48
- response[response_node][education_codes_node][education_array_node]
49
- end
50
- end
51
- end
52
- end
53
- end
@@ -1,55 +0,0 @@
1
- # Copyright 2015 CareerBuilder, LLC
2
- # Licensed under the Apache License, Version 2.0 (the "License");
3
- # you may not use this file except in compliance with the License.
4
- # You may obtain a copy of the License at
5
- #
6
- # http://www.apache.org/licenses/LICENSE-2.0
7
- # Unless required by applicable law or agreed to in writing, software
8
- # distributed under the License is distributed on an "AS IS" BASIS,
9
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
- # See the License for the specific language governing permissions and limitations under the License.
11
- module Cb
12
- module Responses
13
- module EmployeeTypes
14
- class Search < ApiResponse
15
- protected
16
-
17
- def hash_containing_metadata
18
- response[root_node]
19
- end
20
-
21
- def validate_api_hash
22
- required_response_field(root_node, response)
23
- required_response_field(outer_collection_node, response[root_node])
24
- required_response_field(inner_collection_node, employee_types_data)
25
- end
26
-
27
- def extract_models
28
- extracted_employee_types_data.map { |emp_type| Models::EmployeeType.new(emp_type) }
29
- end
30
-
31
- private
32
-
33
- def root_node
34
- 'ResponseEmployeeTypes'
35
- end
36
-
37
- def outer_collection_node
38
- 'EmployeeTypes'
39
- end
40
-
41
- def inner_collection_node
42
- 'EmployeeType'
43
- end
44
-
45
- def employee_types_data
46
- response[root_node][outer_collection_node]
47
- end
48
-
49
- def extracted_employee_types_data
50
- Utils::ResponseArrayExtractor.extract(response[root_node], outer_collection_node)
51
- end
52
- end
53
- end
54
- end
55
- end
@@ -1,55 +0,0 @@
1
- # Copyright 2015 CareerBuilder, LLC
2
- # Licensed under the Apache License, Version 2.0 (the "License");
3
- # you may not use this file except in compliance with the License.
4
- # You may obtain a copy of the License at
5
- #
6
- # http://www.apache.org/licenses/LICENSE-2.0
7
- # Unless required by applicable law or agreed to in writing, software
8
- # distributed under the License is distributed on an "AS IS" BASIS,
9
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
- # See the License for the specific language governing permissions and limitations under the License.
11
- module Cb
12
- module Responses
13
- module Industry
14
- class Search < ApiResponse
15
- protected
16
-
17
- def extract_models
18
- extracted_industries_data.map { |indy| Models::Industry.new(indy) }
19
- end
20
-
21
- def validate_api_hash
22
- required_response_field(root_node, response)
23
- required_response_field(outer_collection_node, response[root_node])
24
- required_response_field(inner_collection_node, industry_data)
25
- end
26
-
27
- def hash_containing_metadata
28
- response[root_node]
29
- end
30
-
31
- private
32
-
33
- def root_node
34
- 'ResponseIndustryCodes'
35
- end
36
-
37
- def outer_collection_node
38
- 'IndustryCodes'
39
- end
40
-
41
- def inner_collection_node
42
- 'IndustryCode'
43
- end
44
-
45
- def industry_data
46
- response[root_node][outer_collection_node]
47
- end
48
-
49
- def extracted_industries_data
50
- Utils::ResponseArrayExtractor.extract(response[root_node], outer_collection_node)
51
- end
52
- end
53
- end
54
- end
55
- end
@@ -1,45 +0,0 @@
1
- # Copyright 2015 CareerBuilder, LLC
2
- # Licensed under the Apache License, Version 2.0 (the "License");
3
- # you may not use this file except in compliance with the License.
4
- # You may obtain a copy of the License at
5
- #
6
- # http://www.apache.org/licenses/LICENSE-2.0
7
- # Unless required by applicable law or agreed to in writing, software
8
- # distributed under the License is distributed on an "AS IS" BASIS,
9
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
- # See the License for the specific language governing permissions and limitations under the License.
11
- module Cb
12
- module Responses
13
- class LanguageCodes < ApiResponse
14
- protected
15
-
16
- def validate_api_hash
17
- required_response_field(root_node, response)
18
- required_response_field(collection_node, response[root_node])
19
- required_response_field('LanguageCode', response[root_node][collection_node])
20
- end
21
-
22
- def hash_containing_metadata
23
- response[root_node]
24
- end
25
-
26
- def extract_models
27
- model_hash.map { |language_code| Models::LanguageCode.new(language_code) }
28
- end
29
-
30
- private
31
-
32
- def root_node
33
- 'ResponseLanguageCodes'
34
- end
35
-
36
- def collection_node
37
- 'LanguageCodes'
38
- end
39
-
40
- def model_hash
41
- response[root_node][collection_node]['LanguageCode']
42
- end
43
- end
44
- end
45
- end
@@ -1,31 +0,0 @@
1
- # Copyright 2015 CareerBuilder, LLC
2
- # Licensed under the Apache License, Version 2.0 (the "License");
3
- # you may not use this file except in compliance with the License.
4
- # You may obtain a copy of the License at
5
- #
6
- # http://www.apache.org/licenses/LICENSE-2.0
7
- # Unless required by applicable law or agreed to in writing, software
8
- # distributed under the License is distributed on an "AS IS" BASIS,
9
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
- # See the License for the specific language governing permissions and limitations under the License.
11
- module Cb
12
- module Responses
13
- class ResumeList < ApiResponse
14
- def validate_api_hash
15
- required_response_field(root_node, response)
16
- end
17
-
18
- def extract_models
19
- response[root_node].map { |resume| Models::ResumeListing.new(resume) }
20
- end
21
-
22
- def hash_containing_metadata
23
- response
24
- end
25
-
26
- def root_node
27
- 'Resumes'
28
- end
29
- end
30
- end
31
- end
@@ -1,43 +0,0 @@
1
- # Copyright 2015 CareerBuilder, LLC
2
- # Licensed under the Apache License, Version 2.0 (the "License");
3
- # you may not use this file except in compliance with the License.
4
- # You may obtain a copy of the License at
5
- #
6
- # http://www.apache.org/licenses/LICENSE-2.0
7
- # Unless required by applicable law or agreed to in writing, software
8
- # distributed under the License is distributed on an "AS IS" BASIS,
9
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
- # See the License for the specific language governing permissions and limitations under the License.
11
- require 'cb/responses/api_response'
12
-
13
- module Cb
14
- module Responses
15
- module WorkStatus
16
- class List < ApiResponse
17
- protected
18
-
19
- def hash_containing_metadata
20
- response
21
- end
22
-
23
- def validate_api_hash
24
- required_response_field(work_statuses_node, response)
25
- end
26
-
27
- def extract_models
28
- [model_array].flatten.map { |work_status| Cb::Models::WorkStatus.new work_status }
29
- end
30
-
31
- private
32
-
33
- def work_statuses_node
34
- 'WorkStatuses'
35
- end
36
-
37
- def model_array
38
- response[work_statuses_node]
39
- end
40
- end
41
- end
42
- end
43
- end