cb-api 6.1.1 → 6.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,21 @@
1
+ require "json"
2
+
3
+ module Cb
4
+ module Clients
5
+ class Industry
6
+ class << self
7
+
8
+ def search
9
+ response = api_client.cb_get(Cb.configuration.uri_job_industry_search, :query => {:CountryCode => Cb.configuration.host_site})
10
+ Cb::Responses::Industry::Search.new(response)
11
+ end
12
+
13
+ private
14
+
15
+ def api_client
16
+ @api ||= Cb::Utils::Api.instance
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -2,7 +2,7 @@ module Cb
2
2
  class Config
3
3
  attr_accessor :dev_key, :base_uri, :debug_api, :time_out, :use_json, :host_site, :test_resources, :observers,
4
4
  :uri_job_search, :uri_job_find,
5
- :uri_company_find, :uri_job_category_search,
5
+ :uri_company_find, :uri_job_category_search, :uri_job_industry_search,
6
6
  :uri_education_code, :uri_employee_types,
7
7
  :uri_recommendation_for_job, :uri_recommendation_for_user,
8
8
  :uri_recommendation_for_company,
@@ -28,6 +28,7 @@ module Cb
28
28
 
29
29
  def set_default_api_uris
30
30
  @uri_job_category_search ||= '/v1/categories'
31
+ @uri_job_industry_search ||= '/v1/industrycodes'
31
32
  @uri_employee_types ||= '/v1/employeetypes'
32
33
  @uri_company_find ||= '/Employer/CompanyDetails'
33
34
  @uri_job_search ||= '/v1/JobSearch'
@@ -73,6 +74,7 @@ module Cb
73
74
  def to_hash
74
75
  {
75
76
  :uri_job_category_search => @uri_job_category_search,
77
+ :uri_job_industry_search => @uri_job_industry_search,
76
78
  :uri_employee_types => @uri_employee_types,
77
79
  :dev_key => @dev_key,
78
80
  :host_site => @host_site,
@@ -17,7 +17,11 @@ module Cb
17
17
  def category
18
18
  Cb::Clients::Category
19
19
  end
20
-
20
+
21
+ def industry
22
+ Cb::Clients::Industry
23
+ end
24
+
21
25
  def company
22
26
  Cb::Clients::Company
23
27
  end
@@ -0,0 +1,24 @@
1
+ module Cb
2
+ module Models
3
+ class Industry < ApiResponseModel
4
+
5
+ attr_accessor :code, :name
6
+
7
+ def initialize(args={})
8
+ @api_response = args
9
+ @code = args["Code"] || String.new
10
+ @name = args["Name"]["#text"] || String.new
11
+ @language = args["Name"]["@language"] || String.new
12
+
13
+ validate_api_response
14
+ end
15
+
16
+ protected
17
+
18
+ def required_fields
19
+ %w(Code Name)
20
+ end
21
+
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,48 @@
1
+ module Cb
2
+ module Responses
3
+ module Industry
4
+
5
+ class Search < ApiResponse
6
+
7
+ protected
8
+
9
+ def extract_models
10
+ extracted_industries_data.map { |indy| Models::Industry.new(indy) }
11
+ end
12
+
13
+ def validate_api_hash
14
+ required_response_field(root_node, response)
15
+ required_response_field(outer_collection_node, response[root_node])
16
+ required_response_field(inner_collection_node, industry_data)
17
+ end
18
+
19
+ def hash_containing_metadata
20
+ response[root_node]
21
+ end
22
+
23
+ private
24
+
25
+ def root_node
26
+ 'ResponseIndustryCodes'
27
+ end
28
+
29
+ def outer_collection_node
30
+ 'IndustryCodes'
31
+ end
32
+
33
+ def inner_collection_node
34
+ 'IndustryCode'
35
+ end
36
+
37
+ def industry_data
38
+ response[root_node][outer_collection_node]
39
+ end
40
+
41
+ def extracted_industries_data
42
+ Utils::ResponseArrayExtractor.extract(response[root_node], outer_collection_node)
43
+ end
44
+
45
+ end
46
+ end
47
+ end
48
+ end
@@ -1,3 +1,3 @@
1
1
  module Cb
2
- VERSION = '6.1.1'
2
+ VERSION = '6.2.0'
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.1.1
4
+ version: 6.2.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-04-01 00:00:00.000000000 Z
12
+ date: 2014-04-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty
@@ -217,6 +217,7 @@ files:
217
217
  - lib/cb/responses/job/search.rb
218
218
  - lib/cb/responses/application/application_form.rb
219
219
  - lib/cb/responses/spot/retrieve_response.rb
220
+ - lib/cb/responses/industry/search.rb
220
221
  - lib/cb/responses/api_response.rb
221
222
  - lib/cb/responses/user/check_existing.rb
222
223
  - lib/cb/responses/user/temporary_password.rb
@@ -240,6 +241,7 @@ files:
240
241
  - lib/cb/models/implementations/user.rb
241
242
  - lib/cb/models/implementations/job_results.rb
242
243
  - lib/cb/models/implementations/education.rb
244
+ - lib/cb/models/implementations/industry.rb
243
245
  - lib/cb/models/implementations/application_external.rb
244
246
  - lib/cb/models/implementations/saved_search.rb
245
247
  - lib/cb/models/implementations/employee_type.rb
@@ -270,6 +272,7 @@ files:
270
272
  - lib/cb/clients/job.rb
271
273
  - lib/cb/clients/user.rb
272
274
  - lib/cb/clients/education.rb
275
+ - lib/cb/clients/industry.rb
273
276
  - lib/cb/clients/application_external.rb
274
277
  - lib/cb/clients/saved_search.rb
275
278
  - lib/cb/clients/company.rb