cb-api 1.3.6 → 2.0.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.
Files changed (98) hide show
  1. data/lib/cb.rb +7 -99
  2. data/lib/cb/clients/anon_saved_search.rb +42 -0
  3. data/lib/cb/clients/application.rb +53 -0
  4. data/lib/cb/clients/application_external.rb +24 -0
  5. data/lib/cb/clients/category.rb +49 -0
  6. data/lib/cb/clients/company.rb +34 -0
  7. data/lib/cb/clients/education.rb +28 -0
  8. data/lib/cb/clients/email_subscription.rb +55 -0
  9. data/lib/cb/clients/employee_types.rb +31 -0
  10. data/lib/cb/clients/job.rb +57 -0
  11. data/lib/cb/clients/job_branding.rb +21 -0
  12. data/lib/cb/clients/recommendation.rb +76 -0
  13. data/lib/cb/clients/saved_search.rb +66 -0
  14. data/lib/cb/clients/spot.rb +27 -0
  15. data/lib/cb/clients/talent_network.rb +51 -0
  16. data/lib/cb/clients/user.rb +94 -0
  17. data/lib/cb/convenience.rb +83 -0
  18. data/lib/cb/criteria/job/details.rb +11 -0
  19. data/lib/cb/criteria/job/search.rb +25 -0
  20. data/lib/cb/criteria/spot/retrieve.rb +12 -0
  21. data/lib/cb/exceptions.rb +2 -1
  22. data/lib/cb/models/implementations/application.rb +92 -0
  23. data/lib/cb/models/implementations/application_external.rb +28 -0
  24. data/lib/cb/models/implementations/application_schema.rb +75 -0
  25. data/lib/cb/models/implementations/branding/media.rb +14 -14
  26. data/lib/cb/models/implementations/branding/section.rb +14 -15
  27. data/lib/cb/models/implementations/branding/style.rb +10 -10
  28. data/lib/cb/models/implementations/branding/styles/base.rb +12 -10
  29. data/lib/cb/models/implementations/branding/styles/buttons.rb +7 -6
  30. data/lib/cb/models/implementations/branding/styles/company_info.rb +14 -12
  31. data/lib/cb/models/implementations/branding/styles/container.rb +7 -6
  32. data/lib/cb/models/implementations/branding/styles/content.rb +7 -5
  33. data/lib/cb/models/implementations/branding/styles/css_adapter.rb +39 -41
  34. data/lib/cb/models/implementations/branding/styles/headings.rb +7 -5
  35. data/lib/cb/models/implementations/branding/styles/job_details.rb +12 -11
  36. data/lib/cb/models/implementations/branding/styles/page.rb +7 -5
  37. data/lib/cb/models/implementations/branding/widget.rb +9 -7
  38. data/lib/cb/models/implementations/category.rb +24 -0
  39. data/lib/cb/models/implementations/company.rb +135 -0
  40. data/lib/cb/models/implementations/education.rb +17 -0
  41. data/lib/cb/models/implementations/email_subscription.rb +17 -0
  42. data/lib/cb/models/implementations/employee_type.rb +13 -0
  43. data/lib/cb/models/implementations/job.rb +167 -0
  44. data/lib/cb/models/implementations/job_branding.rb +34 -0
  45. data/lib/cb/models/implementations/saved_search.rb +159 -0
  46. data/lib/cb/models/implementations/spot.rb +30 -0
  47. data/lib/cb/models/implementations/talent_network.rb +156 -0
  48. data/lib/cb/models/implementations/user.rb +58 -0
  49. data/lib/cb/responses/anonymous_saved_search/create.rb +36 -0
  50. data/lib/cb/responses/anonymous_saved_search/delete.rb +23 -0
  51. data/lib/cb/responses/api_response.rb +64 -0
  52. data/lib/cb/responses/employee_types/search.rb +48 -0
  53. data/lib/cb/responses/errors.rb +47 -0
  54. data/lib/cb/responses/metadata.rb +27 -0
  55. data/lib/cb/responses/saved_search/delete.rb +28 -0
  56. data/lib/cb/responses/saved_search/list.rb +43 -0
  57. data/lib/cb/responses/saved_search/singular.rb +50 -0
  58. data/lib/cb/responses/spot/retrieve_response.rb +31 -20
  59. data/lib/cb/responses/timing.rb +37 -0
  60. data/lib/cb/utils/api.rb +2 -2
  61. data/lib/cb/utils/response_array_extractor.rb +14 -4
  62. data/lib/cb/version.rb +1 -1
  63. metadata +114 -69
  64. data/lib/cb/clients/anon_saved_search_api.rb +0 -41
  65. data/lib/cb/clients/application_api.rb +0 -78
  66. data/lib/cb/clients/application_external_api.rb +0 -30
  67. data/lib/cb/clients/category_api.rb +0 -51
  68. data/lib/cb/clients/company_api.rb +0 -39
  69. data/lib/cb/clients/education_api.rb +0 -37
  70. data/lib/cb/clients/email_subscription_api.rb +0 -68
  71. data/lib/cb/clients/employee_types_api.rb +0 -48
  72. data/lib/cb/clients/job_api.rb +0 -70
  73. data/lib/cb/clients/job_branding_api.rb +0 -24
  74. data/lib/cb/clients/recommendation_api.rb +0 -98
  75. data/lib/cb/clients/resume_api.rb +0 -185
  76. data/lib/cb/clients/saved_search_api.rb +0 -139
  77. data/lib/cb/clients/spot_api.rb +0 -25
  78. data/lib/cb/clients/talent_network_api.rb +0 -70
  79. data/lib/cb/clients/user_api.rb +0 -118
  80. data/lib/cb/criteria/job_details_criteria.rb +0 -11
  81. data/lib/cb/criteria/job_search_criteria.rb +0 -29
  82. data/lib/cb/criteria/spot_retrieve_criteria.rb +0 -12
  83. data/lib/cb/models/implementations/cb_application.rb +0 -91
  84. data/lib/cb/models/implementations/cb_application_external.rb +0 -31
  85. data/lib/cb/models/implementations/cb_application_schema.rb +0 -78
  86. data/lib/cb/models/implementations/cb_category.rb +0 -22
  87. data/lib/cb/models/implementations/cb_company.rb +0 -133
  88. data/lib/cb/models/implementations/cb_education.rb +0 -25
  89. data/lib/cb/models/implementations/cb_email_subscription.rb +0 -19
  90. data/lib/cb/models/implementations/cb_employee_type.rb +0 -12
  91. data/lib/cb/models/implementations/cb_job.rb +0 -175
  92. data/lib/cb/models/implementations/cb_job_branding.rb +0 -33
  93. data/lib/cb/models/implementations/cb_resume.rb +0 -221
  94. data/lib/cb/models/implementations/cb_saved_search.rb +0 -228
  95. data/lib/cb/models/implementations/cb_spot.rb +0 -32
  96. data/lib/cb/models/implementations/cb_talent_network.rb +0 -155
  97. data/lib/cb/models/implementations/cb_user.rb +0 -56
  98. data/lib/cb/responses/raw_api_response.rb +0 -34
