cb-api 5.6.1 → 6.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/cb/clients/saved_search.rb +18 -15
- data/lib/cb/config.rb +2 -2
- data/lib/cb/models/implementations/saved_search.rb +15 -5
- data/lib/cb/responses/saved_search/list.rb +5 -15
- data/lib/cb/responses/saved_search/retrieve.rb +33 -0
- data/lib/cb/utils/api.rb +1 -0
- data/lib/cb/version.rb +1 -1
- metadata +2 -1
@@ -20,14 +20,15 @@ module Cb
|
|
20
20
|
Responses::SavedSearch::Delete.new(json)
|
21
21
|
end
|
22
22
|
|
23
|
-
def retrieve(
|
24
|
-
query = retrieve_query(
|
25
|
-
|
26
|
-
|
23
|
+
def retrieve(oauth_token, external_id)
|
24
|
+
query = retrieve_query(oauth_token)
|
25
|
+
uri = replace_uri_field(Cb.configuration.uri_saved_search_retrieve, ':did', external_id)
|
26
|
+
json = cb_client.cb_get(uri, :query => query)
|
27
|
+
Responses::SavedSearch::Retrieve.new(json)
|
27
28
|
end
|
28
29
|
|
29
|
-
def list(
|
30
|
-
query = list_query(
|
30
|
+
def list(oauth_token, hostsite)
|
31
|
+
query = list_query(oauth_token, hostsite)
|
31
32
|
json = cb_client.cb_get(Cb.configuration.uri_saved_search_list, :query => query)
|
32
33
|
Responses::SavedSearch::List.new(json)
|
33
34
|
end
|
@@ -38,20 +39,18 @@ module Cb
|
|
38
39
|
@cb_client ||= Cb::Utils::Api.instance
|
39
40
|
end
|
40
41
|
|
41
|
-
def retrieve_query(
|
42
|
+
def retrieve_query(oauth_token)
|
42
43
|
{
|
43
|
-
|
44
|
-
|
45
|
-
:externaluserid => external_user_id,
|
46
|
-
:hostsite => host_site
|
44
|
+
:developerkey => Cb.configuration.dev_key,
|
45
|
+
:useroauthtoken => oauth_token
|
47
46
|
}
|
48
47
|
end
|
49
48
|
|
50
|
-
def list_query(
|
49
|
+
def list_query(oauth_token, hostsite)
|
51
50
|
{
|
52
|
-
|
53
|
-
|
54
|
-
|
51
|
+
:developerkey => Cb.configuration.dev_key,
|
52
|
+
:useroauthtoken => oauth_token,
|
53
|
+
:hostsite => hostsite
|
55
54
|
}
|
56
55
|
end
|
57
56
|
|
@@ -60,6 +59,10 @@ module Cb
|
|
60
59
|
json_hash['ExternalID'] = external_id unless external_id.nil?
|
61
60
|
Responses::SavedSearch::Singular.new(json_hash)
|
62
61
|
end
|
62
|
+
|
63
|
+
def replace_uri_field(uri_string, field, replacement)
|
64
|
+
uri_string.gsub(field, replacement)
|
65
|
+
end
|
63
66
|
end
|
64
67
|
|
65
68
|
end
|
data/lib/cb/config.rb
CHANGED
@@ -52,11 +52,11 @@ module Cb
|
|
52
52
|
@uri_resume_create ||= '/v2/resume/create'
|
53
53
|
@uri_resume_update ||= '/v2/resume/update'
|
54
54
|
@uri_resume_delete ||= '/v2/resume/delete'
|
55
|
-
@uri_saved_search_retrieve ||= '/
|
55
|
+
@uri_saved_search_retrieve ||= '/cbapi/savedsearches/:did'
|
56
56
|
@uri_saved_search_create ||= '/v2/savedsearch/create'
|
57
57
|
@uri_saved_search_update ||= '/v2/savedsearch/update'
|
58
58
|
@uri_saved_search_delete ||= '/v1/savedsearch/delete'
|
59
|
-
@uri_saved_search_list ||= '/
|
59
|
+
@uri_saved_search_list ||= '/cbapi/savedsearches'
|
60
60
|
@uri_anon_saved_search_create ||= '/v1/anonymoussavedjobsearch/create'
|
61
61
|
@uri_anon_saved_search_delete ||= '/v1/anonymoussavedjobsearch/delete'
|
62
62
|
@uri_tn_join_questions ||= '/talentnetwork/config/join/questions'
|
@@ -6,7 +6,7 @@ module Cb
|
|
6
6
|
:keywords, :order_by, :order_direction, :radius, :pay_high, :pay_low, :posted_within,
|
7
7
|
:pay_info_only, :location, :job_category, :company, :city, :state, :is_daily_email, :external_id,
|
8
8
|
:external_user_id, :job_search_url, :jrdid, :errors, :browser_id, :session_id, :test, :email_address,
|
9
|
-
:
|
9
|
+
:country, :search_parameters, :did
|
10
10
|
|
11
11
|
def initialize(args={})
|
12
12
|
@host_site = args['HostSite'] || String.new
|
@@ -15,11 +15,13 @@ module Cb
|
|
15
15
|
@site_id = args['SiteId'] || String.new
|
16
16
|
@is_daily_email = args['IsDailyEmail'] || String.new
|
17
17
|
@email_delivery_day = args['EmailDeliveryDay'] || String.new
|
18
|
+
@job_search_url = args['JobSearchUrl'] || String.new
|
18
19
|
@external_id = args['ExternalID'] || String.new
|
19
20
|
@external_user_id = args['ExternalUserID'] || String.new
|
20
21
|
@browser_id = args['BrowserID'] || nil
|
21
22
|
@session_id = args['SessionID'] || String.new
|
22
23
|
@email_address = args['EmailAddress'] || String.new
|
24
|
+
@did = args['DID'] || String.new
|
23
25
|
@search_parameters = SearchParameters.new(args['SavedSearchParameters'] || {})
|
24
26
|
end
|
25
27
|
|
@@ -102,7 +104,8 @@ module Cb
|
|
102
104
|
attr_accessor :boolean_operator, :category, :education_code, :emp_type, :exclude_company_names, :exclude_job_titles,
|
103
105
|
:exclude_keywords, :exclude_national, :industry_codes, :job_title, :keywords, :location, :order_by,
|
104
106
|
:order_direction, :pay_high, :pay_info_only, :pay_low, :posted_within, :radius, :specific_education,
|
105
|
-
:country
|
107
|
+
:city, :state, :country, :company, :job_category,
|
108
|
+
:jc_position_level, :jc_location, :jc_advertiser_flags, :jc_job_nature
|
106
109
|
|
107
110
|
def initialize(args = {})
|
108
111
|
@boolean_operator = args['BooleanOperator'] || String.new
|
@@ -113,7 +116,7 @@ module Cb
|
|
113
116
|
@exclude_company_names = args['ExcludeCompanyNames'] || String.new
|
114
117
|
@exclude_job_titles = args['ExcludeJobTitles'] || String.new
|
115
118
|
@exclude_keywords = args['ExcludeKeywords'] || String.new
|
116
|
-
@
|
119
|
+
@exclude_national = args['ExcludeNational'].nil? ? false : args['ExcludeNational']
|
117
120
|
@industry_codes = args['IndustryCodes'] || String.new
|
118
121
|
@job_title = args['JobTitle'] || String.new
|
119
122
|
@keywords = args['Keywords'] || String.new
|
@@ -122,11 +125,18 @@ module Cb
|
|
122
125
|
@order_direction = args['OrderDirection'] || String.new
|
123
126
|
@pay_high = args['PayHigh'] || 0
|
124
127
|
@pay_low = args['PayLow'] || 0
|
128
|
+
@pay_info_only = args['PayInfoOnly'].nil? ? false : args['PayInfoOnly']
|
125
129
|
@posted_within = args['PostedWithin'] || 30
|
126
130
|
@radius = args['Radius'] || 30
|
127
131
|
@specific_education = args['SpecificEducation'].nil? ? false : args['SpecificEducation']
|
128
|
-
@
|
129
|
-
@
|
132
|
+
@city = args['City'] || String.new
|
133
|
+
@state = args['State'] || String.new
|
134
|
+
@country = args['Country'] || String.new
|
135
|
+
@company = args['Company'] || String.new
|
136
|
+
@jc_position_level = args['JCPositionLevel'] || String.new
|
137
|
+
@jc_location = args['JCLocation'] || String.new
|
138
|
+
@jc_advertiser_flags = args['JCAdvertiserFlags'] || String.new
|
139
|
+
@jc_job_nature = args['JCJobNature'] || String.new
|
130
140
|
end
|
131
141
|
|
132
142
|
def to_xml
|
@@ -1,14 +1,12 @@
|
|
1
1
|
module Cb
|
2
2
|
module Responses
|
3
3
|
module SavedSearch
|
4
|
-
|
5
4
|
class List < ApiResponse
|
5
|
+
|
6
6
|
protected
|
7
7
|
|
8
8
|
def validate_api_hash
|
9
|
-
required_response_field(
|
10
|
-
required_response_field(outer_collection_node, response[root_node])
|
11
|
-
required_response_field(inner_collection_node, response[root_node][outer_collection_node])
|
9
|
+
required_response_field(collection_node, response)
|
12
10
|
end
|
13
11
|
|
14
12
|
def hash_containing_metadata
|
@@ -21,20 +19,12 @@ module Cb
|
|
21
19
|
|
22
20
|
private
|
23
21
|
|
24
|
-
def
|
25
|
-
'
|
26
|
-
end
|
27
|
-
|
28
|
-
def outer_collection_node
|
29
|
-
'SavedSearches'
|
30
|
-
end
|
31
|
-
|
32
|
-
def inner_collection_node
|
33
|
-
'SavedSearch'
|
22
|
+
def collection_node
|
23
|
+
'Results'
|
34
24
|
end
|
35
25
|
|
36
26
|
def model_hashes
|
37
|
-
|
27
|
+
response[collection_node]
|
38
28
|
end
|
39
29
|
end
|
40
30
|
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Cb
|
2
|
+
module Responses
|
3
|
+
module SavedSearch
|
4
|
+
|
5
|
+
class Retrieve < ApiResponse
|
6
|
+
protected
|
7
|
+
|
8
|
+
def validate_api_hash
|
9
|
+
required_response_field(root_node, response)
|
10
|
+
end
|
11
|
+
|
12
|
+
def hash_containing_metadata
|
13
|
+
response
|
14
|
+
end
|
15
|
+
|
16
|
+
def extract_models
|
17
|
+
Models::SavedSearch.new(model_hash)
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def root_node
|
23
|
+
'Results'
|
24
|
+
end
|
25
|
+
|
26
|
+
def model_hash
|
27
|
+
response[root_node][0]
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/lib/cb/utils/api.rb
CHANGED
@@ -24,6 +24,7 @@ module Cb
|
|
24
24
|
:outputjson => Cb.configuration.use_json.to_s
|
25
25
|
|
26
26
|
self.class.default_timeout Cb.configuration.time_out
|
27
|
+
self.class.headers.merge! ({'developerkey' => Cb.configuration.dev_key})
|
27
28
|
self.class.headers.merge! ({'accept-encoding' => 'deflate, gzip'}) unless Cb.configuration.debug_api
|
28
29
|
end
|
29
30
|
|
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:
|
4
|
+
version: 6.0.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -224,6 +224,7 @@ files:
|
|
224
224
|
- lib/cb/responses/saved_search/list.rb
|
225
225
|
- lib/cb/responses/saved_search/singular.rb
|
226
226
|
- lib/cb/responses/saved_search/delete.rb
|
227
|
+
- lib/cb/responses/saved_search/retrieve.rb
|
227
228
|
- lib/cb/responses/employee_types/search.rb
|
228
229
|
- lib/cb/responses/errors.rb
|
229
230
|
- lib/cb/exceptions.rb
|