Method: PayTrace::Configuration#update_password

Defined in:
lib/paytrace/configuration.rb

#update_password(params) ⇒ Object

Updates the API password. Parameters are passed in a hash. They are:

  • :new_password – the new password to use



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/paytrace/configuration.rb', line 28

def update_password(params)
  request = PayTrace::API::Request.new
  request.set_param(:method, RESET_PASSWORD_METHOD)
  request.set_param(:new_password, params[:new_password])
  request.set_param(:new_password_confirmation, params[:new_password])
  gateway = PayTrace::API::Gateway.new
  response = gateway.send_request(request)   

  unless response.has_errors?
    PayTrace.configure do |config|
      config.password = params[:new_password]
    end
  end 

  response
end