@@ -2,19 +2,21 @@ module Cb
2
2
  module Utils
3
3
  class ResponseArrayExtractor
4
4
 
5
- def self.extract(response_hash, key)
6
- self.new(response_hash, key).extract
5
+ def self.extract(response_hash, key, singular_key = nil)
6
+ self.new(response_hash, key, singular_key).extract
7
7
  end
8
8
 
9
- def initialize(response_hash, key)
9
+ def initialize(response_hash, key, singular_key)
10
10
  @response_hash = response_hash
11
11
  @key = key
12
- @singular_key = key[0..key.length-2]
12
+ @singular_key = singular_key || key[0..key.length-2]
13
13
  end
14
14
 
15
15
  def extract
16
16
  if response_has_collection?
17
17
  extract_array_from_collection
18
+ elsif response_has_array?
19
+ build_array_from_delimited_values
18
20
  else
19
21
  []
20
22
  end
@@ -22,10 +24,18 @@ module Cb
22
24
 
23
25
  private
24
26
 
27
+ def response_has_array?
28
+ !@response_hash[@key].nil? && @response_hash[@key].class != Hash
29
+ end
30
+
25
31
  def response_has_collection?
26
32
  !@response_hash[@key].nil? && !@response_hash[@key][@singular_key].nil?
27
33
  end
