cb-api 6.2.0 → 6.2.1

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.
@@ -3,7 +3,6 @@ require 'json'
3
3
  module Cb
4
4
  module Clients
5
5
  class Recommendation
6
-
7
6
  def self.for_job(*args)
8
7
  my_api = Cb::Utils::Api.instance
9
8
  hash = normalize_args(args)
@@ -12,13 +11,12 @@ module Cb
12
11
  :query => hash)
13
12
 
14
13
  jobs = []
14
+
15
15
  if json_hash.has_key?('ResponseRecommendJob')
16
16
  if json_hash['ResponseRecommendJob'].has_key?('RecommendJobResults') &&
17
17
  !json_hash['ResponseRecommendJob']['RecommendJobResults'].nil?
18
18
 
19
- json_hash['ResponseRecommendJob']['RecommendJobResults']['RecommendJobResult'].each do |cur_job|
20
- jobs << Models::Job.new(cur_job)
21
- end
19
+ jobs = create_jobs json_hash, 'Job'
22
20
 
23
21
  my_api.append_api_responses(jobs, json_hash['ResponseRecommendJob']['Request'])
24
22
  end
@@ -37,14 +35,14 @@ module Cb
37
35
  :query => hash)
38
36
 
39
37
  jobs = []
38
+
40
39
  if json_hash.has_key?('ResponseRecommendUser')
41
40
 
42
41
  if json_hash['ResponseRecommendUser'].has_key?('RecommendJobResults') &&
43
42
  !json_hash['ResponseRecommendUser']['RecommendJobResults'].nil?
44
43
 
45
- json_hash['ResponseRecommendUser']['RecommendJobResults']['RecommendJobResult'].each do |cur_job|
46
- jobs << Models::Job.new(cur_job)
47
- end
44
+ jobs = create_jobs json_hash, 'User'
45
+
48
46
  my_api.append_api_responses(jobs, json_hash['ResponseRecommendUser']['Request'])
49
47
  end
50
48
 
@@ -92,9 +90,15 @@ module Cb
92
90
  hash
93
91
  end
94
92
 
95
- end
96
-
93
+ def self.create_jobs json_hash, type
94
+ jobs = []
97
95
 
96
+ [json_hash["ResponseRecommend#{type}"]['RecommendJobResults']['RecommendJobResult']].flatten.each do |api_job|
97
+ jobs << Models::Job.new(api_job)
98
+ end
98
99
 
100
+ jobs
101
+ end
102
+ end
99
103
  end
100
104
  end
@@ -1,3 +1,3 @@
1
1
  module Cb
2
- VERSION = '6.2.0'
2
+ VERSION = '6.2.1'
3
3
  end
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: 6.2.0
4
+ version: 6.2.1
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-04-04 00:00:00.000000000 Z
12
+ date: 2014-04-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty