Class: Whmcs::Client
Overview
WHMCS::Client is the class for managing clients
Class Method Summary collapse
-
.add_client(params = {}) ⇒ Object
Create a new client.
-
.add_contact(params = {}) ⇒ Object
Add a client contact.
-
.delete_client(params = {}) ⇒ Object
Delete a client.
-
.delete_contact(params = {}) ⇒ Object
Delete a client’s contact.
-
.get_clients(params = {}) ⇒ Object
Get multiple clients.
-
.get_clients_details(params = {}) ⇒ Object
Get a client’s info.
-
.get_clients_password(params = {}) ⇒ Object
Get a hash of a client’s password.
-
.get_clients_products(params = {}) ⇒ Object
Get client’s products.
-
.get_contacts(params = {}) ⇒ Object
Get client’s contacts.
-
.send_email(params = {}) ⇒ Object
Send email to client.
-
.update_client(params = {}) ⇒ Object
Update a client’s info.
-
.update_client_product(params = {}) ⇒ Object
Update client’s product.
-
.update_contact(params = {}) ⇒ Object
Update a client’s contact.
-
.validate_login(params = {}) ⇒ Object
Validate client login info.
Methods inherited from Base
Class Method Details
.add_client(params = {}) ⇒ Object
Create a new client
Parameters:
-
:firstname
-
:lastname
-
:companyname
- optional -
:email
-
:address1
-
:address2
- optional -
:city
-
:state
-
:postcode
-
:country
- two letter ISO country code -
:phonenumber
-
:password2
- password for the new user account -
:currency
- the ID of the currency to set the user to -
:groupid
- used to assign the client to a client group -
:notes
-
:cctype
- Visa, Mastercard, etc… -
:cardnum
-
:expdate
- in the format MMYY -
:startdate
-
:issuenumber
-
:customfields
- a base64 encoded serialized array of custom field values -
:noemail
- pass as true to surpress the client signup welcome email sending
See:
35 36 37 38 |
# File 'lib/whmcs/client.rb', line 35 def self.add_client(params = {}) params.merge!(:action => 'addclient') send_request(params) end |
.add_contact(params = {}) ⇒ Object
Add a client contact
Parameters:
-
:clientid
- the client ID to add the contact to -
:firstname
-
:lastname
-
:companyname
-
:email
-
:address1
-
:address2
-
:city
-
:state
-
:postcode
-
:country
- two letter ISO country code -
:phonenumber
-
:password2
- if creating a sub-account -
:permissions
- can specify sub-account permissions eg manageproducts,managedomains -
:generalemails
- set true to receive general email types -
:productemails
- set true to receive product related emails -
:domainemails
- set true to receive domain related emails -
:invoiceemails
- set true to receive billing related emails -
:supportemails
- set true to receive support ticket related emails
See:
161 162 163 164 |
# File 'lib/whmcs/client.rb', line 161 def self.add_contact(params = {}) params.merge!(:action => 'addcontact') send_request(params) end |
.delete_client(params = {}) ⇒ Object
Delete a client
Parameters:
-
:clientid
- ID Number of the client to delete
See:
84 85 86 87 |
# File 'lib/whmcs/client.rb', line 84 def self.delete_client(params = {}) params.merge!(:action => 'deleteclient') send_request(params) end |
.delete_contact(params = {}) ⇒ Object
Delete a client’s contact
Parameters:
-
:contactid
- The ID of the contact to delete
See:
238 239 240 241 |
# File 'lib/whmcs/client.rb', line 238 def self.delete_contact(params = {}) params.merge!(:action => 'deletecontact') send_request(params) end |
.get_clients(params = {}) ⇒ Object
Get multiple clients
Parameters:
-
:limitstart
- Record to start at (default = 0) -
:limitnum
- Number of records to return (default = 25) -
:search
- Can be passed to filter for clients with a name/email matching the term entered
See:
100 101 102 103 |
# File 'lib/whmcs/client.rb', line 100 def self.get_clients(params = {}) params.merge!(:action => 'getclients') send_request(params) end |
.get_clients_details(params = {}) ⇒ Object
Get a client’s info
Parameters:
-
:clientid
- the id number of the client -
:email
- the email address of the client
See:
115 116 117 118 |
# File 'lib/whmcs/client.rb', line 115 def self.get_clients_details(params = {}) params.merge!(:action => 'getclientsdetails') send_request(params) end |
.get_clients_password(params = {}) ⇒ Object
Get a hash of a client’s password
Parameters:
-
:userid
- should contain the user id of the client you wish to get the password for
See:
129 130 131 132 |
# File 'lib/whmcs/client.rb', line 129 def self.get_clients_password(params = {}) params.merge!(:action => 'getclientpassword') send_request(params) end |
.get_clients_products(params = {}) ⇒ Object
Get client’s products
Parameters:
-
:clientid
- the ID of the client to retrieve products for -
:serviceid
- the ID of the service to retrieve details for -
:domain
- the domain of the service to retrieve details for -
:pid
- the product ID of the services to retrieve products for
See:
255 256 257 258 |
# File 'lib/whmcs/client.rb', line 255 def self.get_clients_products(params = {}) params.merge!(:action => 'getclientsproducts') send_request(params) end |
.get_contacts(params = {}) ⇒ Object
Get client’s contacts
Parameters:
-
:limitstart
- Record to start at (default = 0) -
:limitnum
- Number of records to return (default = 25) -
:userid
-
:firstname
-
:lastname
-
:companyname
-
:email
-
:address1
-
:address2
-
:city
-
:state
-
:postcode
-
:country
-
:phonenumber
-
:subaccount
- true/false
See:
189 190 191 192 |
# File 'lib/whmcs/client.rb', line 189 def self.get_contacts(params = {}) params.merge!(:action => 'getcontacts') send_request(params) end |
.send_email(params = {}) ⇒ Object
Send email to client
Parameters:
-
:messagename
- unique name of the email template to send from WHMCS -
:id
- related ID number to send message for
See:
321 322 323 324 |
# File 'lib/whmcs/client.rb', line 321 def self.send_email(params = {}) params.merge!(:action => 'sendemail') send_request(params) end |
.update_client(params = {}) ⇒ Object
Update a client’s info
Parameters:
-
:firstname
-
:lastname
-
:companyname
-
:email
-
:address1
-
:address2
-
:city
-
:state
-
:postcode
-
:country
- two letter ISO country code -
:phonenumber
-
:password2
-
:credit
- credit balance -
:taxexempt
- true to enable -
:notes
-
:cardtype
- visa, mastercard, etc… -
:cardnum
- cc number -
:expdate
- cc expiry date -
:startdate
- cc start date -
:issuenumber
- cc issue number -
:language
- default language -
:status
- active or inactive
See:
70 71 72 73 |
# File 'lib/whmcs/client.rb', line 70 def self.update_client(params = {}) params.merge!(:action => 'updateclient') send_request(params) end |
.update_client_product(params = {}) ⇒ Object
Update client’s product
Parameters:
-
:serviceid
- the ID of the service to be updated -
:pid
-
:serverid
-
:regdate
- Format: YYYY-MM-DD -
:nextduedate
- Format: YYYY-MM-DD -
:domain
-
:firstpaymentamount
-
:recurringamount
-
:billingcycle
-
:paymentmethod
-
:status
-
:serviceusername
-
:servicepassword
-
:subscriptionid
-
:promoid
-
:overideautosuspend
- on/off -
:overidesuspenduntil
- Format: YYYY-MM-DD -
:ns1
-
:ns2
-
:dedicatedip
-
:assignedips
-
:notes
-
:autorecalc
- pass true to auto set price based on product ID or billing cycle change
See:
291 292 293 294 |
# File 'lib/whmcs/client.rb', line 291 def self.update_client_product(params = {}) params.merge!(:action => 'updateclientproduct') send_request(params) end |
.update_contact(params = {}) ⇒ Object
Update a client’s contact
Parameters:
-
:contactid
- The ID of the contact to delete -
:generalemails
- set to true to receive general emails -
:productemails
- set to true to receive product emails -
:domainemails
- set to true to receive domain emails -
:invoiceemails
- set to true to receive invoice emails -
:supportemails
- set to true to receive support emails -
:firstname
- change the firstname -
:lastname
- change the lastname -
:companyname
- change the companyname -
:email
- change the email address -
:address1
- change address1 -
:address2
- change address2 -
:city
- change city -
:state
- change state -
:postcode
- change postcode -
:country
- change country -
:phonenumber
- change phonenumber -
:subaccount
- enable subaccount -
:password
- change the password -
:permissions
- set permissions eg manageproducts,managedomains
Only send fields you wish to update
See:
224 225 226 227 |
# File 'lib/whmcs/client.rb', line 224 def self.update_contact(params = {}) params.merge!(:action => 'updatecontact') send_request(params) end |
.validate_login(params = {}) ⇒ Object
Validate client login info
Parameters:
-
:email
- the email address of the user trying to login -
:password2
- the password they supply for authentication
See:
306 307 308 309 |
# File 'lib/whmcs/client.rb', line 306 def self.validate_login(params = {}) params.merge!(:action => 'validatelogin') send_request(params) end |