Class: Hachi::Clients::User
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#create(login:, name:, roles:, password:) ⇒ Hash
Create a user.
-
#current ⇒ Hash
Get current user.
-
#delete_by_id(id) ⇒ String
Delete a user.
-
#get_by_id(id) ⇒ Hash
Get a user.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Hachi::Clients::Base
Instance Method Details
#create(login:, name:, roles:, password:) ⇒ Hash
Create a user
47 48 49 50 51 52 53 54 55 56 |
# File 'lib/hachi/clients/user.rb', line 47 def create(login:, name:, roles:, password:) user = Models::User.new( login: login, name: name, roles: roles, password: password ) post("/api/user", user.payload) { |json| json } end |
#current ⇒ Hash
Get current user
11 12 13 |
# File 'lib/hachi/clients/user.rb', line 11 def current get("/api/user/current") { |json| json } end |
#delete_by_id(id) ⇒ String
Delete a user
33 34 35 |
# File 'lib/hachi/clients/user.rb', line 33 def delete_by_id(id) delete("/api/user/#{id}") { |json| json } end |
#get_by_id(id) ⇒ Hash
Get a user
22 23 24 |
# File 'lib/hachi/clients/user.rb', line 22 def get_by_id(id) get("/api/user/#{id}") { |json| json } end |