28
34
 
35
+ def build_array_from_delimited_values
36
+ @response_hash[@key].split(',')
37
+ end
38
+
29
39
  def extract_array_from_collection
30
40
  if @response_hash[@key][@singular_key].is_a?(Array)
31
41
  @response_hash[@key][@singular_key]
@@ -1,3 +1,3 @@
1
1
  module Cb
2
- VERSION = '1.3.6'
2
+ VERSION = '2.0.0'
3
3
  end
metadata CHANGED
@@ -1,25 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cb-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.6
4
+ version: 2.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
8
- - Jesse Retchko
9
- - Chris Little
10
- - Matthew Moldavan
11
- - Miriam Williams
12
- - David Posey
13
- - Kyle Bumpus
14
- - Jon Molinaro
15
- - Ben Schmaltz
16
- - Raul Gil
17
- - Christina Chatham
18
- - Alex Hristov
8
+ - The CareerBuilder.com Niche and Consumer Development teams
19
9
  autorequire:
20
10
  bindir: bin
21
11
  cert_chain: []
22
- date: 2014-08-18 00:00:00.000000000 Z
12
+ date: 2013-12-18 00:00:00.000000000 Z
23
13
  dependencies:
24
14
  - !ruby/object:Gem::Dependency
25
15
  name: httparty
@@ -44,7 +34,7 @@ dependencies:
44
34
  requirements:
45
35
  - - ~>
46
36
  - !ruby/object:Gem::Version
47
- version: '1.8'
37
+ version: 1.8.1
48
38
  type: :runtime
49
39
  prerelease: false
50
40
  version_requirements: !ruby/object:Gem::Requirement
@@ -52,7 +42,7 @@ dependencies:
52
42
  requirements:
53
43
  - - ~>
54
44
  - !ruby/object:Gem::Version
55
- version: '1.8'
45
+ version: 1.8.1
56
46
  - !ruby/object:Gem::Dependency
57
47
  name: nori
58
48
  requirement: !ruby/object:Gem::Requirement
@@ -149,45 +139,101 @@ dependencies:
149
139
  - - ! '>='
150
140
  - !ruby/object:Gem::Version
151
141
  version: '2.11'
142
+ - !ruby/object:Gem::Dependency
143
+ name: rdoc
144
+ requirement: !ruby/object:Gem::Requirement
145
+ none: false
146
+ requirements:
147
+ - - ~>
148
+ - !ruby/object:Gem::Version
149
+ version: 3.12.2
150
+ type: :development
151
+ prerelease: false
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ~>
156
+ - !ruby/object:Gem::Version
157
+ version: 3.12.2
158
+ - !ruby/object:Gem::Dependency
159
+ name: rspec-pride
160
+ requirement: !ruby/object:Gem::Requirement
161
+ none: false
162
+ requirements:
163
+ - - ~>
164
+ - !ruby/object:Gem::Version
165
+ version: 2.2.0
166
+ type: :development
167
+ prerelease: false
168
+ version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
170
+ requirements:
171
+ - - ~>
172
+ - !ruby/object:Gem::Version
173
+ version: 2.2.0
174
+ - !ruby/object:Gem::Dependency
175
+ name: pry
176
+ requirement: !ruby/object:Gem::Requirement
177
+ none: false
178
+ requirements:
179
+ - - ~>
180
+ - !ruby/object:Gem::Version
181
+ version: 0.9.12.1
182
+ type: :development
183
+ prerelease: false
184
+ version_requirements: !ruby/object:Gem::Requirement
185
+ none: false
186
+ requirements:
187
+ - - ~>
188
+ - !ruby/object:Gem::Version
189
+ version: 0.9.12.1
190
+ - !ruby/object:Gem::Dependency
191
+ name: rb-readline
192
+ requirement: !ruby/object:Gem::Requirement
193
+ none: false
194
+ requirements:
195
+ - - ~>
196
+ - !ruby/object:Gem::Version
197
+ version: 0.5.0
198
+ type: :development
199
+ prerelease: false
200
+ version_requirements: !ruby/object:Gem::Requirement
201
+ none: false
202
+ requirements:
203
+ - - ~>
204
+ - !ruby/object:Gem::Version
205
+ version: 0.5.0
152
206
  description: Ruby wrapper for Careerbuilder Public API.
