Class: DotBlockAPI::Client
- Inherits:
-
Object
- Object
- DotBlockAPI::Client
- Defined in:
- lib/dotblock_api/client.rb
Instance Method Summary collapse
- #boot_server(id) ⇒ Object
- #client_info ⇒ Object
-
#initialize(username, password) ⇒ Client
constructor
A new instance of Client.
- #ping ⇒ Object
- #reboot_server(id) ⇒ Object
- #resume_server(id) ⇒ Object
- #server_info(id) ⇒ Object
- #server_list ⇒ Object
- #shutdown_server(id) ⇒ Object
- #suspend_server(id) ⇒ Object
- #update_client_info(params = {}) ⇒ Object
Constructor Details
#initialize(username, password) ⇒ Client
Returns a new instance of Client.
7 8 9 10 |
# File 'lib/dotblock_api/client.rb', line 7 def initialize(username, password) @username = username @password = password end |
Instance Method Details
#boot_server(id) ⇒ Object
37 38 39 |
# File 'lib/dotblock_api/client.rb', line 37 def boot_server(id) send_request("/v1/servers/#{id}.json", 'PUT', { "action" => "boot" }) end |
#client_info ⇒ Object
16 17 18 |
# File 'lib/dotblock_api/client.rb', line 16 def client_info send_request("/v1/account.json") end |
#ping ⇒ Object
12 13 14 |
# File 'lib/dotblock_api/client.rb', line 12 def ping send_request("/v1/ping") end |
#reboot_server(id) ⇒ Object
33 34 35 |
# File 'lib/dotblock_api/client.rb', line 33 def reboot_server(id) send_request("/v1/servers/#{id}.json", 'PUT', { "action" => "reboot" }) end |
#resume_server(id) ⇒ Object
45 46 47 |
# File 'lib/dotblock_api/client.rb', line 45 def resume_server(id) send_request("/v1/servers/#{id}.json", 'PUT', { "action" => "resume" }) end |
#server_info(id) ⇒ Object
29 30 31 |
# File 'lib/dotblock_api/client.rb', line 29 def server_info(id) send_request("/v1/servers/#{id}.json") end |
#server_list ⇒ Object
25 26 27 |
# File 'lib/dotblock_api/client.rb', line 25 def server_list send_request("/v1/servers.json") end |
#shutdown_server(id) ⇒ Object
49 50 51 |
# File 'lib/dotblock_api/client.rb', line 49 def shutdown_server(id) send_request("/v1/servers/#{id}.json", 'PUT', { "action" => "shutdown" }) end |
#suspend_server(id) ⇒ Object
41 42 43 |
# File 'lib/dotblock_api/client.rb', line 41 def suspend_server(id) send_request("/v1/servers/#{id}.json", 'PUT', { "action" => "suspend" }) end |
#update_client_info(params = {}) ⇒ Object
20 21 22 23 |
# File 'lib/dotblock_api/client.rb', line 20 def update_client_info(params = {}) info = Hash[params.map { |key, val| ["info[#{key}]", val] }] send_request("/v1/account.json", 'PUT', info) end |