cb-api 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/lib/cb.rb CHANGED
@@ -62,4 +62,8 @@ module Cb
62
62
  def self.country
63
63
  Cb::Utils::Country
64
64
  end
65
+
66
+ def self.user
67
+ Cb::UserApi
68
+ end
65
69
  end
@@ -0,0 +1,45 @@
1
+ require 'json'
2
+ require 'nokogiri'
3
+
4
+ module Cb
5
+ class UserApi
6
+ #############################################################
7
+ ## Change a user's password
8
+ ##
9
+ ## For detailed information around this API please visit:
10
+ ## http://www.careerbuilder.com/api/UserInfo.aspx
11
+ #############################################################
12
+ def self.change_password external_id, old_password, new_password, test_mode = false
13
+ result = false
14
+
15
+ my_api = Cb::Utils::Api.new
16
+ cb_response = my_api.cb_post Cb.configuration.uri_user_change_password, :body => build_change_password_request(external_id, old_password, new_password, test_mode)
17
+ json_hash = JSON.parse cb_response.response.body
18
+
19
+ my_api.append_api_responses result, json_hash['ResponseUserChangePW']
20
+
21
+ if result.cb_response.status.include? 'Success'
22
+ result = true
23
+ my_api.append_api_responses result, json_hash['ResponseUserChangePW']
24
+ end
25
+
26
+ result
27
+ end
28
+
29
+ private
30
+ def self.build_change_password_request external_id, old_password, new_password, test_mode
31
+ builder = Nokogiri::XML::Builder.new do
32
+ Request {
33
+ ExternalID_ external_id
34
+ OldPassword_ old_password
35
+ NewPassword_ new_password
36
+ Test_ test_mode.to_s
37
+ DeveloperKey_ Cb.configuration.dev_key
38
+ }
39
+ end
40
+
41
+ builder.to_xml
42
+ end
43
+
44
+ end
45
+ end
data/lib/cb/config.rb CHANGED
@@ -7,7 +7,7 @@ module Cb
7
7
  :uri_recommendation_for_job, :uri_recommendation_for_user,
8
8
  :uri_recommendation_for_company,
9
9
  :uri_application, :uri_application_submit,
10
- :uri_application_registered
10
+ :uri_application_registered, :uri_user_change_password
11
11
 
12
12
  def initialize
13
13
  Cb::Utils::Country.inject_convenience_methods
@@ -27,6 +27,7 @@ module Cb
27
27
  @uri_application ||= '/v1/application/blank'
28
28
  @uri_application_submit ||= '/v1/Application/submit'
29
29
  @uri_application_registered ||= '/v3/Application/registered'
30
+ @uri_user_change_password ||= '/v2/User/ChangePW'
30
31
  end
31
32
 
32
33
  def to_hash
@@ -46,7 +47,8 @@ module Cb
46
47
  :uri_recommendation_for_company => @uri_recommendation_for_company,
47
48
  :uri_application => @uri_application,
48
49
  :uri_application_submit => @uri_application_submit,
49
- :uri_application_registered => @uri_application_registered
50
+ :uri_application_registered => @uri_application_registered,
51
+ :uri_user_change_password => @uri_user_change_password
50
52
  }
51
53
  end
52
54
 
data/lib/cb/utils/api.rb CHANGED
@@ -39,6 +39,7 @@ module Cb::Utils
39
39
  elsif self.class.is_numeric?(api_value)
40
40
  api_value = api_value.to_i
41
41
  end
42
+
42
43
  meta_class.class.send(:attr_reader, meta_name)
43
44
  meta_class.instance_variable_set(:"@#{meta_name}", api_value)
44
45
  end
@@ -88,7 +89,8 @@ module Cb::Utils
88
89
  'CountLimit' => 'count_limit',
89
90
  'MinQualityLimit' => 'min_quality',
90
91
  'RecommendationsAvailable' => 'recs_available',
91
- 'ApplicationStatus' => 'application_status'
92
+ 'ApplicationStatus' => 'application_status',
93
+ 'Status' => 'status'
92
94
  }
93
95
 
94
96
  key_map["#{api_key}"] ||= ''
data/lib/cb/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Cb
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  end
metadata CHANGED
@@ -1,7 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cb-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Jesse Retchko
@@ -10,11 +11,12 @@ authors:
10
11
  autorequire:
11
12
  bindir: bin