153
- email:
154
- - Jesse.Retchko@Careerbuilder.com
155
- - Chris.Little@Careerbuilder.com
156
- - Matt.Moldavan@Careerbuilder.com
157
- - Jon.Molinaro@careerbuilder.com
158
- - MiriamDeana@gmail.com
159
- - David.Posey@Careerbuilder.com
160
- - Kyle.Bumpus@Careerbuilder.com
161
- - Ben.Schmaltz@Careerbuilder.com
162
- - Raul.Gil@Careerbuilder.com
163
- - Christina.Chatham@Careerbuilder.com
164
- - Alex.Hristov@Careerbuilder.com
207
+ email: ConsumerDevelopment@careerbuilder.com
165
208
  executables: []
166
209
  extensions: []
167
210
  extra_rdoc_files: []
168
211
  files:
169
- - lib/cb/clients/anon_saved_search_api.rb
170
- - lib/cb/clients/application_api.rb
171
- - lib/cb/clients/application_external_api.rb
172
- - lib/cb/clients/category_api.rb
173
- - lib/cb/clients/company_api.rb
174
- - lib/cb/clients/education_api.rb
175
- - lib/cb/clients/email_subscription_api.rb
176
- - lib/cb/clients/employee_types_api.rb
177
- - lib/cb/clients/job_api.rb
178
- - lib/cb/clients/job_branding_api.rb
179
- - lib/cb/clients/recommendation_api.rb
180
- - lib/cb/clients/resume_api.rb
181
- - lib/cb/clients/saved_search_api.rb
182
- - lib/cb/clients/spot_api.rb
183
- - lib/cb/clients/talent_network_api.rb
184
- - lib/cb/clients/user_api.rb
212
+ - lib/cb/clients/anon_saved_search.rb
213
+ - lib/cb/clients/application.rb
214
+ - lib/cb/clients/application_external.rb
215
+ - lib/cb/clients/category.rb
216
+ - lib/cb/clients/company.rb
217
+ - lib/cb/clients/education.rb
218
+ - lib/cb/clients/email_subscription.rb
219
+ - lib/cb/clients/employee_types.rb
220
+ - lib/cb/clients/job.rb
221
+ - lib/cb/clients/job_branding.rb
222
+ - lib/cb/clients/recommendation.rb
223
+ - lib/cb/clients/saved_search.rb
224
+ - lib/cb/clients/spot.rb
225
+ - lib/cb/clients/talent_network.rb
226
+ - lib/cb/clients/user.rb
185
227
  - lib/cb/config.rb
186
- - lib/cb/criteria/job_details_criteria.rb
187
- - lib/cb/criteria/job_search_criteria.rb
188
- - lib/cb/criteria/spot_retrieve_criteria.rb
228
+ - lib/cb/convenience.rb
229
+ - lib/cb/criteria/job/details.rb
230
+ - lib/cb/criteria/job/search.rb
231
+ - lib/cb/criteria/spot/retrieve.rb
189
232
  - lib/cb/exceptions.rb
