Class: WHMCS::Misc

Inherits:
Base
  • Object
show all
Defined in:
lib/whmcs/misc.rb

Overview

The WHMCS::Misc class contains miscelaneous WHMCS API functions

Class Method Summary collapse

Methods inherited from Base

parse_response, send_request

Class Method Details

.add_banned_ip(params = {}) ⇒ Object

Add Banned IP

Parameters:

  • :ip - IP address to ban

Optional attributes:

  • :reason - reason for ban

  • :days - number of days to ban for. If not submitted defaults to 7 (not required)

  • :expires - in YYYY-MM-DD HH:II:SS format eg: 2011-06-06 01:12:34 (optional in place of “days”)

See:

docs.whmcs.com/API:Add_Banned_IP



240
241
242
243
# File 'lib/whmcs/misc.rb', line 240

def self.add_banned_ip(params = {})
	params.merge!(:action => 'addbannedip')
	send_request(params)
end

.add_product(params = {}) ⇒ Object

Add Product

Parameters:

  • :type one of hostingaccount, reselleraccount, server or other

  • :gid - the product group ID to add it to

  • :name - the product name

  • :paytype - free, onetime or recurring

Optional attributes:

  • :description - the product description

  • :hidden - set true to hide

  • :showdomainoptions - set true to show

  • :welcomeemail - the email template ID for a welcome email

  • :qty - set quantity to enable stock control

  • :proratadate

  • :proratachargenextmonth

  • :autosetup - on, payment, order or blank for none

  • :module - module name

  • :servergroupid - server group ID

  • :subdomain - subdomain to offer with product

  • :tax - set true to apply tax

  • :order - display sort order to override default

  • :configoption1

  • :configoption2

  • :pricing

See:

docs.whmcs.com/API:Add_Product



208
209
210
211
# File 'lib/whmcs/misc.rb', line 208

def self.add_product(params = {})
	params.merge!(:action => 'addproduct')
	send_request(params)
end

.decrypt_password(params = {}) ⇒ Object



174
175
176
177
# File 'lib/whmcs/misc.rb', line 174

def self.decrypt_password(params = {})
  params.merge!(:action => 'decryptpassword')
  send_request(params)
end

.encrypt_password(params = {}) ⇒ Object



157
158
159
160
# File 'lib/whmcs/misc.rb', line 157

def self.encrypt_password(params = {})
  params.merge!(:action => 'encryptpassword')
  send_request(params)
end

.get_activity_log(params = {}) ⇒ Object



15
16
17
18
# File 'lib/whmcs/misc.rb', line 15

def self.get_activity_log(params = {})
  params.merge!(:action => 'getactivitylog')
  send_request(params)
end

.get_admin_detailsObject



25
26
27
# File 'lib/whmcs/misc.rb', line 25

def self.get_admin_details
  send_request(:action => 'getadmindetails')
end

.get_currenciesObject



69
70
71
72
# File 'lib/whmcs/misc.rb', line 69

def self.get_currencies
			params.merge!(:action => 'getcurrencies')
  send_request(params)
end

.get_email_templates(params = {}) ⇒ Object



101
102
103
104
# File 'lib/whmcs/misc.rb', line 101

def self.get_email_templates(params = {})
  params.merge!(:action => 'getemailtemplates')
  send_request(params)
end

.get_promotions(params = {}) ⇒ Object



86
87
88
89
# File 'lib/whmcs/misc.rb', line 86

def self.get_promotions(params = {})
  params.merge!(:action => 'getpromotions')
  send_request(params)
end

.get_staff_onlineObject



135
136
137
# File 'lib/whmcs/misc.rb', line 135

def self.get_staff_online
  send_request(:action => 'getstaffonline')
end

.get_statsObject



144
145
146
# File 'lib/whmcs/misc.rb', line 144

def self.get_stats
  send_request(:action => 'getstats')
end

.get_todo_item_statusesObject



126
127
128
# File 'lib/whmcs/misc.rb', line 126

def self.get_todo_item_statuses
  send_request(:action => 'gettodoitemstatuses')
end

.get_todo_items(params = {}) ⇒ Object



116
117
118
119
# File 'lib/whmcs/misc.rb', line 116

def self.get_todo_items(params = {})
  params.merge!(:action => 'gettodoitems')
  send_request(params)
end

.log_activity(params = {}) ⇒ Object

Log Activity

Parameters:

  • :description - Text to add to the log

Optional attributes:

  • :userid - UserID to assign the log to in order to appear in Client Log

See:

docs.whmcs.com/API:Log_Activity



223
224
225
226
# File 'lib/whmcs/misc.rb', line 223

def self.log_activity(params = {})
	params.merge!(:action => 'logactivity')
	send_request(params)
end

.send_admin_email(params = {}) ⇒ Object

Send Admin Email This command is used to send an email to Admin users

Parameters:

  • :messagename - Name of the Admin email template to send

  • :mergefields - array of merge fields to populate the template being sent

  • :type - Who to send the email to. One of system, account or support. Default: system

Optional attributes:

  • :customsubject - Subject for a custommessage being sent

  • :custommessage - Send a custom email to admin users, this will override ‘messagename’

  • :deptid - If type = support, the users of a department to send email to

See:

docs.whmcs.com/API:Send_Admin_Email



261
262
263
264
# File 'lib/whmcs/misc.rb', line 261

def self.send_admin_email(params = {})
	params.merge!(:action => 'sendadminemail')
	send_request(params)
end

.update_admin_notes(params = {}) ⇒ Object



38
39
40
41
# File 'lib/whmcs/misc.rb', line 38

def self.update_admin_notes(params = {})
  params.merge!(:action => 'updateadminnotes')
  send_request(params)
end

.update_todo_item(params = {}) ⇒ Object

Up To-Do Item

Parameter:

  • :itemid - ID of the ToDo in WHMCS to update

  • :adminid - Admin ID to update the To Do item to

Optional attributes:

  • :date - open date of the To Do YYYYMMDD

  • :title - Title of the to do

  • :description - Text of the To Do

  • :status - Status - New, Pending, In Progress, Completed, Postponed

  • :duedate - due date of the To Do YYYYMMDD

See:

docs.whmcs.com/API:Update_To-Do_Item



59
60
61
62
# File 'lib/whmcs/misc.rb', line 59

def self.update_todo_item(params = {})
	params.merge!(:action => 'updatetodoitem')
	send_request(params)
end