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,35 +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 'json'
12
- require_relative 'base'
13
- module Cb
14
- module Clients
15
- class Education < Base
16
- def self.get_for(country)
17
- Cb::Utils::Country.is_valid? country ? country : 'US'
18
- json_hash = cb_client.cb_get(Cb.configuration.uri_education_code, query: { countrycode: country })
19
-
20
- codes = []
21
- if json_hash.key?('ResponseEducationCodes')
22
- if json_hash['ResponseEducationCodes'].key?('EducationCodes') &&
23
- json_hash['ResponseEducationCodes']['EducationCodes'].key?('Education')
24
- json_hash['ResponseEducationCodes']['EducationCodes']['Education'].each do |education|
25
- codes << Cb::Models::Education.new(education)
26
- end
27
- end
28
- cb_client.append_api_responses(codes, json_hash['ResponseEducationCodes'])
29
- end
30
-
31
- cb_client.append_api_responses(codes, json_hash)
32
- end
33
- end
34
- end
35
- end
@@ -1,36 +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
- module Cb
13
- module Clients
14
- class EmployeeTypes < Base
15
- def self.search
16
- json = cb_client.cb_get(endpoint)
17
- new_response_object(json)
18
- end
19
-
20
- def self.search_by_hostsite(host_site)
21
- json = cb_client.cb_get(endpoint, query: { CountryCode: host_site })
22
- new_response_object(json)
23
- end
24
-
25
- private
26
-
27
- def self.endpoint
28
- Cb.configuration.uri_employee_types
29
- end
30
-
31
- def self.new_response_object(json_response)
32
- Responses::EmployeeTypes::Search.new(json_response)
33
- end
34
- end
35
- end
36
- 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 'json'
12
- require_relative 'base'
13
- module Cb
14
- module Clients
15
- class Industry < Base
16
- def self.search
17
- response = cb_client.cb_get(Cb.configuration.uri_job_industry_search,
18
- query: { CountryCode: Cb.configuration.host_site })
19
- Cb::Responses::Industry::Search.new(response)
20
- end
21
- end
22
- end
23
- 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
- module Cb
12
- module Models
13
- class Category
14
- attr_accessor :code, :name, :language
15
- def initialize(args = {})
16
- @code = args['Code'] || ''
17
- @name = args['Name']['#text'] || ''
18
- @language = args['Name']['@language'] || ''
19
- end
20
-
21
- def CategoryName
22
- @name unless @name.nil?
23
- end
24
-
25
- def CategoryCode
26
- @code unless @code.nil?
27
- end
28
-
29
- def CategoryLanguage
30
- @language unless @language.nil?
31
- end
32
- end
33
- end
34
- end
@@ -1,25 +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 Models
13
- class CoverLetter
14
- attr_reader :id, :name, :text, :created, :modified
15
-
16
- def initialize(api_cover_letter)
17
- @id = api_cover_letter['CoverLetterDID'] || api_cover_letter['ExternalId']
18
- @name = api_cover_letter['CoverLetterName'] || api_cover_letter['Name']
19
- @text = api_cover_letter['CoverLetterText'] || api_cover_letter['Text']
20
- @created = api_cover_letter['CreatedDate'] || api_cover_letter['CreatedDT']
21
- @modified = api_cover_letter['ModifiedDate'] || api_cover_letter['ModifiedDT']
22
- end
23
- end
24
- end
25
- end
@@ -1,26 +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 Models
13
- class ResumeDataList < ApiResponseModel
14
- attr_accessor :key, :value
15
-
16
- def set_model_properties
17
- @key = api_response['key']
18
- @value = api_response['value']
19
- end
20
-
21
- def required_fields
22
- %w(key value)
23
- end
24
- end
25
- end
26
- 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
- module Cb
12
- module Models
13
- class Education
14
- attr_accessor :code, :text, :language
15
-
16
- def initialize(args = {})
17
- return if args.nil?
18
-
19
- @code = args['Code'] || ''
20
- @language = args['Name']['@language'] unless args['Name'].nil?
21
- @text = args['Name']['#text'] unless args['Name'].nil?
22
- @language ||= ''
23
- @text ||= ''
24
- end
25
- end
26
- end
27
- 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
- module Cb
12
- module Models
13
- class EmployeeType
14
- attr_accessor :code, :name, :language
15
-
16
- def initialize(args = {})
17
- @code = args['Code'] || ''
18
- @name = args['Name']['#text'] rescue ''
19
- @language = args['Name']['@language'] rescue ''
20
- end
21
- end
22
- end
23
- end
@@ -1,32 +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 Models
13
- class Industry < ApiResponseModel
14
- attr_accessor :code, :name
15
-
16
- def initialize(args = {})
17
- @api_response = args
18
- @code = args['Code'] || ''
19
- @name = args['Name']['#text'] || ''
20
- @language = args['Name']['@language'] || ''
21
-
22
- validate_api_response
23
- end
24
-
25
- protected
26
-
27
- def required_fields
28
- %w(Code Name)
29
- end
30
- end
31
- end
32
- 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
- module Cb
12
- module Models
13
- class WorkStatus
14
- attr_accessor :key, :translations
15
-
16
- def initialize(args = {})
17
- return if args.nil?
18
- @key = args['Key'] || ''
19
- @translations = [args['Description']].flatten.map { |translation| Translation.new translation }
20
- end
21
-
22
- class Translation
23
- attr_accessor :language, :value
24
-
25
- def initialize(args = {})
26
- return if args.nil?
27
- @language = args['Language'] || ''
28
- @value = args['Value'] || ''
29
- end
30
- end
31
- end
32
- end
33
- 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 Category
16
- class Search < Base
17
- def endpoint_uri
18
- Cb.configuration.uri_job_category_search
19
- end
20
-
21
- def http_method
22
- :get
23
- end
24
-
25
- def query
26
- {
27
- CountryCode: args[:host_site]
28
- }
29
- end
30
- end
31
- end
32
- end
33
- 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 'cb/requests/base'
12
-
13
- module Cb
14
- module Requests
15
- module CoverLetter
16
- class Delete < Base
17
- def endpoint_uri
18
- Cb.configuration.uri_cover_letter_delete
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
- <Test>#{ args[:test] || false }</Test>
32
- </Request>
33
- eos
34
- end
35
- end
36
- end
37
- end
38
- 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
- require 'cb/requests/base'
12
-
13
- module Cb
14
- module Requests
15
- module CoverLetter
16
- class List < Base
17
- def endpoint_uri
18
- Cb.configuration.uri_cover_letter_list
19
- end
20
-
21
- def http_method
22
- :get
23
- end
24
-
25
- def query
26
- { ExternalUserId: args[:external_user_id] }
27
- end
28
- end
29
- end
30
- end
31
- 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 'cb/requests/base'
12
-
13
- module Cb
14
- module Requests
15
- module CoverLetter
16
- class Retrieve < Base
17
- def endpoint_uri
18
- Cb.configuration.uri_cover_letter_retrieve
19
- end
20
-
21
- def http_method
22
- :get
23
- end
24
-
25
- def query
26
- {
27
- ExternalId: args[:external_id],
28
- ExternalUserId: args[:external_user_id]
29
- }
30
- end
31
- end
32
- end
33
- end
34
- end