Class: Inforouter::Users

Inherits:
Object
  • Object
show all
Defined in:
lib/inforouter/users.rb

Class Method Summary collapse

Class Method Details

.[](user_name) ⇒ Inforouter::User

Lookup a user by user name.

Parameters:

  • user_name (String)

Returns:



20
21
22
# File 'lib/inforouter/users.rb', line 20

def [](user_name)
  all[user_name]
end

.allHash

All users.

Returns:

  • (Hash)


7
8
9
10
11
12
13
# File 'lib/inforouter/users.rb', line 7

def all
  @users ||= begin
    response = Inforouter.client.request :get_all_users
    users = Inforouter::Responses::Users.parse response
    Hash[users.map { |user| [user.user_name, user] }]
  end
end