Class: Vestacp::Account

Inherits:
Base
  • Object
show all
Defined in:
lib/vestacp/account.rb

Overview

Vestacp::Account is the class for managing clients

Class Method Summary collapse

Methods inherited from Base

parse_response, send_request

Class Method Details

.add(raw = {}) ⇒ Object

Create User Account

Parameters:

  • :username

  • :password

  • :email

  • :package

  • :first_name

  • :last_name

See:

vestacp.com/docs/api/#add_user



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/vestacp/account.rb', line 19

def self.add(raw = {})
  args = {
    username: 'arg1',
    password: 'arg2',
    email: 'arg3',
    package: 'arg4',
    first_name: 'arg5',
    last_name: 'arg6'
  }
  params = {}
  raw.each {|key, value| params[args[key].to_sym] = value }
  params.merge!(cmd: 'v-add-user')
  send_request(params, raw)
end

.check_credentials(raw = {}) ⇒ Object

Check User Account Credentials

Parameters:

  • :username

  • :password



105
106
107
108
109
110
111
112
113
114
# File 'lib/vestacp/account.rb', line 105

def self.check_credentials(raw = {})
  args = {
    username: 'arg1',
    password: 'arg2'
  }
  params = {}
  raw.each {|key, value| params[args[key].to_sym] = value }
  params.merge!(cmd: 'v-list-user')
  send_request(params, raw)
end

.delete(raw = {}) ⇒ Object

Delete User Account

Parameters:

  • :username



39
40
41
42
43
44
45
46
47
# File 'lib/vestacp/account.rb', line 39

def self.delete(raw = {})
  args = {
    username: 'arg1'
  }
  params = {}
  raw.each {|key, value| params[args[key].to_sym] = value }
  params.merge!(cmd: 'v-delete-user')
  send_request(params, raw)
end

.information(raw = {}) ⇒ Object

List User Account Information

Returns JSON.

Parameters:

  • :username



89
90
91
92
93
94
95
96
97
# File 'lib/vestacp/account.rb', line 89

def self.information(raw = {})
  args = {
    username: 'arg1'
  }
  params = {}
  raw.each {|key, value| params[args[key].to_sym] = value }
  params.merge!(cmd: 'v-list-user', arg2: 'json')
  send_request(params, raw, true)
end

.suspend(raw = {}) ⇒ Object

Suspend User Account

Parameters:

  • :username



55
56
57
58
59
60
61
62
63
# File 'lib/vestacp/account.rb', line 55

def self.suspend(raw = {})
  args = {
    username: 'arg1'
  }
  params = {}
  raw.each {|key, value| params[args[key].to_sym] = value }
  params.merge!(cmd: 'v-suspend-user')
  send_request(params, raw)
end

.unsuspend(raw = {}) ⇒ Object

Suspend User Account

Parameters:

  • :username



71
72
73
74
75
76
77
78
79
# File 'lib/vestacp/account.rb', line 71

def self.unsuspend(raw = {})
  args = {
    username: 'arg1'
  }
  params = {}
  raw.each {|key, value| params[args[key].to_sym] = value }
  params.merge!(cmd: 'v-unsuspend-user')
  send_request(params, raw)
end