whmcs 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.document +5 -0
- data/.editorconfig +10 -0
- data/Gemfile +15 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +19 -0
- data/Rakefile +51 -0
- data/VERSION +1 -0
- data/lib/whmcs/base.rb +69 -0
- data/lib/whmcs/client.rb +326 -0
- data/lib/whmcs/config.rb +20 -0
- data/lib/whmcs/invoice.rb +195 -0
- data/lib/whmcs/misc.rb +168 -0
- data/lib/whmcs/module.rb +62 -0
- data/lib/whmcs/order.rb +166 -0
- data/lib/whmcs/quote.rb +125 -0
- data/lib/whmcs/ticket.rb +172 -0
- data/lib/whmcs.rb +29 -0
- data/test/helper.rb +34 -0
- data/test/test_whmcs.rb +7 -0
- metadata +149 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9fbacb82a4243ea53460f437de45574b17e8cb0d
|
4
|
+
data.tar.gz: 5694b362cb8d253393d3d9275442614a886c5b6d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1952b45aac539b64481f312f9777be7fc365ce1eba21c75021709e73a16b292907a6774a9faa3a1cf7677ba51c6aa9147557eee94f5feb2743e7583ac950e3cc
|
7
|
+
data.tar.gz: b313326186bbf7bc146facb2dfff4e02b4c101df0585cdc2a17e177a656b1baf029da8b924eb8fdc2bf4dc5fefe1e69b1c10a3ee6c94fc3d66a2e92e59ec5fa7
|
data/.document
ADDED
data/.editorconfig
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
# Example:
|
4
|
+
# gem "activesupport", ">= 2.3.5"
|
5
|
+
gem "crack", "= 0.1.8"
|
6
|
+
|
7
|
+
# Add dependencies to develop your gem here.
|
8
|
+
# Include everything needed to run rake, tests, features, etc.
|
9
|
+
group :development do
|
10
|
+
gem "shoulda", ">= 0"
|
11
|
+
gem "rdoc", "~> 3.12"
|
12
|
+
gem "bundler", "~> 1.0"
|
13
|
+
gem "jeweler", "~> 2.0.1"
|
14
|
+
gem "simplecov", ">= 0"
|
15
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2015 Matthew J.W. Basterfield
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
= whmcs
|
2
|
+
|
3
|
+
Description goes here.
|
4
|
+
|
5
|
+
== Contributing to whmcs
|
6
|
+
|
7
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
8
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
9
|
+
* Fork the project.
|
10
|
+
* Start a feature/bugfix branch.
|
11
|
+
* Commit and push until you are happy with your contribution.
|
12
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
13
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
14
|
+
|
15
|
+
== Copyright
|
16
|
+
|
17
|
+
Copyright (c) 2015 Matthew J.W. Basterfield. See LICENSE.txt for
|
18
|
+
further details.
|
19
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
|
17
|
+
gem.name = "whmcs"
|
18
|
+
gem.homepage = "http://github.com/mjwb/whmcs"
|
19
|
+
gem.license = "MIT"
|
20
|
+
gem.summary = %Q{whmcs: A Ruby wrapper for the WHMCS API.}
|
21
|
+
gem.description = %Q{whmcs: A ruby wrapper for the WHMCS API - a port of the whmcs-ruby gem (https://github.com/dotblock/whmcs-ruby)}
|
22
|
+
gem.email = "mjwb@flexbox.co.za"
|
23
|
+
gem.authors = ["Matthew J.W. Basterfield"]
|
24
|
+
# dependencies defined in Gemfile
|
25
|
+
end
|
26
|
+
Jeweler::RubygemsDotOrgTasks.new
|
27
|
+
|
28
|
+
require 'rake/testtask'
|
29
|
+
Rake::TestTask.new(:test) do |test|
|
30
|
+
test.libs << 'lib' << 'test'
|
31
|
+
test.pattern = 'test/**/test_*.rb'
|
32
|
+
test.verbose = true
|
33
|
+
end
|
34
|
+
|
35
|
+
desc "Code coverage detail"
|
36
|
+
task :simplecov do
|
37
|
+
ENV['COVERAGE'] = "true"
|
38
|
+
Rake::Task['test'].execute
|
39
|
+
end
|
40
|
+
|
41
|
+
task :default => :test
|
42
|
+
|
43
|
+
require 'rdoc/task'
|
44
|
+
Rake::RDocTask.new do |rdoc|
|
45
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
46
|
+
|
47
|
+
rdoc.rdoc_dir = 'rdoc'
|
48
|
+
rdoc.title = "whmcs #{version}"
|
49
|
+
rdoc.rdoc_files.include('README*')
|
50
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
51
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
data/lib/whmcs/base.rb
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
require 'net/https'
|
3
|
+
require 'crack'
|
4
|
+
|
5
|
+
module WHMCS
|
6
|
+
# WHMCS::Base is the main class used to subclass WHMCS API resources
|
7
|
+
class Base
|
8
|
+
|
9
|
+
# Sends an API request to the WHMCS API
|
10
|
+
#
|
11
|
+
# Parameters:
|
12
|
+
# * <tt>:action</tt> - The API action to perform
|
13
|
+
#
|
14
|
+
# All other paramters are passed along as HTTP POST variables
|
15
|
+
def self.send_request(params = {})
|
16
|
+
if params[:action].blank?
|
17
|
+
raise "No API action set"
|
18
|
+
end
|
19
|
+
|
20
|
+
params.merge!(
|
21
|
+
:username => WHMCS.config.api_username,
|
22
|
+
:password => WHMCS.config.api_password
|
23
|
+
)
|
24
|
+
|
25
|
+
url = URI.parse(WHMCS.config.api_url)
|
26
|
+
|
27
|
+
http = Net::HTTP.new(url.host, url.port)
|
28
|
+
|
29
|
+
if url.port == 443
|
30
|
+
http.use_ssl = true
|
31
|
+
end
|
32
|
+
|
33
|
+
req = Net::HTTP::Post.new(url.path)
|
34
|
+
req.set_form_data(params)
|
35
|
+
|
36
|
+
res = http.start { |http| http.request(req) }
|
37
|
+
parse_response(res.body)
|
38
|
+
end
|
39
|
+
|
40
|
+
# Converts the API response to a Hash
|
41
|
+
def self.parse_response(raw)
|
42
|
+
return {} if raw.to_s.blank?
|
43
|
+
|
44
|
+
if raw.match(/xml version/)
|
45
|
+
Crack::XML.parse(raw)
|
46
|
+
else
|
47
|
+
Hash[raw.split(';').map { |line| line.split('=') }]
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
# Fix Net::HTTP so we dont get
|
54
|
+
# warning: peer certificate won't be verified in this SSL session
|
55
|
+
#
|
56
|
+
# See:
|
57
|
+
#
|
58
|
+
# http://www.5dollarwhitebox.org/drupal/node/64
|
59
|
+
module Net #:nodoc:all
|
60
|
+
class HTTP
|
61
|
+
alias_method :old_initialize, :initialize
|
62
|
+
|
63
|
+
def initialize(*args)
|
64
|
+
old_initialize(*args)
|
65
|
+
@ssl_context = OpenSSL::SSL::SSLContext.new
|
66
|
+
@ssl_context.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
data/lib/whmcs/client.rb
ADDED
@@ -0,0 +1,326 @@
|
|
1
|
+
module WHMCS
|
2
|
+
# WHMCS::Client is the class for managing clients
|
3
|
+
class Client < Base
|
4
|
+
|
5
|
+
# Create a new client
|
6
|
+
#
|
7
|
+
# Parameters:
|
8
|
+
#
|
9
|
+
# * <tt>:firstname</tt>
|
10
|
+
# * <tt>:lastname</tt>
|
11
|
+
# * <tt>:companyname</tt> - optional
|
12
|
+
# * <tt>:email</tt>
|
13
|
+
# * <tt>:address1</tt>
|
14
|
+
# * <tt>:address2</tt> - optional
|
15
|
+
# * <tt>:city</tt>
|
16
|
+
# * <tt>:state</tt>
|
17
|
+
# * <tt>:postcode</tt>
|
18
|
+
# * <tt>:country</tt> - two letter ISO country code
|
19
|
+
# * <tt>:phonenumber</tt>
|
20
|
+
# * <tt>:password2</tt> - password for the new user account
|
21
|
+
# * <tt>:currency</tt> - the ID of the currency to set the user to
|
22
|
+
# * <tt>:groupid</tt> - used to assign the client to a client group
|
23
|
+
# * <tt>:notes</tt>
|
24
|
+
# * <tt>:cctype</tt> - Visa, Mastercard, etc...
|
25
|
+
# * <tt>:cardnum</tt>
|
26
|
+
# * <tt>:expdate</tt> - in the format MMYY
|
27
|
+
# * <tt>:startdate</tt>
|
28
|
+
# * <tt>:issuenumber</tt>
|
29
|
+
# * <tt>:customfields</tt> - a base64 encoded serialized array of custom field values
|
30
|
+
# * <tt>:noemail</tt> - pass as true to surpress the client signup welcome email sending
|
31
|
+
#
|
32
|
+
# See:
|
33
|
+
#
|
34
|
+
# http://wiki.whmcs.com/API:Add_Client
|
35
|
+
def self.add_client(params = {})
|
36
|
+
params.merge!(:action => 'addclient')
|
37
|
+
send_request(params)
|
38
|
+
end
|
39
|
+
|
40
|
+
# Update a client's info
|
41
|
+
#
|
42
|
+
# Parameters:
|
43
|
+
#
|
44
|
+
# * <tt>:firstname</tt>
|
45
|
+
# * <tt>:lastname</tt>
|
46
|
+
# * <tt>:companyname</tt>
|
47
|
+
# * <tt>:email</tt>
|
48
|
+
# * <tt>:address1</tt>
|
49
|
+
# * <tt>:address2</tt>
|
50
|
+
# * <tt>:city</tt>
|
51
|
+
# * <tt>:state</tt>
|
52
|
+
# * <tt>:postcode</tt>
|
53
|
+
# * <tt>:country</tt> - two letter ISO country code
|
54
|
+
# * <tt>:phonenumber</tt>
|
55
|
+
# * <tt>:password2</tt>
|
56
|
+
# * <tt>:credit</tt> - credit balance
|
57
|
+
# * <tt>:taxexempt</tt> - true to enable
|
58
|
+
# * <tt>:notes</tt>
|
59
|
+
# * <tt>:cardtype</tt> - visa, mastercard, etc...
|
60
|
+
# * <tt>:cardnum</tt> - cc number
|
61
|
+
# * <tt>:expdate</tt> - cc expiry date
|
62
|
+
# * <tt>:startdate</tt> - cc start date
|
63
|
+
# * <tt>:issuenumber</tt> - cc issue number
|
64
|
+
# * <tt>:language</tt> - default language
|
65
|
+
# * <tt>:status</tt> - active or inactive
|
66
|
+
#
|
67
|
+
# See:
|
68
|
+
#
|
69
|
+
# http://wiki.whmcs.com/API:Update_Client
|
70
|
+
def self.update_client(params = {})
|
71
|
+
params.merge!(:action => 'updateclient')
|
72
|
+
send_request(params)
|
73
|
+
end
|
74
|
+
|
75
|
+
# Delete a client
|
76
|
+
#
|
77
|
+
# Parameters:
|
78
|
+
#
|
79
|
+
# * <tt>:clientid</tt> - ID Number of the client to delete
|
80
|
+
#
|
81
|
+
# See:
|
82
|
+
#
|
83
|
+
# http://wiki.whmcs.com/API:Delete_Client
|
84
|
+
def self.delete_client(params = {})
|
85
|
+
params.merge!(:action => 'deleteclient')
|
86
|
+
send_request(params)
|
87
|
+
end
|
88
|
+
|
89
|
+
# Get multiple clients
|
90
|
+
#
|
91
|
+
# Parameters:
|
92
|
+
#
|
93
|
+
# * <tt>:limitstart</tt> - Record to start at (default = 0)
|
94
|
+
# * <tt>:limitnum</tt> - Number of records to return (default = 25)
|
95
|
+
# * <tt>:search</tt> - Can be passed to filter for clients with a name/email matching the term entered
|
96
|
+
#
|
97
|
+
# See:
|
98
|
+
#
|
99
|
+
# http://wiki.whmcs.com/API:Get_Clients
|
100
|
+
def self.get_clients(params = {})
|
101
|
+
params.merge!(:action => 'getclients')
|
102
|
+
send_request(params)
|
103
|
+
end
|
104
|
+
|
105
|
+
# Get a client's info
|
106
|
+
#
|
107
|
+
# Parameters:
|
108
|
+
#
|
109
|
+
# * <tt>:clientid</tt> - the id number of the client
|
110
|
+
# * <tt>:email</tt> - the email address of the client
|
111
|
+
#
|
112
|
+
# See:
|
113
|
+
#
|
114
|
+
# http://wiki.whmcs.com/API:Get_Clients_Details
|
115
|
+
def self.get_clients_details(params = {})
|
116
|
+
params.merge!(:action => 'getclientsdetails')
|
117
|
+
send_request(params)
|
118
|
+
end
|
119
|
+
|
120
|
+
# Get a hash of a client's password
|
121
|
+
#
|
122
|
+
# Parameters:
|
123
|
+
#
|
124
|
+
# * <tt>:userid</tt> - should contain the user id of the client you wish to get the password for
|
125
|
+
#
|
126
|
+
# See:
|
127
|
+
#
|
128
|
+
# http://wiki.whmcs.com/API:Get_Clients_Password
|
129
|
+
def self.get_clients_password(params = {})
|
130
|
+
params.merge!(:action => 'getclientpassword')
|
131
|
+
send_request(params)
|
132
|
+
end
|
133
|
+
|
134
|
+
# Add a client contact
|
135
|
+
#
|
136
|
+
# Parameters:
|
137
|
+
#
|
138
|
+
# * <tt>:clientid</tt> - the client ID to add the contact to
|
139
|
+
# * <tt>:firstname</tt>
|
140
|
+
# * <tt>:lastname</tt>
|
141
|
+
# * <tt>:companyname</tt>
|
142
|
+
# * <tt>:email</tt>
|
143
|
+
# * <tt>:address1</tt>
|
144
|
+
# * <tt>:address2</tt>
|
145
|
+
# * <tt>:city</tt>
|
146
|
+
# * <tt>:state</tt>
|
147
|
+
# * <tt>:postcode</tt>
|
148
|
+
# * <tt>:country</tt> - two letter ISO country code
|
149
|
+
# * <tt>:phonenumber</tt>
|
150
|
+
# * <tt>:password2</tt> - if creating a sub-account
|
151
|
+
# * <tt>:permissions</tt> - can specify sub-account permissions eg manageproducts,managedomains
|
152
|
+
# * <tt>:generalemails</tt> - set true to receive general email types
|
153
|
+
# * <tt>:productemails</tt> - set true to receive product related emails
|
154
|
+
# * <tt>:domainemails</tt> - set true to receive domain related emails
|
155
|
+
# * <tt>:invoiceemails</tt> - set true to receive billing related emails
|
156
|
+
# * <tt>:supportemails</tt> - set true to receive support ticket related emails
|
157
|
+
#
|
158
|
+
# See:
|
159
|
+
#
|
160
|
+
# http://wiki.whmcs.com/API:Add_Contact
|
161
|
+
def self.add_contact(params = {})
|
162
|
+
params.merge!(:action => 'addcontact')
|
163
|
+
send_request(params)
|
164
|
+
end
|
165
|
+
|
166
|
+
# Get client's contacts
|
167
|
+
#
|
168
|
+
# Parameters:
|
169
|
+
#
|
170
|
+
# * <tt>:limitstart</tt> - Record to start at (default = 0)
|
171
|
+
# * <tt>:limitnum</tt> - Number of records to return (default = 25)
|
172
|
+
# * <tt>:userid</tt>
|
173
|
+
# * <tt>:firstname</tt>
|
174
|
+
# * <tt>:lastname</tt>
|
175
|
+
# * <tt>:companyname</tt>
|
176
|
+
# * <tt>:email</tt>
|
177
|
+
# * <tt>:address1</tt>
|
178
|
+
# * <tt>:address2</tt>
|
179
|
+
# * <tt>:city</tt>
|
180
|
+
# * <tt>:state</tt>
|
181
|
+
# * <tt>:postcode</tt>
|
182
|
+
# * <tt>:country</tt>
|
183
|
+
# * <tt>:phonenumber</tt>
|
184
|
+
# * <tt>:subaccount</tt> - true/false
|
185
|
+
#
|
186
|
+
# See:
|
187
|
+
#
|
188
|
+
# http://wiki.whmcs.com/API:Get_Contacts
|
189
|
+
def self.get_contacts(params = {})
|
190
|
+
params.merge!(:action => 'getcontacts')
|
191
|
+
send_request(params)
|
192
|
+
end
|
193
|
+
|
194
|
+
# Update a client's contact
|
195
|
+
#
|
196
|
+
# Parameters:
|
197
|
+
#
|
198
|
+
# * <tt>:contactid</tt> - The ID of the contact to delete
|
199
|
+
# * <tt>:generalemails</tt> - set to true to receive general emails
|
200
|
+
# * <tt>:productemails</tt> - set to true to receive product emails
|
201
|
+
# * <tt>:domainemails</tt> - set to true to receive domain emails
|
202
|
+
# * <tt>:invoiceemails</tt> - set to true to receive invoice emails
|
203
|
+
# * <tt>:supportemails</tt> - set to true to receive support emails
|
204
|
+
# * <tt>:firstname</tt> - change the firstname
|
205
|
+
# * <tt>:lastname</tt> - change the lastname
|
206
|
+
# * <tt>:companyname</tt> - change the companyname
|
207
|
+
# * <tt>:email</tt> - change the email address
|
208
|
+
# * <tt>:address1</tt> - change address1
|
209
|
+
# * <tt>:address2</tt> - change address2
|
210
|
+
# * <tt>:city</tt> - change city
|
211
|
+
# * <tt>:state</tt> - change state
|
212
|
+
# * <tt>:postcode</tt> - change postcode
|
213
|
+
# * <tt>:country</tt> - change country
|
214
|
+
# * <tt>:phonenumber</tt> - change phonenumber
|
215
|
+
# * <tt>:subaccount</tt> - enable subaccount
|
216
|
+
# * <tt>:password</tt> - change the password
|
217
|
+
# * <tt>:permissions</tt> - set permissions eg manageproducts,managedomains
|
218
|
+
#
|
219
|
+
# Only send fields you wish to update
|
220
|
+
#
|
221
|
+
# See:
|
222
|
+
#
|
223
|
+
# http://wiki.whmcs.com/API:Update_Contact
|
224
|
+
def self.update_contact(params = {})
|
225
|
+
params.merge!(:action => 'updatecontact')
|
226
|
+
send_request(params)
|
227
|
+
end
|
228
|
+
|
229
|
+
# Delete a client's contact
|
230
|
+
#
|
231
|
+
# Parameters:
|
232
|
+
#
|
233
|
+
# * <tt>:contactid</tt> - The ID of the contact to delete
|
234
|
+
#
|
235
|
+
# See:
|
236
|
+
#
|
237
|
+
# http://wiki.whmcs.com/API:Delete_Contact
|
238
|
+
def self.delete_contact(params = {})
|
239
|
+
params.merge!(:action => 'deletecontact')
|
240
|
+
send_request(params)
|
241
|
+
end
|
242
|
+
|
243
|
+
# Get client's products
|
244
|
+
#
|
245
|
+
# Parameters:
|
246
|
+
#
|
247
|
+
# * <tt>:clientid</tt> - the ID of the client to retrieve products for
|
248
|
+
# * <tt>:serviceid</tt> - the ID of the service to retrieve details for
|
249
|
+
# * <tt>:domain</tt> - the domain of the service to retrieve details for
|
250
|
+
# * <tt>:pid</tt> - the product ID of the services to retrieve products for
|
251
|
+
#
|
252
|
+
# See:
|
253
|
+
#
|
254
|
+
# http://wiki.whmcs.com/API:Get_Clients_Products
|
255
|
+
def self.get_clients_products(params = {})
|
256
|
+
params.merge!(:action => 'getclientsproducts')
|
257
|
+
send_request(params)
|
258
|
+
end
|
259
|
+
|
260
|
+
# Update client's product
|
261
|
+
#
|
262
|
+
# Parameters:
|
263
|
+
#
|
264
|
+
# * <tt>:serviceid</tt> - the ID of the service to be updated
|
265
|
+
# * <tt>:pid</tt>
|
266
|
+
# * <tt>:serverid</tt>
|
267
|
+
# * <tt>:regdate</tt> - Format: YYYY-MM-DD
|
268
|
+
# * <tt>:nextduedate</tt> - Format: YYYY-MM-DD
|
269
|
+
# * <tt>:domain</tt>
|
270
|
+
# * <tt>:firstpaymentamount</tt>
|
271
|
+
# * <tt>:recurringamount</tt>
|
272
|
+
# * <tt>:billingcycle</tt>
|
273
|
+
# * <tt>:paymentmethod</tt>
|
274
|
+
# * <tt>:status</tt>
|
275
|
+
# * <tt>:serviceusername</tt>
|
276
|
+
# * <tt>:servicepassword</tt>
|
277
|
+
# * <tt>:subscriptionid</tt>
|
278
|
+
# * <tt>:promoid</tt>
|
279
|
+
# * <tt>:overideautosuspend</tt> - on/off
|
280
|
+
# * <tt>:overidesuspenduntil</tt> - Format: YYYY-MM-DD
|
281
|
+
# * <tt>:ns1</tt>
|
282
|
+
# * <tt>:ns2</tt>
|
283
|
+
# * <tt>:dedicatedip</tt>
|
284
|
+
# * <tt>:assignedips</tt>
|
285
|
+
# * <tt>:notes</tt>
|
286
|
+
# * <tt>:autorecalc</tt> - pass true to auto set price based on product ID or billing cycle change
|
287
|
+
#
|
288
|
+
# See:
|
289
|
+
#
|
290
|
+
# http://wiki.whmcs.com/API:Update_Client_Product
|
291
|
+
def self.update_client_product(params = {})
|
292
|
+
params.merge!(:action => 'updateclientproduct')
|
293
|
+
send_request(params)
|
294
|
+
end
|
295
|
+
|
296
|
+
# Validate client login info
|
297
|
+
#
|
298
|
+
# Parameters:
|
299
|
+
#
|
300
|
+
# * <tt>:email</tt> - the email address of the user trying to login
|
301
|
+
# * <tt>:password2</tt> - the password they supply for authentication
|
302
|
+
#
|
303
|
+
# See:
|
304
|
+
#
|
305
|
+
# http://wiki.whmcs.com/API:Validate_Login
|
306
|
+
def self.validate_login(params = {})
|
307
|
+
params.merge!(:action => 'validatelogin')
|
308
|
+
send_request(params)
|
309
|
+
end
|
310
|
+
|
311
|
+
# Send email to client
|
312
|
+
#
|
313
|
+
# Parameters:
|
314
|
+
#
|
315
|
+
# * <tt>:messagename</tt> - unique name of the email template to send from WHMCS
|
316
|
+
# * <tt>:id</tt> - related ID number to send message for
|
317
|
+
#
|
318
|
+
# See:
|
319
|
+
#
|
320
|
+
# http://wiki.whmcs.com/API:Send_Email
|
321
|
+
def self.send_email(params = {})
|
322
|
+
params.merge!(:action => 'sendemail')
|
323
|
+
send_request(params)
|
324
|
+
end
|
325
|
+
end
|
326
|
+
end
|
data/lib/whmcs/config.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
module WHMCS
|
2
|
+
# WHMCS::Config stores configuration data for connecting to the WHMCS API
|
3
|
+
class Config
|
4
|
+
# The WHMCS API username
|
5
|
+
attr_accessor :api_username
|
6
|
+
|
7
|
+
# The WHMCS API password
|
8
|
+
attr_accessor :api_password
|
9
|
+
|
10
|
+
# The WHMCS API URL
|
11
|
+
attr_accessor :api_url
|
12
|
+
|
13
|
+
# Create a new config object
|
14
|
+
def initialize
|
15
|
+
@api_username = 'example_api_user'
|
16
|
+
@api_password = 'example_api_pass'
|
17
|
+
@api_url = 'http://example.com/api.php'
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|