Class: Whmcsor::Orders

Inherits:
Base
  • Object
show all
Defined in:
lib/whmcsor/orders.rb

Overview

WHMCS API Orders class

Instance Method Summary collapse

Methods inherited from Base

#check_config, #check_whmcs_details, #select_user_agent, #send_request

Instance Method Details

#accept_order(params = {}) ⇒ Object

Public - Accept a pendingo order inside the system

params - hash parameters

:orderid - Order ID which will be accepted

Optional parameters:
    :serverid - the Server ID to provision any hosting products in the
    order to, overrides default
    :serviceusername - the Username to assign for provisioning,
    overrides default
    :servicepassword - the Password to assign for products being
    provisioned, overrides auto generation
    :registrar - the domain registrar module to assign any domains to
    :autosetup - true/false - determines whether product provisioning
    is performed
    :sendregistrar - true/false determines whether domain automation
    is performed
    :sendemail - true/false - sets if welcome emails for products and
    registration confirmation emails for domains should be sent

Returns Hash



68
69
70
71
# File 'lib/whmcsor/orders.rb', line 68

def accept_order(params = {})
  params.merge!(action: 'acceptorder')
  send_request(params)
end

#add_order(params = {}) ⇒ Object

Public - Add new order trough WHMCS API

params - Hash parameters

Returns Hash



9
10
11
12
# File 'lib/whmcsor/orders.rb', line 9

def add_order(params = {})
  params.merge!(action: 'addorder')
  send_request(params)
end

#cancel_order(params = {}) ⇒ Object

Public - Cancel a pendingo order inside the WHMCS system

params - Hash parameters

:orderid - ID of the order :)

Returns Hash



90
91
92
93
# File 'lib/whmcsor/orders.rb', line 90

def cancel_order(params = {})
  params.merge!(action: 'cancelorder')
  send_request(params)
end

#delete_order(params = {}) ⇒ Object

Public - Delete order from WHMCS

params - Hash parameters

:orderid - ID of the order

Returns Hash



112
113
114
115
# File 'lib/whmcsor/orders.rb', line 112

def delete_order(params = {})
  params.merge!(action: 'deleteorder')
  send_request(params)
end

#fraud_order(params = {}) ⇒ Object

Public - Set order as Fraud in the system

params - Hash parameters

:orderid - ID of the order inside WHMCS

Returns Hash



101
102
103
104
# File 'lib/whmcsor/orders.rb', line 101

def fraud_order(params = {})
  params.merge!(action: 'fraudorder')
  send_request(params)
end

#get_order_statuses(params = {}) ⇒ Object

Public - Get order statuses and their count

params - hash parameters

Returns Hash



29
30
31
32
# File 'lib/whmcsor/orders.rb', line 29

def get_order_statuses(params = {})
  params.merge!(action: 'getorderstatuses')
  send_request(params)
end

#get_orders(params = {}) ⇒ Object

Public - Retrieve the lilst of orders from WHMCS API

params - Hash parameters

Return Hash



19
20
21
22
# File 'lib/whmcsor/orders.rb', line 19

def get_orders(params = {})
  params.merge!(action: 'getorders')
  send_request(params)
end

#get_products(params = {}) ⇒ Object

Public - Retrieve product details

params - Hash parameters

:pid - Product ID
:gid - Product Group ID
:module - retrieve products assigned to a sepcific module

Returns Hash



42
43
44
45
# File 'lib/whmcsor/orders.rb', line 42

def get_products(params = {})
  params.merge!(action: 'getproducts')
  send_request(params)
end

#pending_order(params = {}) ⇒ Object

Public - Change order status to pending

params - Hash parameters

:orderid

Returns Hash



79
80
81
82
# File 'lib/whmcsor/orders.rb', line 79

def pending_order(params = {})
  params.merge!(action: 'pendingorder')
  send_request(params)
end