Class: Hanko::Api::Admin::Passwords
- Inherits:
-
Object
- Object
- Hanko::Api::Admin::Passwords
- Defined in:
- lib/hanko/api/admin/passwords.rb
Overview
Admin resource for managing a user's password.
Instance Method Summary collapse
-
#create(**params) ⇒ Resource
Create a password for the user.
-
#delete ⇒ void
Delete the user's password.
-
#get ⇒ Resource
Fetch the user's password resource.
-
#initialize(connection, user_base_path) ⇒ Passwords
constructor
Initialize the passwords resource scoped to a user.
-
#update(**params) ⇒ Resource
Update the user's password.
Constructor Details
#initialize(connection, user_base_path) ⇒ Passwords
Initialize the passwords resource scoped to a user.
13 14 15 16 |
# File 'lib/hanko/api/admin/passwords.rb', line 13 def initialize(connection, user_base_path) @connection = connection @base_path = "#{user_base_path}/password" end |
Instance Method Details
#create(**params) ⇒ Resource
Create a password for the user.
22 23 24 25 |
# File 'lib/hanko/api/admin/passwords.rb', line 22 def create(**params) response = @connection.post(@base_path, params) Resource.new(JSON.parse(response.body)) end |
#delete ⇒ void
This method returns an undefined value.
Delete the user's password.
47 48 49 50 |
# File 'lib/hanko/api/admin/passwords.rb', line 47 def delete @connection.delete(@base_path) nil end |
#get ⇒ Resource
Fetch the user's password resource.
30 31 32 33 |
# File 'lib/hanko/api/admin/passwords.rb', line 30 def get response = @connection.get(@base_path) Resource.new(JSON.parse(response.body)) end |
#update(**params) ⇒ Resource
Update the user's password.
39 40 41 42 |
# File 'lib/hanko/api/admin/passwords.rb', line 39 def update(**params) response = @connection.put(@base_path, params) Resource.new(JSON.parse(response.body)) end |