cb-api 11.0.0 → 11.1.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.
- data/lib/cb.rb +0 -1
- data/lib/cb/config.rb +38 -73
- data/lib/cb/models/implementations/work_status.rb +24 -0
- data/lib/cb/requests/work_status/list.rb +25 -0
- data/lib/cb/responses/work_status/list.rb +35 -0
- data/lib/cb/utils/response_map.rb +3 -1
- data/lib/cb/version.rb +1 -1
- metadata +5 -2
data/lib/cb.rb
CHANGED
data/lib/cb/config.rb
CHANGED
@@ -1,29 +1,46 @@
|
|
1
1
|
module Cb
|
2
2
|
class Config
|
3
|
-
attr_accessor :dev_key, :base_uri, :debug_api, :time_out, :use_json, :host_site, :test_resources, :observers,
|
4
|
-
:uri_job_search, :uri_job_find,
|
5
|
-
:uri_company_find, :uri_job_category_search, :uri_job_industry_search,
|
6
|
-
:uri_education_code, :uri_employee_types,
|
7
|
-
:uri_recommendation_for_job, :uri_recommendation_for_user,
|
8
|
-
:uri_recommendation_for_company,
|
9
|
-
:uri_application, :uri_application_submit, :uri_application_form,
|
10
|
-
:uri_application_external, :uri_application_create,
|
11
|
-
:uri_application_registered, :uri_user_change_password, :uri_user_temp_password,
|
12
|
-
:uri_user_delete, :uri_user_retrieve, :uri_user_check_existing,
|
13
|
-
:uri_job_branding,
|
14
|
-
:uri_saved_search_retrieve, :uri_saved_search_create, :uri_saved_search_update, :uri_saved_search_list, :uri_saved_search_delete,
|
15
|
-
:uri_anon_saved_search_create, :uri_anon_saved_search_delete,
|
16
|
-
:uri_saved_job_search_create,
|
17
|
-
:uri_job_branding, :uri_tn_join_questions, :uri_tn_job_info, :uri_tn_join_form_geo,
|
18
|
-
:uri_tn_join_form_branding, :uri_tn_member_create,
|
19
|
-
:uri_subscription_retrieve, :uri_subscription_modify,
|
20
|
-
:uri_spot_retrieve
|
21
3
|
|
22
4
|
def initialize
|
23
5
|
Cb::Utils::Country.inject_convenience_methods
|
24
6
|
set_defaults
|
25
7
|
end
|
26
8
|
|
9
|
+
def to_hash
|
10
|
+
hash = {}
|
11
|
+
|
12
|
+
instance_variables.each do |instance_variable|
|
13
|
+
attribute = instance_variable[1..-1].to_sym
|
14
|
+
|
15
|
+
hash[attribute] = send attribute
|
16
|
+
end
|
17
|
+
|
18
|
+
hash
|
19
|
+
end
|
20
|
+
|
21
|
+
def set_base_uri(uri)
|
22
|
+
@base_uri = uri
|
23
|
+
end
|
24
|
+
|
25
|
+
protected
|
26
|
+
#################################################################
|
27
|
+
|
28
|
+
def set_defaults
|
29
|
+
@dev_key = 'ruby-cb-api' # Get a developer key at http://api.careerbuilder.com
|
30
|
+
@base_uri = 'https://api.careerbuilder.com'
|
31
|
+
@debug_api = false
|
32
|
+
@time_out = 5
|
33
|
+
@use_json = true
|
34
|
+
@host_site = Cb.country.US
|
35
|
+
@test_resources = false
|
36
|
+
@observers = Array.new
|
37
|
+
set_default_api_uris
|
38
|
+
set_attr_accessors
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
#################################################################
|
43
|
+
|
27
44
|
def set_default_api_uris
|
28
45
|
@uri_job_category_search ||= '/v1/categories'
|
29
46
|
@uri_job_industry_search ||= '/v1/industrycodes'
|
@@ -63,64 +80,12 @@ module Cb
|
|
63
80
|
@uri_subscription_modify ||= '/v1/user/subscription?version=v2'
|
64
81
|
@uri_saved_job_search_create ||= '/v2/savedsearch/create'
|
65
82
|
@uri_spot_retrieve ||= '/v2/spot/load'
|
83
|
+
@uri_work_status_list ||= '/v1/resume/workstatuslist'
|
66
84
|
end
|
67
85
|
|
68
|
-
def
|
69
|
-
{
|
70
|
-
:uri_job_category_search => @uri_job_category_search,
|
71
|
-
:uri_job_industry_search => @uri_job_industry_search,
|
72
|
-
:uri_employee_types => @uri_employee_types,
|
73
|
-
:dev_key => @dev_key,
|
74
|
-
:host_site => @host_site,
|
75
|
-
:time_out => @time_out,
|
76
|
-
:use_json => @use_json,
|
77
|
-
:uri_job_search => @uri_job_search,
|
78
|
-
:uri_job_find => @uri_job_find,
|
79
|
-
:uri_company_find => @uri_company_find,
|
80
|
-
:uri_education_code => @uri_education_code,
|
81
|
-
:uri_recommendation_for_job => @uri_recommendation_for_job,
|
82
|
-
:uri_recommendation_for_user => @uri_recommendation_for_user,
|
83
|
-
:uri_recommendation_for_company => @uri_recommendation_for_company,
|
84
|
-
:uri_application => @uri_application,
|
85
|
-
:uri_application_submit => @uri_application_submit,
|
86
|
-
:uri_application_registered => @uri_application_registered,
|
87
|
-
:uri_application_external => @uri_application_external,
|
88
|
-
:uri_user_change_password => @uri_user_change_password,
|
89
|
-
:uri_user_retrieve => @uri_user_retrieve,
|
90
|
-
:uri_user_check_existing => @uri_user_check_existing,
|
91
|
-
:uri_job_branding => @uri_job_branding,
|
92
|
-
:uri_saved_search_retrieve => @uri_saved_search_retrieve,
|
93
|
-
:uri_saved_search_create => @uri_saved_search_create,
|
94
|
-
:uri_saved_search_update => @uri_saved_search_update,
|
95
|
-
:uri_saved_search_delete => @uri_saved_search_delete,
|
96
|
-
:uri_saved_search_list => @uri_saved_search_list,
|
97
|
-
:uri_anon_saved_search_create => @uri_anon_saved_search_create,
|
98
|
-
:uri_tn_join_questions => @uri_tn_join_questions,
|
99
|
-
:uri_subscription_retrieve => @uri_subscription_retrieve,
|
100
|
-
:uri_subscription_modify => @uri_subscription_modify,
|
101
|
-
:uri_saved_job_search_create => @uri_saved_job_search_create,
|
102
|
-
:uri_spot_retrieve => @uri_spot_retrieve
|
103
|
-
}
|
86
|
+
def set_attr_accessors
|
87
|
+
instance_variables.each { |instance_variable| self.class.send :attr_accessor, instance_variable[1..-1].to_sym }
|
104
88
|
end
|
105
89
|
|
106
|
-
def set_base_uri (uri)
|
107
|
-
@base_uri = uri
|
108
|
-
end
|
109
|
-
|
110
|
-
protected
|
111
|
-
#################################################################
|
112
|
-
|
113
|
-
def set_defaults
|
114
|
-
|
115
|
-
@dev_key = 'ruby-cb-api' # Get a developer key at http://api.careerbuilder.com
|
116
|
-
@base_uri = 'https://api.careerbuilder.com'
|
117
|
-
@debug_api = false
|
118
|
-
@time_out = 5
|
119
|
-
@use_json = true
|
120
|
-
@host_site = Cb.country.US
|
121
|
-
@test_resources = false
|
122
|
-
@observers = Array.new
|
123
|
-
set_default_api_uris
|
124
|
-
end
|
125
90
|
end
|
126
91
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Cb
|
2
|
+
module Models
|
3
|
+
class WorkStatus
|
4
|
+
attr_accessor :key, :translations
|
5
|
+
|
6
|
+
def initialize(args = {})
|
7
|
+
return if args.nil?
|
8
|
+
@key = args['Key'] || ''
|
9
|
+
@translations = [ args['Description'] ].flatten.map { |translation| Translation.new translation }
|
10
|
+
end
|
11
|
+
|
12
|
+
class Translation
|
13
|
+
attr_accessor :language, :value
|
14
|
+
|
15
|
+
def initialize(args = {})
|
16
|
+
return if args.nil?
|
17
|
+
@language = args['Language'] || ''
|
18
|
+
@value = args['Value'] || ''
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require_relative '../base'
|
2
|
+
|
3
|
+
module Cb
|
4
|
+
module Requests
|
5
|
+
module WorkStatus
|
6
|
+
class List < Base
|
7
|
+
|
8
|
+
def endpoint_uri
|
9
|
+
Cb.configuration.uri_work_status_list
|
10
|
+
end
|
11
|
+
|
12
|
+
def http_method
|
13
|
+
:get
|
14
|
+
end
|
15
|
+
|
16
|
+
def query
|
17
|
+
{
|
18
|
+
HostSite: @args[:host_site]
|
19
|
+
}
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'cb/responses/api_response'
|
2
|
+
|
3
|
+
module Cb
|
4
|
+
module Responses
|
5
|
+
module WorkStatus
|
6
|
+
class List < ApiResponse
|
7
|
+
|
8
|
+
protected
|
9
|
+
|
10
|
+
def hash_containing_metadata
|
11
|
+
response
|
12
|
+
end
|
13
|
+
|
14
|
+
def validate_api_hash
|
15
|
+
required_response_field(work_statuses_node, response)
|
16
|
+
end
|
17
|
+
|
18
|
+
def extract_models
|
19
|
+
[ model_array ].flatten.map { |work_status| Cb::Models::WorkStatus.new work_status }
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def work_statuses_node
|
25
|
+
"WorkStatuses"
|
26
|
+
end
|
27
|
+
|
28
|
+
def model_array
|
29
|
+
response[work_statuses_node]
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -43,7 +43,9 @@ module Cb
|
|
43
43
|
Cb::Requests::User::CheckExisting => Cb::Responses::User::CheckExisting,
|
44
44
|
Cb::Requests::User::Delete => Cb::Responses::User::Delete,
|
45
45
|
Cb::Requests::User::Retrieve => Cb::Responses::User::Retrieve,
|
46
|
-
Cb::Requests::User::TemporaryPassword => Cb::Responses::User::TemporaryPassword
|
46
|
+
Cb::Requests::User::TemporaryPassword => Cb::Responses::User::TemporaryPassword,
|
47
|
+
|
48
|
+
Cb::Requests::WorkStatus::List => Cb::Responses::WorkStatus::List
|
47
49
|
}.merge response_hash_extension
|
48
50
|
end
|
49
51
|
|
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: 11.
|
4
|
+
version: 11.1.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-07-
|
12
|
+
date: 2014-07-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|
@@ -243,6 +243,7 @@ files:
|
|
243
243
|
- lib/cb/responses/user/change_password.rb
|
244
244
|
- lib/cb/responses/user/temporary_password.rb
|
245
245
|
- lib/cb/responses/user/retrieve.rb
|
246
|
+
- lib/cb/responses/work_status/list.rb
|
246
247
|
- lib/cb/responses/timing.rb
|
247
248
|
- lib/cb/responses/category/search.rb
|
248
249
|
- lib/cb/responses/application_external/submit_application.rb
|
@@ -287,6 +288,7 @@ files:
|
|
287
288
|
- lib/cb/models/implementations/branding/media.rb
|
288
289
|
- lib/cb/models/implementations/branding/widget.rb
|
289
290
|
- lib/cb/models/implementations/company.rb
|
291
|
+
- lib/cb/models/implementations/work_status.rb
|
290
292
|
- lib/cb/models/implementations/category.rb
|
291
293
|
- lib/cb/models/implementations/talent_network.rb
|
292
294
|
- lib/cb/models/implementations/spot.rb
|
@@ -308,6 +310,7 @@ files:
|
|
308
310
|
- lib/cb/requests/user/temporary_password.rb
|
309
311
|
- lib/cb/requests/user/retrieve.rb
|
310
312
|
- lib/cb/requests/base.rb
|
313
|
+
- lib/cb/requests/work_status/list.rb
|
311
314
|
- lib/cb/requests/category/search.rb
|
312
315
|
- lib/cb/requests/application_external/submit_application.rb
|
313
316
|
- lib/cb/requests/company/find.rb
|