cb-api 9.0.0 → 10.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -30,19 +30,12 @@ module Cb
30
30
  my_api.append_api_responses user, json_hash
31
31
  end
32
32
 
33
- def change_password(external_id, old_password, new_password, test_mode = false)
34
- result = false
33
+ def change_password(user_info)
35
34
  my_api = Cb::Utils::Api.instance
36
- json_hash = my_api.cb_post Cb.configuration.uri_user_change_password, :body => build_change_password_request(external_id, old_password, new_password, test_mode)
35
+ uri = Cb::configuration.uri_user_change_password
36
+ response = my_api.cb_post(uri, :body => user_info.to_xml)
37
37
 
38
- if json_hash.has_key? 'ResponseUserChangePW'
39
- if json_hash['ResponseUserChangePW'].has_key?('Status') && json_hash['ResponseUserChangePW']['Status'].include?('Success')
40
- result = true
41
- end
42
- my_api.append_api_responses result, json_hash['ResponseUserChangePW']
43
- end
44
-
45
- my_api.append_api_responses result, json_hash
38
+ Cb::Responses::User::ChangePassword.new(response) if response.has_key?('ResponseUserChangePW')
46
39
  end
47
40
 
48
41
  def delete(delete_criteria)
@@ -0,0 +1,29 @@
1
+ require 'nokogiri'
2
+
3
+ module Cb
4
+ module Criteria
5
+ module User
6
+ class ChangePassword
7
+ attr_accessor :external_id, :old_password, :new_password,:test
8
+ def initialize(args = {})
9
+ @external_id = args[:external_id] || ''
10
+ @old_password = args[:old_password] || ''
11
+ @new_password = args[:new_password] || ''
12
+ @test = args[:test] || 'false'
13
+ end
14
+
15
+ def to_xml
16
+ Nokogiri::XML::Builder.new do |xml|
17
+ xml.Request {
18
+ xml.DeveloperKey Cb.configuration.dev_key
19
+ xml.ExternalID external_id
20
+ xml.OldPassword old_password
21
+ xml.NewPassword new_password
22
+ xml.Test test
23
+ }
24
+ end.to_xml
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
data/lib/cb/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Cb
2
- VERSION = '9.0.0'
2
+ VERSION = '10.0.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: 9.0.0
4
+ version: 10.0.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-07-15 00:00:00.000000000 Z
12
+ date: 2014-07-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty
@@ -226,6 +226,7 @@ files:
226
226
  - lib/cb/criteria/application/create.rb
227
227
  - lib/cb/criteria/spot/retrieve.rb
228
228
  - lib/cb/criteria/user/delete.rb
229
+ - lib/cb/criteria/user/change_password.rb
229
230
  - lib/cb/responses/anonymous_saved_search/delete.rb
230
231
  - lib/cb/responses/anonymous_saved_search/create.rb
231
232
  - lib/cb/responses/application.rb