Class: Dogapi::V1::UserService
- Inherits:
-
APIService
- Object
- APIService
- Dogapi::V1::UserService
- Defined in:
- lib/dogapi/v1/user.rb
Constant Summary collapse
- API_VERSION =
'v1'
Instance Attribute Summary
Attributes inherited from APIService
Instance Method Summary collapse
-
#create_user(description = {}) ⇒ Object
Create a user.
-
#disable_user(handle) ⇒ Object
Disable a user.
-
#get_all_users ⇒ Object
Retrieve all users.
-
#get_user(handle) ⇒ Object
Retrieve user information.
-
#invite(emails, options = {}) ⇒ Object
DEPRECATED: Going forward, we’re using a new and more restful API, the new methods are get_user, create_user, update_user, disable_user.
-
#update_user(handle, description = {}) ⇒ Object
Update a user.
Methods inherited from APIService
#connect, #handle_redirect, #handle_response, #initialize, #prepare_params, #prepare_request, #request, #should_set_api_and_app_keys_in_params?, #suppress_error_if_silent
Constructor Details
This class inherits a constructor from Dogapi::APIService
Instance Method Details
#create_user(description = {}) ⇒ Object
Create a user
:description => Hash: user description containing ‘handle’ and ‘name’ properties
27 28 29 |
# File 'lib/dogapi/v1/user.rb', line 27 def create_user(description= {}) request(Net::HTTP::Post, "/api/#{API_VERSION}/user", nil, description, true) end |
#disable_user(handle) ⇒ Object
Disable a user
:handle => String: user handle
55 56 57 |
# File 'lib/dogapi/v1/user.rb', line 55 def disable_user(handle) request(Net::HTTP::Delete, "/api/#{API_VERSION}/user/#{handle}", nil, nil, false) end |
#get_all_users ⇒ Object
Retrieve all users
39 40 41 |
# File 'lib/dogapi/v1/user.rb', line 39 def get_all_users request(Net::HTTP::Get, "/api/#{API_VERSION}/user", nil, nil, false) end |
#get_user(handle) ⇒ Object
Retrieve user information
:handle => String: user handle
34 35 36 |
# File 'lib/dogapi/v1/user.rb', line 34 def get_user(handle) request(Net::HTTP::Get, "/api/#{API_VERSION}/user/#{handle}", nil, nil, false) end |
#invite(emails, options = {}) ⇒ Object
DEPRECATED: Going forward, we’re using a new and more restful API, the new methods are get_user, create_user, update_user, disable_user
14 15 16 17 18 19 20 21 22 |
# File 'lib/dogapi/v1/user.rb', line 14 def invite(emails, = {}) warn '[DEPRECATION] Dogapi::V1::UserService::invite has been deprecated '\ 'in favor of Dogapi::V1::UserService::create_user' body = { 'emails' => emails, }.merge request(Net::HTTP::Post, "/api/#{API_VERSION}/invite_users", nil, body, true) end |
#update_user(handle, description = {}) ⇒ Object
Update a user
:handle => String: user handle :description => Hash: user description optionally containing ‘name’, ‘email’, ‘is_admin’, ‘disabled’ properties
48 49 50 |
# File 'lib/dogapi/v1/user.rb', line 48 def update_user(handle, description= {}) request(Net::HTTP::Put, "/api/#{API_VERSION}/user/#{handle}", nil, description, true) end |