class Datacentred::Request::Users
RESTful API requests for the user endpoints.
Public Class Methods
Create a new user. POST /api/users @param [Hash] params User attributes. @raise [Errors::UnprocessableEntity] Raised if validations fail for the supplied attributes. @raise [Errors::Unauthorized] Raised if credentials aren't valid.
@return [Hash] New user.
# File lib/datacentred/request/users.rb, line 14 def create(params) post('users', 'user' => params)['user'] end
Permanently remove the specified user.
DELETE /api/users/82fa8de8f09102cc
@param [String] id The unique identifier for this user. @raise [Errors::NotFound] Raised if the user couldn't be found. @raise [Errors::UnprocessableEntity] Raised if validations fail for the specified user. @raise [Errors::Unauthorized] Raised if credentials aren't valid. @return [nil] Confirms the user was destroyed.
# File lib/datacentred/request/users.rb, line 63 def destroy(id) delete("users/#{id}") end
List all available users.
GET /api/users
@raise [Errors::Unauthorized] Raised if credentials aren't valid. @return [[Hash]] A collection of all users on this account.
# File lib/datacentred/request/users.rb, line 24 def list get('users')['users'] end
Find a user by unique ID.
GET /api/users/82fa8de8f09102cc
@param [String] id The unique identifier for this user. @raise [Errors::NotFound] Raised if the user couldn't be found. @raise [Errors::Unauthorized] Raised if credentials aren't valid. @return [Hash] The user, if it exists.
# File lib/datacentred/request/users.rb, line 36 def show(id) get("users/#{id}")['user'] end
Update a user by unique ID.
PUT /api/users/82fa8de8f09102cc
@param [String] id The unique identifier for this user. @param [Hash] params User
attributes. @raise [Errors::UnprocessableEntity] Raised if validations fail for the supplied attributes. @raise [Errors::NotFound] Raised if the user couldn't be found. @raise [Errors::Unauthorized] Raised if credentials aren't valid. @return [Hash] The updated user.
# File lib/datacentred/request/users.rb, line 50 def update(id, params) put("users/#{id}", 'user' => params)['user'] end