Method: App42::User::UserService#lock_user
- Defined in:
- lib/user/UserService.rb
#lock_user(user_name) ⇒ Object
Locks the user based on the userName. Apps can use these feature to lock a user because of reasons specific to their usercase e.g. If payment not received and the App wants the user to be inactive
483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 |
# File 'lib/user/UserService.rb', line 483 def lock_user(user_name) puts "Lock User Called " puts "Base url #{@base_url}" response, usr = nil usr, util = User.new, Util.new util.throwExceptionIfNullOrBlank(user_name, "UserName") begin connection = App42::Connection::RESTConnection.new(@base_url) body = {'app42' => {"user"=> { "userName" => user_name }}}.to_json puts "Body #{body}" query_params = {} params = { 'apiKey'=> @api_key, 'version' => @version, 'timeStamp' => util., } query_params = params.clone params.store("body", body) signature = util.sign(@secret_key, params) resource_url = "#{@version}/#{@resource}/lock" response = connection.put(signature, resource_url, query_params, body) user = UserResponseBuilder.new usr = user.buildResponse(response) rescue App42Exception =>e raise e rescue Exception => e raise App42Exception.new(e) end return usr end |