All URIs are relative to https://api.vultr.com/v2
Method | HTTP request | Description |
---|---|---|
create_user | POST /users | Create User |
delete_user | DELETE /users/{user-id} | Delete User |
get_user | GET /users/{user-id} | Get User |
list_users | GET /users | Get Users |
update_user | PATCH /users/{user-id} | Update User |
create_user(opts)
Create User
Create a new User. The email
, name
, and password
attributes are required.
require 'time'
require 'vultr_ruby'
# setup authorization
VultrRuby.configure do |config|
# Configure Bearer authorization: API Key
config.access_token = 'YOUR_BEARER_TOKEN'
end
api_instance = VultrRuby::UsersApi.new
opts = {
create_user_request: VultrRuby::CreateUserRequest.new({email: 'email_example', name: 'name_example', password: 'password_example'}) # CreateUserRequest | Include a JSON object in the request body with a content type of **application/json**.
}
begin
# Create User
result = api_instance.create_user(opts)
p result
rescue VultrRuby::ApiError => e
puts "Error when calling UsersApi->create_user: #{e}"
end
This returns an Array which contains the response data, status code and headers.
<Array(, Integer, Hash)> create_user_with_http_info(opts)
begin
# Create User
data, status_code, headers = api_instance.create_user_with_http_info(opts)
p status_code # => 2xx
p headers # => { ... }
p data # => <User>
rescue VultrRuby::ApiError => e
puts "Error when calling UsersApi->create_user_with_http_info: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
create_user_request | CreateUserRequest | Include a JSON object in the request body with a content type of application/json. | [optional] |
[API Key](../README.md#API Key)
- Content-Type: application/json
- Accept: application/json
delete_user(user_id)
Delete User
Delete a User.
require 'time'
require 'vultr_ruby'
# setup authorization
VultrRuby.configure do |config|
# Configure Bearer authorization: API Key
config.access_token = 'YOUR_BEARER_TOKEN'
end
api_instance = VultrRuby::UsersApi.new
user_id = 'user_id_example' # String | The [User id](#operation/list-users).
begin
# Delete User
api_instance.delete_user(user_id)
rescue VultrRuby::ApiError => e
puts "Error when calling UsersApi->delete_user: #{e}"
end
This returns an Array which contains the response data (nil
in this case), status code and headers.
<Array(nil, Integer, Hash)> delete_user_with_http_info(user_id)
begin
# Delete User
data, status_code, headers = api_instance.delete_user_with_http_info(user_id)
p status_code # => 2xx
p headers # => { ... }
p data # => nil
rescue VultrRuby::ApiError => e
puts "Error when calling UsersApi->delete_user_with_http_info: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
user_id | String | The User id. |
nil (empty response body)
[API Key](../README.md#API Key)
- Content-Type: Not defined
- Accept: Not defined
get_user(user_id)
Get User
Get information about a User.
require 'time'
require 'vultr_ruby'
# setup authorization
VultrRuby.configure do |config|
# Configure Bearer authorization: API Key
config.access_token = 'YOUR_BEARER_TOKEN'
end
api_instance = VultrRuby::UsersApi.new
user_id = 'user_id_example' # String | The [User id](#operation/list-users).
begin
# Get User
result = api_instance.get_user(user_id)
p result
rescue VultrRuby::ApiError => e
puts "Error when calling UsersApi->get_user: #{e}"
end
This returns an Array which contains the response data, status code and headers.
<Array(, Integer, Hash)> get_user_with_http_info(user_id)
begin
# Get User
data, status_code, headers = api_instance.get_user_with_http_info(user_id)
p status_code # => 2xx
p headers # => { ... }
p data # => <User>
rescue VultrRuby::ApiError => e
puts "Error when calling UsersApi->get_user_with_http_info: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
user_id | String | The User id. |
[API Key](../README.md#API Key)
- Content-Type: Not defined
- Accept: application/json
list_users(opts)
Get Users
Get a list of all Users in your account.
require 'time'
require 'vultr_ruby'
# setup authorization
VultrRuby.configure do |config|
# Configure Bearer authorization: API Key
config.access_token = 'YOUR_BEARER_TOKEN'
end
api_instance = VultrRuby::UsersApi.new
opts = {
per_page: 8.14, # Float | Number of items requested per page. Default is 100 and Max is 500.
cursor: 'cursor_example' # String | Cursor for paging. See [Meta and Pagination](#section/Introduction/Meta-and-Pagination).
}
begin
# Get Users
result = api_instance.list_users(opts)
p result
rescue VultrRuby::ApiError => e
puts "Error when calling UsersApi->list_users: #{e}"
end
This returns an Array which contains the response data, status code and headers.
<Array(, Integer, Hash)> list_users_with_http_info(opts)
begin
# Get Users
data, status_code, headers = api_instance.list_users_with_http_info(opts)
p status_code # => 2xx
p headers # => { ... }
p data # => <ListUsers200Response>
rescue VultrRuby::ApiError => e
puts "Error when calling UsersApi->list_users_with_http_info: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
per_page | Float | Number of items requested per page. Default is 100 and Max is 500. | [optional] |
cursor | String | Cursor for paging. See Meta and Pagination. | [optional] |
[API Key](../README.md#API Key)
- Content-Type: Not defined
- Accept: application/json
update_user(user_id, opts)
Update User
Update information for a User. All attributes are optional. If not set, the attributes will retain their original values.
require 'time'
require 'vultr_ruby'
# setup authorization
VultrRuby.configure do |config|
# Configure Bearer authorization: API Key
config.access_token = 'YOUR_BEARER_TOKEN'
end
api_instance = VultrRuby::UsersApi.new
user_id = 'user_id_example' # String | The [User id](#operation/list-users).
opts = {
update_user_request: VultrRuby::UpdateUserRequest.new # UpdateUserRequest | Include a JSON object in the request body with a content type of **application/json**.
}
begin
# Update User
api_instance.update_user(user_id, opts)
rescue VultrRuby::ApiError => e
puts "Error when calling UsersApi->update_user: #{e}"
end
This returns an Array which contains the response data (nil
in this case), status code and headers.
<Array(nil, Integer, Hash)> update_user_with_http_info(user_id, opts)
begin
# Update User
data, status_code, headers = api_instance.update_user_with_http_info(user_id, opts)
p status_code # => 2xx
p headers # => { ... }
p data # => nil
rescue VultrRuby::ApiError => e
puts "Error when calling UsersApi->update_user_with_http_info: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
user_id | String | The User id. | |
update_user_request | UpdateUserRequest | Include a JSON object in the request body with a content type of application/json. | [optional] |
nil (empty response body)
[API Key](../README.md#API Key)
- Content-Type: application/json
- Accept: Not defined