Skip to content

Commit

Permalink
delete user
Browse files Browse the repository at this point in the history
added delete_user (delete)
added delete_user test
  • Loading branch information
r4cc00n committed Nov 22, 2021
1 parent 73efe19 commit fed72a4
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
18 changes: 18 additions & 0 deletions lib/oktakit/client/users.rb
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,24 @@ def deactivate_user(id, options = {})
post("/users/#{id}/lifecycle/deactivate", options)
end

# Delete User
#
# @params id [string] User ID
# @param options[:query] [Hash] Optional. Query params for request
# @param options[:headers] [Hash] Optional. Header params for the request.
# @param options[:accept] [String] Optional. The content type to accept. Default application/json
# @param options[:content_type] [String] Optional. The content type for the request. Default application/json
# @param options [Hash] Optional. Body params for request.
# @return [Hash<Sawyer::Resource>] Returns an empty object.
# @note Deletes a user permanently. This operation can only be performed on users that have a DEPROVISIONED status. This action cannot be recovered!
# This operation on a user that hasn't been deactivated causes that user to be deactivated. A second delete operation is required to delete the user.
# @see https://developer.okta.com/docs/api/resources/users#deactivate-user
# @example
# Oktakit.delete_user('id')
def delete_user(id, options = {})
delete("/users/#{id}", options)
end

# Suspend User
#
# @params id [string] User ID
Expand Down
9 changes: 9 additions & 0 deletions spec/client/users_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,15 @@
end
end

describe '#delete_user' do
it 'returns an empty object.' do
VCR.use_cassette('delete_user') do
resp, = client.delete_user(USERS_USER_ID)
expect(resp.to_h).to(be == {})
end
end
end

describe '#suspend_user' do
it 'returns an empty object.' do
VCR.use_cassette('suspend_user') do
Expand Down

0 comments on commit fed72a4

Please sign in to comment.