Module: CloudConnect::Users
- Included in:
- Client
- Defined in:
- lib/cloud_connect/client/users.rb
Instance Method Summary collapse
-
#user(user_id = nil) ⇒ Hashie::Mash
Return information about a specific user.
-
#users(opts = {}) ⇒ Array of Hashie::Mash
Retrieve list of users.
Instance Method Details
#user(user_id = nil) ⇒ Hashie::Mash
Return information about a specific user
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/cloud_connect/client/users.rb', line 25 def user(user_id = nil) user_id = username if user_id.nil? || user_id == "" if user_id.to_i.to_s == user_id.to_s users = connection.get(connection.build_url('users', :userids => user_id)).body else users = connection.get(connection.build_url('users', :logins => user_id)).body end users.map!{|hash| hash.values.first} users.first end |
#users(opts = {}) ⇒ Array of Hashie::Mash
Retrieve list of users
15 16 17 18 19 |
# File 'lib/cloud_connect/client/users.rb', line 15 def users(opts = {}) opts.default! :ret => %w(id login email).join(',') users = connection.get(connection.build_url('users', opts)).body users.map!{|hash| hash.values.first} end |