Class: Hachi::Clients::User

Inherits:
Base
  • Object
show all
Defined in:
lib/hachi/clients/user.rb

Instance Attribute Summary

Attributes inherited from Base

#api_endpoint, #api_key, #api_version

Instance Method Summary collapse

Methods inherited from Base

#delete, #get, #initialize, #patch, #post

Methods included from Awrence::Methods

#to_camel_keys, #to_camelback_keys

Constructor Details

This class inherits a constructor from Hachi::Clients::Base

Instance Method Details

#create(**payload) ⇒ Hash

Create a user

Parameters:

  • payload (Hash)

Returns:

  • (Hash)


44
45
46
# File 'lib/hachi/clients/user.rb', line 44

def create(**payload)
  post("/user", json: payload) { |json| json }
end

#currentHash

Get current user

Returns:

  • (Hash)


11
12
13
# File 'lib/hachi/clients/user.rb', line 11

def current
  get("/user/current") { |json| json }
end

#delete_by_id(id) ⇒ String

Delete a user

Parameters:

  • id (String)

    User ID

Returns:

  • (String)


33
34
35
# File 'lib/hachi/clients/user.rb', line 33

def delete_by_id(id)
  delete("/user/#{id}") { |json| json }
end

#get_by_id(id) ⇒ Hash

Get a user

Parameters:

  • id (String)

    User ID

Returns:

  • (Hash)


22
23
24
# File 'lib/hachi/clients/user.rb', line 22

def get_by_id(id)
  get("/user/#{id}") { |json| json }
end