Class: BrickFTP::RESTfulAPI::SearchUser

Inherits:
Object
  • Object
show all
Includes:
Command
Defined in:
lib/brick_ftp/restful_api/search_user.rb

Overview

Search users

See Also:

Instance Method Summary collapse

Methods included from Command

included, #initialize

Instance Method Details

#call(username) ⇒ BrickFTP::Types::User?

Returns a single user.

Parameters:

  • username (String)

    Username for the user. This is how the user will be displayed on the site. Maximum of 50 characters.

Returns:



21
22
23
24
25
26
# File 'lib/brick_ftp/restful_api/search_user.rb', line 21

def call(username)
  res = client.get("/api/rest/v1/users.json?q[username]=#{ERB::Util.url_encode(username)}")
  return nil if !res || res.empty?

  BrickFTP::Types::User.new(**res.first.symbolize_keys)
end