class BrickFTP::RESTfulAPI::SearchUser

Search users

@see developers.files.com/#search-users Search users

Public Instance Methods

call(username) click to toggle source

Returns a single user.

@param [String] username Username for the user. This is how the user will be displayed on the site.

Maximum of 50 characters.

@return [BrickFTP::Types::User, nil] found User or nil

# 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