Sha256: d03496771bcafaf03d7673705322d8051b0c786d313dfecbd1581a285bb8331e

Contents?: true

Size: 551 Bytes

Versions: 6

Compression:

Stored size: 551 Bytes

Contents

module Inforouter #:nodoc:
  class Users
    class << self
      # All users.
      #
      # @return [Hash]
      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

      # Lookup a user by user name.
      #
      # @param user_name [String]
      #
      # @return [Inforouter::User]
      def [](user_name)
        all[user_name]
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
inforouter-0.3.0 lib/inforouter/users.rb
inforouter-0.2.9 lib/inforouter/users.rb
inforouter-0.2.8 lib/inforouter/users.rb
inforouter-0.2.7 lib/inforouter/users.rb
inforouter-0.2.6 lib/inforouter/users.rb
inforouter-0.2.0 lib/inforouter/users.rb