cb-api 8.0.0 → 9.0.0
Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,27 @@
|
|
1
|
+
module Cb
|
2
|
+
module Models
|
3
|
+
class CollapsedJobResults
|
4
|
+
attr_reader :args_hash, :last_item_index, :search_location, :grouped_jobs, :grouping_parameter, :total_count, :total_pages, :first_item_index, :last_item_index
|
5
|
+
def initialize(args_hash)
|
6
|
+
@args_hash = args_hash
|
7
|
+
@last_item_index = args_hash['LastItemIndex']
|
8
|
+
@search_location = args_hash['SearchMetaData']['SearchLocations']['SearchLocation'] rescue nil
|
9
|
+
@grouping_parameter = args_hash['GroupedJobSearchResults']['GroupingParameter']
|
10
|
+
@grouped_jobs = extract_collapsed_jobs(args_hash['GroupedJobSearchResults']['SearchResults']['JobSearchResultsGroup'])
|
11
|
+
@total_pages = args_hash['TotalPages']
|
12
|
+
@total_count = args_hash['TotalCount']
|
13
|
+
@first_item_index = args_hash['FirstItemIndex']
|
14
|
+
@last_item_index = args_hash['LastItemIndex']
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def extract_collapsed_jobs(collapsed_jobs)
|
20
|
+
collapsed_jobs.collect do |collapsed_job|
|
21
|
+
CollapsedJobs.new(collapsed_job)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Cb
|
2
|
+
module Models
|
3
|
+
class CollapsedJobs < ApiResponseModel
|
4
|
+
attr_accessor :jobs_in_group, :job_description, :grouping_value
|
5
|
+
|
6
|
+
def initialize(args = {})
|
7
|
+
super(args)
|
8
|
+
end
|
9
|
+
|
10
|
+
def job_count
|
11
|
+
@jobs_in_group
|
12
|
+
end
|
13
|
+
|
14
|
+
def job
|
15
|
+
@job_description
|
16
|
+
end
|
17
|
+
|
18
|
+
protected
|
19
|
+
|
20
|
+
def required_fields
|
21
|
+
[]
|
22
|
+
end
|
23
|
+
|
24
|
+
def set_model_properties
|
25
|
+
args = api_response
|
26
|
+
@jobs_in_group = args['NumberJobsInGroup']
|
27
|
+
@job_description = get_jobs(args['GroupedSearchResults']['JobSearchResult'])
|
28
|
+
@grouping_value = args['GroupingValue']
|
29
|
+
end
|
30
|
+
|
31
|
+
def get_jobs(jobs_hash)
|
32
|
+
Job.new(jobs_hash)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -14,7 +14,11 @@ module Cb
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def extract_models
|
17
|
-
|
17
|
+
if is_collapsed
|
18
|
+
Models::CollapsedJobResults.new(response[root_node])
|
19
|
+
else
|
20
|
+
Models::JobResults.new(response[root_node], job_hashes)
|
21
|
+
end
|
18
22
|
end
|
19
23
|
|
20
24
|
private
|
@@ -33,7 +37,10 @@ module Cb
|
|
33
37
|
end
|
34
38
|
end
|
35
39
|
|
40
|
+
def is_collapsed
|
41
|
+
response[root_node].key?('GroupedJobSearchResults')
|
42
|
+
end
|
36
43
|
end
|
37
44
|
end
|
38
45
|
end
|
39
|
-
end
|
46
|
+
end
|
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: 9.0.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-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|
@@ -264,6 +264,7 @@ files:
|
|
264
264
|
- lib/cb/models/implementations/application/cover_letter.rb
|
265
265
|
- lib/cb/models/implementations/application/response.rb
|
266
266
|
- lib/cb/models/implementations/job.rb
|
267
|
+
- lib/cb/models/implementations/collapsed_job_results.rb
|
267
268
|
- lib/cb/models/implementations/user.rb
|
268
269
|
- lib/cb/models/implementations/job_results.rb
|
269
270
|
- lib/cb/models/implementations/education.rb
|
@@ -289,6 +290,7 @@ files:
|
|
289
290
|
- lib/cb/models/implementations/talent_network.rb
|
290
291
|
- lib/cb/models/implementations/spot.rb
|
291
292
|
- lib/cb/models/implementations/email_subscription.rb
|
293
|
+
- lib/cb/models/implementations/collapsed_jobs.rb
|
292
294
|
- lib/cb/models/api_call_model.rb
|
293
295
|
- lib/cb/requests/anonymous_saved_search/delete.rb
|
294
296
|
- lib/cb/requests/anonymous_saved_search/create.rb
|