cb-api 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/cb/clients/job_api.rb +22 -16
- data/lib/cb/version.rb +1 -1
- metadata +3 -3
data/lib/cb/clients/job_api.rb
CHANGED
@@ -10,26 +10,24 @@ module Cb
|
|
10
10
|
##
|
11
11
|
#############################################################
|
12
12
|
def self.search(*args)
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
end
|
25
|
-
end
|
26
|
-
my_api.append_api_responses(jobs, json_hash['ResponseJobSearch'])
|
13
|
+
args = args[0] if args.is_a?(Array) && args.count == 1
|
14
|
+
my_api = Cb::Utils::Api.new()
|
15
|
+
json_hash = my_api.cb_get(Cb.configuration.uri_job_search, :query => args)
|
16
|
+
|
17
|
+
jobs = Array.new
|
18
|
+
if !json_hash['ResponseJobSearch'].nil? && !json_hash['ResponseJobSearch']['Results'].nil?
|
19
|
+
json_hash['ResponseJobSearch']['Results']['JobSearchResult'].each { |job_hash| jobs.push(CbJob.new(job_hash)) }
|
20
|
+
|
21
|
+
my_api.append_api_responses(jobs, json_hash['ResponseJobSearch'])
|
22
|
+
|
23
|
+
if response_has_search_metadata?(json_hash['ResponseJobSearch'])
|
27
24
|
my_api.append_api_responses(jobs, json_hash['ResponseJobSearch']['SearchMetaData']['SearchLocations']['SearchLocation'])
|
28
25
|
end
|
26
|
+
end
|
29
27
|
|
30
|
-
|
28
|
+
my_api.append_api_responses(jobs, json_hash)
|
31
29
|
|
32
|
-
|
30
|
+
return jobs
|
33
31
|
end
|
34
32
|
|
35
33
|
#############################################################
|
@@ -59,5 +57,13 @@ module Cb
|
|
59
57
|
criteria.did = did
|
60
58
|
return find_by_criteria(criteria)
|
61
59
|
end
|
60
|
+
|
61
|
+
private
|
62
|
+
|
63
|
+
def self.response_has_search_metadata?(response_hash)
|
64
|
+
response_hash['SearchMetaData'] &&
|
65
|
+
response_hash['SearchMetaData']['SearchLocations'] &&
|
66
|
+
response_hash['SearchMetaData']['SearchLocations']['SearchLocation']
|
67
|
+
end
|
62
68
|
end # JobApi
|
63
69
|
end # Cb
|
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: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -19,7 +19,7 @@ authors:
|
|
19
19
|
autorequire:
|
20
20
|
bindir: bin
|
21
21
|
cert_chain: []
|
22
|
-
date: 2013-11-
|
22
|
+
date: 2013-11-04 00:00:00.000000000 Z
|
23
23
|
dependencies:
|
24
24
|
- !ruby/object:Gem::Dependency
|
25
25
|
name: httparty
|
@@ -248,7 +248,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
248
248
|
version: '0'
|
249
249
|
requirements: []
|
250
250
|
rubyforge_project:
|
251
|
-
rubygems_version: 1.8.
|
251
|
+
rubygems_version: 1.8.23
|
252
252
|
signing_key:
|
253
253
|
specification_version: 3
|
254
254
|
summary: Ruby wrapper around Careerbuilder Public API.
|