190
233
  - lib/cb/models/api_response_model.rb
234
+ - lib/cb/models/implementations/application.rb
235
+ - lib/cb/models/implementations/application_external.rb
236
+ - lib/cb/models/implementations/application_schema.rb
191
237
  - lib/cb/models/implementations/branding/media.rb
192
238
  - lib/cb/models/implementations/branding/section.rb
193
239
  - lib/cb/models/implementations/branding/style.rb
@@ -201,23 +247,28 @@ files:
201
247
  - lib/cb/models/implementations/branding/styles/job_details.rb
202
248
  - lib/cb/models/implementations/branding/styles/page.rb
203
249
  - lib/cb/models/implementations/branding/widget.rb
204
- - lib/cb/models/implementations/cb_application.rb
205
- - lib/cb/models/implementations/cb_application_external.rb
206
- - lib/cb/models/implementations/cb_application_schema.rb
207
- - lib/cb/models/implementations/cb_category.rb
208
- - lib/cb/models/implementations/cb_company.rb
209
- - lib/cb/models/implementations/cb_education.rb
210
- - lib/cb/models/implementations/cb_email_subscription.rb
211
- - lib/cb/models/implementations/cb_employee_type.rb
212
- - lib/cb/models/implementations/cb_job.rb
213
- - lib/cb/models/implementations/cb_job_branding.rb
214
- - lib/cb/models/implementations/cb_resume.rb
215
- - lib/cb/models/implementations/cb_saved_search.rb
216
- - lib/cb/models/implementations/cb_spot.rb
217
- - lib/cb/models/implementations/cb_talent_network.rb
218
- - lib/cb/models/implementations/cb_user.rb
219
- - lib/cb/responses/raw_api_response.rb
250
+ - lib/cb/models/implementations/category.rb
251
+ - lib/cb/models/implementations/company.rb
252
+ - lib/cb/models/implementations/education.rb
253
+ - lib/cb/models/implementations/email_subscription.rb
254
+ - lib/cb/models/implementations/employee_type.rb
255
+ - lib/cb/models/implementations/job.rb
256
+ - lib/cb/models/implementations/job_branding.rb
257
+ - lib/cb/models/implementations/saved_search.rb
258
+ - lib/cb/models/implementations/spot.rb
259
+ - lib/cb/models/implementations/talent_network.rb
260
+ - lib/cb/models/implementations/user.rb
261
+ - lib/cb/responses/anonymous_saved_search/create.rb
262
+ - lib/cb/responses/anonymous_saved_search/delete.rb
263
+ - lib/cb/responses/api_response.rb
264
+ - lib/cb/responses/employee_types/search.rb
265
+ - lib/cb/responses/errors.rb
266
+ - lib/cb/responses/metadata.rb
267
+ - lib/cb/responses/saved_search/delete.rb
268
+ - lib/cb/responses/saved_search/list.rb
269
+ - lib/cb/responses/saved_search/singular.rb
220
270
  - lib/cb/responses/spot/retrieve_response.rb
271
+ - lib/cb/responses/timing.rb
221
272
  - lib/cb/utils/api.rb
222
273
  - lib/cb/utils/country.rb
223
274
  - lib/cb/utils/fluid_attributes.rb
@@ -240,21 +291,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
240
291
  - - ! '>='
241
292
  - !ruby/object:Gem::Version
242
293
  version: '0'
243
- segments:
244
- - 0
245
- hash: 3723431431916904410
246
294
  required_rubygems_version: !ruby/object:Gem::Requirement
247
295
  none: false
248
296
  requirements:
249
297
  - - ! '>='
250
298
  - !ruby/object:Gem::Version
251
299
  version: '0'
252
- segments:
253
- - 0
254
- hash: 3723431431916904410
255
300
  requirements: []
256
301
  rubyforge_project:
