whmcs-api 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +7 -0
- data/lib/whmcs/client.rb +4 -2
- data/lib/whmcs/ticket.rb +1 -1
- data/lib/whmcs/version.rb +1 -1
- data/test/test_helper.rb +10 -8
- data/test/whmcs_announcement_test.rb +2 -1
- data/test/whmcs_base_test.rb +13 -0
- data/test/whmcs_client_test.rb +38 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e310528aee10dd2180c9e1067acb69c72275e83
|
4
|
+
data.tar.gz: db713cabc62b949a14d1589a40954773f9826a9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 936dc793990b5cdf3bb8824b95da26b3c6971a5bcb9570c9670f74582c9851a4f4bb898cfdd90319c741f2f1bbe514d7f91c2526adc453cba55cca0483648da9
|
7
|
+
data.tar.gz: 4fa560b7aaa68e4f4b4caddc1a27a991a0e62af0fa8077f9d2faf3a3bd366866b95bdcb6d0f26dde3d6105048daa8581c36ff27c36eb8b2abf0c6f32990d46cc
|
data/Rakefile
CHANGED
@@ -7,6 +7,13 @@ ENV['WHMCS_URL'] = 'http://demo.whmcs.com/includes/api.php'
|
|
7
7
|
ENV['WHMCS_PASS'] = 'fe01ce2a7fbac8fafaed7c982a04e229' #md5('demo')
|
8
8
|
ENV['WHMCS_KEY'] = 'whmcsdemo'
|
9
9
|
|
10
|
+
=begin
|
11
|
+
ENV['WHMCS_USER'] = 'billing_agent'
|
12
|
+
ENV['WHMCS_URL'] = 'http://whmcs-devel.fozzy.com/whmcs/includes/api.php'
|
13
|
+
ENV['WHMCS_PASS'] = '64d34bd61aeb1fa1f5252fe45350b9ff' #md5('demo')
|
14
|
+
ENV['WHMCS_KEY'] = 'iHw7cjwTNt1WQCE44zQGMmjsgR4iLDFeHsLJjXmCubKiwfot4HJa7HO1'
|
15
|
+
=end
|
16
|
+
|
10
17
|
Rake::TestTask.new(:test) do |test|
|
11
18
|
test.libs << 'lib' << 'test' << '.'
|
12
19
|
test.pattern = 'test/**/*_test.rb'
|
data/lib/whmcs/client.rb
CHANGED
@@ -193,9 +193,11 @@ module WHMCS
|
|
193
193
|
#
|
194
194
|
# * <tt>:limitstart</tt> - Record to start at (default = 0)
|
195
195
|
# * <tt>:limitnum</tt> - Number of records to return (default = 25)
|
196
|
-
|
196
|
+
#
|
197
|
+
# Optional attributes:
|
198
|
+
# * <tt>:search</tt> - Can be passed to filter for clients with a name/email matching the term entered
|
197
199
|
#
|
198
|
-
|
200
|
+
# See:
|
199
201
|
#
|
200
202
|
# http://docs.whmcs.com/API:Get_Clients
|
201
203
|
def self.get_clients(params = {})
|
data/lib/whmcs/ticket.rb
CHANGED
@@ -219,7 +219,7 @@ module WHMCS
|
|
219
219
|
# See:
|
220
220
|
#
|
221
221
|
# http://docs.whmcs.com/API:Get_Ticket_Predefined_Replies
|
222
|
-
def self.
|
222
|
+
def self.get_ticket_predefined_replies(params = {})
|
223
223
|
params.merge!(:action => 'getsupportstatuses')
|
224
224
|
send_request(params)
|
225
225
|
end
|
data/lib/whmcs/version.rb
CHANGED
data/test/test_helper.rb
CHANGED
@@ -2,22 +2,24 @@ require 'rubygems'
|
|
2
2
|
require 'test/unit'
|
3
3
|
|
4
4
|
require 'simplecov'
|
5
|
-
require 'coveralls'
|
6
|
-
|
7
|
-
|
8
|
-
SimpleCov.formatter = Coveralls::SimpleCov::Formatter
|
9
|
-
SimpleCov.start do
|
10
|
-
add_filter '/_test.rb/'
|
11
|
-
end
|
5
|
+
#require 'coveralls'
|
12
6
|
|
7
|
+
#SimpleCov.formatter = Coveralls::SimpleCov::Formatter
|
8
|
+
#SimpleCov.start do
|
9
|
+
# add_filter 'test/test_helper'
|
10
|
+
#end
|
13
11
|
#Coveralls.wear!
|
12
|
+
SimpleCov.command_name 'test:units'
|
13
|
+
SimpleCov.start do
|
14
|
+
add_filter 'test/'
|
15
|
+
end
|
14
16
|
|
15
17
|
begin
|
16
18
|
require 'turn'
|
17
19
|
rescue LoadError
|
18
20
|
end
|
19
21
|
|
20
|
-
require 'whmcs'
|
22
|
+
require 'whmcs-api'
|
21
23
|
|
22
24
|
WHMCS.configure do |config|
|
23
25
|
config.api_username = ENV['WHMCS_USER'] or raise "You must set the env variable WHMCS_USER"
|
@@ -10,9 +10,9 @@ class WHMCSAnnouncementTest < Test::Unit::TestCase
|
|
10
10
|
:published => 'off'
|
11
11
|
}
|
12
12
|
|
13
|
-
resulted_announce = WHMCS::Announcement.get_announcements()
|
14
13
|
|
15
14
|
resulted = WHMCS::Announcement.add_announcement( passing_data )
|
15
|
+
resulted_announce = WHMCS::Announcement.get_announcements()
|
16
16
|
|
17
17
|
updated_announcement = WHMCS::Announcement.update_announcement(
|
18
18
|
:announcementid => resulted['announcementid'],
|
@@ -22,6 +22,7 @@ class WHMCSAnnouncementTest < Test::Unit::TestCase
|
|
22
22
|
deleted_announcement = WHMCS::Announcement.delete_announcement(:announcementid => resulted['announcementid'])
|
23
23
|
|
24
24
|
assert_equal('success', updated_announcement['result'])
|
25
|
+
assert_not_equal({}, resulted_announce)
|
25
26
|
assert_equal(resulted['announcementid'], deleted_announcement['announcementid'])
|
26
27
|
assert_equal('success', deleted_announcement['result'])
|
27
28
|
assert_equal('success', resulted['result'])
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require_relative 'test_helper'
|
2
|
+
|
3
|
+
class WHMCSBaseTest < Test::Unit::TestCase
|
4
|
+
# in certain occasions encrypt call returns hash that includes '='
|
5
|
+
def test__passwordEncryption
|
6
|
+
result = WHMCS::Misc.encrypt_password(:password2 => 'test')
|
7
|
+
|
8
|
+
decrypted = WHMCS::Misc.decrypt_password(:password2 => result['password'])
|
9
|
+
|
10
|
+
assert_equal(decrypted['password'], 'test')
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class WhmcsClientTest < Test::Unit::TestCase
|
4
|
+
|
5
|
+
def test__crud_operations_on_client
|
6
|
+
test_data = {
|
7
|
+
:firstname => 'Test',
|
8
|
+
:lastname => 'Testson',
|
9
|
+
:email => 'test@localhost.com',
|
10
|
+
:address1 => 'Test str',
|
11
|
+
:city => 'Test City',
|
12
|
+
:state => 'N/A',
|
13
|
+
:postcode => '12345',
|
14
|
+
:country => 'CY',
|
15
|
+
:phonenumber => '1122334455',
|
16
|
+
:password2 => 'test_pass_123'
|
17
|
+
}
|
18
|
+
|
19
|
+
saved = WHMCS::Client.add_client(test_data)
|
20
|
+
|
21
|
+
if( saved['clientid'] )
|
22
|
+
added_note = WHMCS::Client.add_client_note(:clientid => saved['clientid'], :notes => "TestNote")
|
23
|
+
updated_client = WHMCS::Client.update_client(:clientid => saved['clientid'], :firstname => 'Test13')
|
24
|
+
|
25
|
+
|
26
|
+
closed_client = WHMCS::Client.close_client(:clientid => saved['clientid'])
|
27
|
+
# finally done testing with the client
|
28
|
+
deleted = WHMCS::Client.delete_client(:clientid => saved['clientid'])
|
29
|
+
end
|
30
|
+
|
31
|
+
assert_equal('success', updated_client['result'])
|
32
|
+
assert_equal('success', closed_client['result'])
|
33
|
+
assert_equal('success', added_note['result'])
|
34
|
+
assert_equal('success', saved['result'])
|
35
|
+
assert_not_equal('', saved['clientid'])
|
36
|
+
assert_equal('success', deleted['result'])
|
37
|
+
end
|
38
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: whmcs-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrey Vystavkin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: crack
|
@@ -62,6 +62,8 @@ files:
|
|
62
62
|
- lib/whmcs-api.rb
|
63
63
|
- test/test_helper.rb
|
64
64
|
- test/whmcs_announcement_test.rb
|
65
|
+
- test/whmcs_base_test.rb
|
66
|
+
- test/whmcs_client_test.rb
|
65
67
|
- test/whmcs_test.rb
|
66
68
|
homepage: https://github.com/jujav4ik/whmcs-api
|
67
69
|
licenses: []
|