12
13
  cert_chain: []
13
- date: 2013-05-16 00:00:00.000000000 Z
14
+ date: 2013-05-24 00:00:00.000000000 Z
14
15
  dependencies:
15
16
  - !ruby/object:Gem::Dependency
16
17
  name: httparty
17
18
  requirement: !ruby/object:Gem::Requirement
19
+ none: false
18
20
  requirements:
19
21
  - - ~>
20
22
  - !ruby/object:Gem::Version
@@ -22,6 +24,7 @@ dependencies:
22
24
  type: :runtime
23
25
  prerelease: false
24
26
  version_requirements: !ruby/object:Gem::Requirement
27
+ none: false
25
28
  requirements:
26
29
  - - ~>
27
30
  - !ruby/object:Gem::Version
@@ -29,6 +32,7 @@ dependencies:
29
32
  - !ruby/object:Gem::Dependency
30
33
  name: json
31
34
  requirement: !ruby/object:Gem::Requirement
35
+ none: false
32
36
  requirements:
33
37
  - - ~>
34
38
  - !ruby/object:Gem::Version
@@ -36,6 +40,7 @@ dependencies:
36
40
  type: :runtime
37
41
  prerelease: false
38
42
  version_requirements: !ruby/object:Gem::Requirement
43
+ none: false
39
44
  requirements:
40
45
  - - ~>
41
46
  - !ruby/object:Gem::Version
@@ -56,6 +61,7 @@ files:
56
61
  - lib/cb/clients/employee_types_api.rb
57
62
  - lib/cb/clients/job_api.rb
58
63
  - lib/cb/clients/recommendation_api.rb
64
+ - lib/cb/clients/user_api.rb
59
65
  - lib/cb/config.rb
60
66
  - lib/cb/criteria/job_details_criteria.rb
61
67
  - lib/cb/criteria/job_search_criteria.rb
@@ -76,25 +82,26 @@ files:
76
82
  - README.md
77
83
  homepage: http://api.careerbuilder.com
78
84
  licenses: []
79
- metadata: {}
80
85
  post_install_message:
81
86
  rdoc_options: []
82
87
  require_paths:
83
88
  - lib
84
89
  required_ruby_version: !ruby/object:Gem::Requirement
90
+ none: false
85
91
  requirements:
86
92
  - - ! '>='
87
93
  - !ruby/object:Gem::Version
88
94
  version: '0'
89
95
  required_rubygems_version: !ruby/object:Gem::Requirement
96
+ none: false
90
97
  requirements:
91
98
  - - ! '>='
92
99
  - !ruby/object:Gem::Version
93
100
  version: '0'
94
101
  requirements: []
95
102
  rubyforge_project:
96
- rubygems_version: 2.0.3
103
+ rubygems_version: 1.8.24
97
104
  signing_key:
98
- specification_version: 4
105
+ specification_version: 3
99
106
  summary: Ruby wrapper around Careerbuilder Public API.
100
107
  test_files: []
checksums.yaml DELETED
@@ -1,15 +0,0 @@
1
- ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- OGE1OWY2NTViMDNiNjBjZTZlYzEyMDZiNTdhMDc5MWU3M2QzNWNiYw==
5
- data.tar.gz: !binary |-
6
- YjczODFjZWFmOTIyMjk1ODIyZmY1YTQwY2JmZTQ1ZmZkZWQ3YWNmNQ==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- NTE3YzA3ZjNhZTkyY2EyNGU2ZGNiOTU2YzdiMWJlMWUyYmFlN2I0NjQ5ODc4
10
- MWQ5ODQyYzQ1NzU3ZThlNDQwNGVhMDU3NzI4NTZkYjk3YWUyYTJlNDIwMDZi
11
- ZjhlMzQxMTgzMTM1YWIyZGVmZmFjMWVkMmZmYjg3Y2Y0ZWIyMmU=
12
- data.tar.gz: !binary |-
13
- ODIxMjlhZjU3ZGM4OTA5ODU3M2E2ZTk3NzYyMTE3ZDc2ZmUwNjg3NWQ3ZmM2
14
- YTYxN2NkYmFmNWExMzhiYzQ3ZGQyODMwOTMxODNiMmU4MDgyNmIwN2YyYTM5
15
- MDU3NjUzYzBmMWE1NDI4M2I5MDUxNDQxMjQ5OTkxYmYxMmFhZDA=