257
- rubygems_version: 1.8.25
302
+ rubygems_version: 1.8.23
258
303
  signing_key:
259
304
  specification_version: 3
260
305
  summary: Ruby wrapper around Careerbuilder Public API.
@@ -1,41 +0,0 @@
1
- module Cb
2
- class AnonSavedSearchApi
3
- def self.create *args
4
- args = args[0] if args.is_a?(Array) && args.count == 1
5
- my_api = Cb::Utils::Api.new
6
-
7
- json_hash = my_api.cb_post Cb.configuration.uri_anon_saved_search_create, :body => CbSavedSearch.new(args).create_anon_to_xml
8
-
9
- if json_hash.has_key? 'AnonymousSavedSearch'
10
- json_hash['AnonymousSavedSearch']['ExternalID'] = json_hash['ExternalID']
11
- end
12
-
13
- if json_hash.has_key?('Errors') && json_hash['Errors'].size < 1
14
- saved_search = CbSavedSearch.new(json_hash['AnonymousSavedSearch'])
15
- else
16
- saved_search = CbSavedSearch.new(json_hash)
17
- end
18
-
19
- my_api.append_api_responses(saved_search, json_hash)
20
-
21
- return saved_search
22
- end
23
-
24
- def self.delete *args
25
- args = args[0] if args.is_a?(Array) && args.count == 1
26
- my_api = Cb::Utils::Api.new
27
-
28
- json_hash = my_api.cb_post Cb.configuration.uri_anon_saved_search_delete, :body => CbSavedSearch.new(args).delete_anon_to_xml
29
-
30
- if json_hash.has_key?('Errors') && json_hash['Errors'].size < 1
31
- response = json_hash['Status']
32
- else
33
- response = json_hash['Errors']
34
- end
35
-
36
- my_api.append_api_responses(response, json_hash)
37
-
38
- return response
39
- end
40
- end
41
- end
@@ -1,78 +0,0 @@
1
- require 'json'
2
-
3
- module Cb
4
- class ApplicationApi
5
-
6
- #############################################################
7
- ## Get an application for a job
8
- ## Takes in either a Cb::CbJob, or a string (which should contain a did)
9
- ##
10
- ## For detailed information around this API please visit:
11
- ## http://api.careerbuilder.com/ApplicationInfo.aspx
12
- #############################################################
13
- def self.for_job(job)
14
- job.is_a?(Cb::CbJob) ? did = job.did : did = job
15
-
16
- my_api = Cb::Utils::Api.new()
17
- json_hash = my_api.cb_get(Cb.configuration.uri_application, :query => {:JobDID => did})
18
-
19
- if json_hash.has_key?('ResponseBlankApplication')
20
- if json_hash['ResponseBlankApplication'].has_key?('BlankApplication')
21
- app = Cb::CbApplicationSchema.new(json_hash['ResponseBlankApplication']['BlankApplication'])
22
- end
23
-
24
- my_api.append_api_responses(app, json_hash['ResponseBlankApplication'])
25
- end
26
-
27
- my_api.append_api_responses(app, json_hash)
28
-
29
- return app
30
- end
31
-
32
- #############################################################
33
- ## Submit a job application for a registered user
34
- ##
35
- ## For detailed information around this API please visit:
36
- ## http://api.careerbuilder.com/ApplicationInfo.aspx
37
- #############################################################
38
- def self.submit_registered_app(app)
39
- return send_to_api(Cb.configuration.uri_application_registered, app)
40
- end
41
-
42
- #############################################################
43
- ## Submit a job application
44
- ##
45
- ## For detailed information around this API please visit:
46
- ## http://api.careerbuilder.com/ApplicationInfo.aspx
47
- #############################################################
48
- def self.submit_app(app)
49
- return send_to_api(Cb.configuration.uri_application_submit, app)
50
- end
51
-
52
- def self.send_to_api(uri, app)
53
- raise Cb::IncomingParamIsWrongTypeException unless app.is_a?(Cb::CbApplication)
54
-
55
- my_api = Cb::Utils::Api.new()
56
- json_hash = my_api.cb_post("#{uri}?ipath=#{app.ipath}", :body => app.to_xml)
57
-
58
- begin
59
- if json_hash.has_key? 'ResponseApplication'
60
- if json_hash['ResponseApplication'].has_key? 'RedirectURL'
61
- app.redirect_url = json_hash['ResponseApplication']['RedirectURL']
62
- else
63
- app.redirect_url = ''
64
- end
65
-
66
- my_api.append_api_responses(app, json_hash['ResponseApplication'])
67
- else
68
- app.redirect_url = ''
69
- end
70
-
71
- end
72
-
73
- my_api.append_api_responses(app, json_hash)
74
-
75
- return app
76
- end
77
- end
78
- end
@@ -1,30 +0,0 @@
1
- require 'json'
2
-
3
- module Cb
4
- class ApplicationExternalApi
5
- #############################################################
6
- ## Submit an external application and attach the apply url to the app if successful
7
- ##
8
- ## For detailed information around this API please visit:
9
- ## http://api.careerbuilder.com/ApplicationInfo.aspx
10
- #############################################################
11
- def self.submit_app(app)
12
- raise Cb::IncomingParamIsWrongTypeException unless app.is_a?(Cb::CbApplicationExternal)
13
-
14
- my_api = Cb::Utils::Api.new()
15
- xml_hash = my_api.cb_post(Cb.configuration.uri_application_external, :body => app.to_xml)
16
-
17
- begin
18
- if xml_hash.has_key? 'ApplyUrl'
19
- app.apply_url = xml_hash['ApplyUrl']
20
- else
21
- app.apply_url = ''
22
- end
23
- end
24
-
25
- my_api.append_api_responses(app, xml_hash)
26
-
27
- return app
28
- end
29
- end
30
- end
@@ -1,51 +0,0 @@
1
- require "json"
2
-
3
- module Cb
4
- class CategoryApi
5
- def self.search
6
- my_api = Cb::Utils::Api.new()
7
- json_hash = my_api.cb_get(Cb.configuration.uri_job_category_search)
8
-
9
- categoryList = []
10
-
11
- if json_hash.has_key?('ResponseCategories')
12
-
13
- if json_hash['ResponseCategories'].has_key?('Categories')
14
- json_hash['ResponseCategories']['Categories']['Category'].each do |cat|
15
- categoryList << CbCategory.new(cat)
16
- end
17
- end
18
-
19
- my_api.append_api_responses(categoryList, json_hash['ResponseCategories'])
20
- end
21
-
22
- my_api.append_api_responses(categoryList, json_hash)
23
-
24
- return categoryList
25
- end
26
-
27
- def self.search_by_host_site(host_site)
28
- my_api = Cb::Utils::Api.new()
29
- json_hash = my_api.cb_get(Cb.configuration.uri_job_category_search, :query => {:CountryCode => host_site})
30
-
31
- categoryList = []
32
- if json_hash.has_key?('ResponseCategories')
33
- if json_hash['ResponseCategories'].has_key?('Categories')
34
- if json_hash['ResponseCategories']['Categories']['Category'].is_a?(Array)
35
- json_hash['ResponseCategories']['Categories']['Category'].each do |cat|
36
- categoryList << CbCategory.new(cat)
37
- end
38
- elsif json_hash['ResponseCategories']['Categories']['Category'].is_a?(Hash) && json_hash.length < 2
39
- categoryList << CbCategory.new(json_hash['ResponseCategories']['Categories']['Category'])
40
- end
41
- end
42
-
43
- my_api.append_api_responses(categoryList, json_hash['ResponseCategories'])
44
- end
45
-
46
- my_api.append_api_responses(categoryList, json_hash)
47
-
48
- return categoryList
49
- end
50
- end
51
- end