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,40 +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/requests/base'
12
-
13
- module Cb
14
- module Requests
15
- module CoverLetter
16
- class Update < Base
17
- def endpoint_uri
18
- Cb.configuration.uri_cover_letter_update
19
- end
20
-
21
- def http_method
22
- :post
23
- end
24
-
25
- def body
26
- <<-eos
27
- <Request>
28
- <DeveloperKey>#{ Cb.configuration.dev_key }</DeveloperKey>
29
- <ExternalID>#{ args[:external_id] }</ExternalID>
30
- <ExternalUserID>#{ args[:external_user_id] }</ExternalUserID>
31
- <CoverLetterTitle>#{ args[:cover_letter_title] }</CoverLetterTitle>
32
- <Text>#{ args[:text] }</Text>
33
- <Test>#{ args[:test] || false }</Test>
34
- </Request>
35
- eos
36
- end
37
- end
38
- end
39
- end
40
- end
@@ -1,23 +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 'data_list_base'
12
-
13
- module Cb
14
- module Requests
15
- module DataLists
16
- class Countries < DataListBase
17
- def api_uri
18
- Cb.configuration.uri_countries
19
- end
20
- end
21
- end
22
- end
23
- end
@@ -1,50 +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 Requests
13
- module DataLists
14
- class DataListBase
15
- attr_reader :token, :args
16
-
17
- def initialize(token, args)
18
- @token = token
19
- @args = args
20
- end
21
-
22
- def get
23
- Cb::Responses::ResumeDataList.new request.parsed
24
- end
25
-
26
- def api_uri
27
- fail NotImplementedError.new __method__
28
- end
29
-
30
- private
31
-
32
- def request
33
- token.get(uri)
34
- end
35
-
36
- def uri
37
- base_uri + query_string
38
- end
39
-
40
- def base_uri
41
- Cb.configuration.base_uri + api_uri
42
- end
43
-
44
- def query_string
45
- args['countrycode'] ? "?countrycode=#{args['countrycode']}" : '?countrycode=US'
46
- end
47
- end
48
- end
49
- end
50
- end
@@ -1,23 +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 'data_list_base'
12
-
13
- module Cb
14
- module Requests
15
- module DataLists
16
- class EducationCodes < DataListBase
17
- def api_uri
18
- Cb.configuration.uri_resume_education
19
- end
20
- end
21
- end
22
- end
23
- end
@@ -1,23 +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 'data_list_base'
12
-
13
- module Cb
14
- module Requests
15
- module DataLists
16
- class Languages < DataListBase
17
- def api_uri
18
- Cb.configuration.uri_languages
19
- end
20
- end
21
- end
22
- end
23
- end
@@ -1,38 +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 '../base'
12
-
13
- module Cb
14
- module Requests
15
- module State
16
- class Get < Base
17
- def base_uri
18
- 'https://www.careerbuilder.com'
19
- end
20
-
21
- def endpoint_uri
22
- Cb.configuration.uri_state_list
23
- end
24
-
25
- def http_method
26
- :get
27
- end
28
-
29
- def query
30
- {
31
- countryCode: args[:country_code],
32
- outputjson: true
33
- }
34
- end
35
- end
36
- end
37
- end
38
- end
@@ -1,33 +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 '../base'
12
-
13
- module Cb
14
- module Requests
15
- module Education
16
- class Get < Base
17
- def endpoint_uri
18
- Cb.configuration.uri_education_code
19
- end
20
-
21
- def http_method
22
- :get
23
- end
24
-
25
- def query
26
- {
27
- CountryCode: @args[:country_code]
28
- }
29
- end
30
- end
31
- end
32
- end
33
- end
@@ -1,34 +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 '../base'
12
-
13
- module Cb
14
- module Requests
15
- module Resumes
16
- class LanguageCodes < Base
17
- def endpoint_uri
18
- Cb.configuration.uri_resume_language_codes
19
- end
20
-
21
- def http_method
22
- :get
23
- end
24
-
25
- def headers
26
- {
27
- 'DeveloperKey' => Cb.configuration.dev_key,
28
- 'Content-Type' => 'application/json;version=1.0'
29
- }
30
- end
31
- end
32
- end
33
- end
34
- end
@@ -1,34 +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 '../base'
12
-
13
- module Cb
14
- module Requests
15
- module Resumes
16
- class List < Base
17
- def endpoint_uri
18
- Cb.configuration.uri_resume_list
19
- end
20
-
21
- def http_method
22
- :get
23
- end
24
-
25
- def query
26
- {
27
- HostSite: args[:host_site] || Cb.configuration.host_site,
28
- OAuthToken: args[:oauth_token]
29
- }
30
- end
31
- end
32
- end
33
- end
34
- end
@@ -1,33 +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 '../base'
12
-
13
- module Cb
14
- module Requests
15
- module WorkStatus
16
- class List < Base
17
- def endpoint_uri
18
- Cb.configuration.uri_work_status_list
19
- end
20
-
21
- def http_method
22
- :get
23
- end
24
-
25
- def query
26
- {
27
- HostSite: @args[:host_site]
28
- }
29
- end
30
- end
31
- end
32
- end
33
- 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 Category
16
- class Search < 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(categories_node, response[response_node])
26
- required_response_field(category_node, response[response_node][categories_node])
27
- end
28
-
29
- def extract_models
30
- model_array.map { |category| Cb::Models::Category.new(category) }
31
- end
32
-
33
- private
34
-
35
- def response_node
36
- 'ResponseCategories'
37
- end
38
-
39
- def categories_node
40
- 'Categories'
41
- end
42
-
43
- def category_node
44
- 'Category'
45
- end
46
-
47
- def model_array
48
- response[response_node][categories_node][category_node]
49
- end
50
- end
51
- end
52
- end
53
- 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 Delete < ApiResponse
18
- include Cb::Responses::CoverLetter::Status
19
- include Cb::Responses::NilModel
20
-
21
- def root_node
22
- 'ResponseUserDelete'
23
- end
24
- end
25
- end
26
- end
27
- end
@@ -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 List < ApiResponse
15
- private
16
-
17
- def extract_models
18
- [ cover_letters_node ].flatten.map { |api_cover_letter| Models::CoverLetter.new api_cover_letter }
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 cover_letters_node
30
- response[root_node]['CoverLetters'].nil? ? [] : response[root_node]['CoverLetters']['CoverLetter']
31
- end
32
-
33
- def root_node
34
- 'ResponseListCoverLetters'
35
- end
36
- end
37
- end
38
- end
39
- end