cloudstack_api 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cloudstack/api.rb +6 -6
- data/lib/cloudstack/version.rb +1 -1
- data/test/api_test.rb +6 -0
- data/test/dummy/log/test.log +30 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d0179b1289f4e567a079e7565888d294ae20a26b
|
4
|
+
data.tar.gz: 6cf313b6bb31a92739a837e22e169221837d54ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1ad07f9385a5642879efd7f8df183ad84c324234ad6936d9b289d42718be6297ab547013fd42093e956a6ee4c125bb967ac846aeb2fbe15afa843eca9f027c9
|
7
|
+
data.tar.gz: 803a9da578f5a57b3e101d68e22976f19c74a4c9891761a9f9e040545cff22fdcaa0628dae7a3a49c99cc8de7f611fa46b4791db4ac2b207be4c95cb12a7893c
|
data/lib/cloudstack/api.rb
CHANGED
@@ -149,15 +149,15 @@ module Cloudstack
|
|
149
149
|
# If command or parameters is invalid, then corresponding error will be
|
150
150
|
# added to #errors
|
151
151
|
def validate_api_params
|
152
|
-
#
|
153
|
-
|
154
|
-
|
155
|
-
# if no parameters for current command then command is incorrect
|
156
|
-
unless allowed_params.present?
|
157
|
-
errors.add(:command, "'#{@command}' is invalid command")
|
152
|
+
# validate command
|
153
|
+
unless Cloudstack.config.commands.include? @command
|
154
|
+
errors.add(:command, "#{@command} is invalid command")
|
158
155
|
return
|
159
156
|
end
|
160
157
|
|
158
|
+
# retrieve parameters that belongs
|
159
|
+
allowed_params = Cloudstack.config.command_params(@command)
|
160
|
+
|
161
161
|
# each parameter name should be in allowed parameters for current command
|
162
162
|
(@params.keys - allowed_params).each do |param|
|
163
163
|
errors.add(:params, "'#{param}' parameter is not allowed")
|
data/lib/cloudstack/version.rb
CHANGED
data/test/api_test.rb
CHANGED
@@ -49,6 +49,12 @@ class ApiTest < ActiveSupport::TestCase
|
|
49
49
|
@api.execute_command!('deployVirtualMachine', serviceofferingid: '1bd9a980-0f11-4892-aa0b-7c434dbd6d1c')
|
50
50
|
end
|
51
51
|
assert_match 'required', @api.errors[:params].to_s
|
52
|
+
|
53
|
+
# call command whichi do not contain params
|
54
|
+
assert_nothing_raised do
|
55
|
+
@api.execute_command!('listEventTypes')
|
56
|
+
end
|
57
|
+
assert @api.errors.messages.size == 0
|
52
58
|
end
|
53
59
|
|
54
60
|
test 'should check curl errors' do
|
data/test/dummy/log/test.log
CHANGED
@@ -701,5 +701,35 @@ ApiTest: test_should_check_api_parameters_validation
|
|
701
701
|
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
702
702
|
--------------------------------------
|
703
703
|
ApiTest: test_should_check_curl_errors
|
704
|
+
--------------------------------------
|
705
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
706
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
707
|
+
---------------------------------------------------------------------
|
708
|
+
ApiTest: test_api_should_request_same_url_regardless_parameters_types
|
709
|
+
---------------------------------------------------------------------
|
710
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
711
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
712
|
+
----------------------------------------------------
|
713
|
+
ApiTest: test_should_check_api_parameters_validation
|
714
|
+
----------------------------------------------------
|
715
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
716
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
717
|
+
--------------------------------------
|
718
|
+
ApiTest: test_should_check_curl_errors
|
719
|
+
--------------------------------------
|
720
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
721
|
+
[1m[36m (0.2ms)[0m [1mbegin transaction[0m
|
722
|
+
---------------------------------------------------------------------
|
723
|
+
ApiTest: test_api_should_request_same_url_regardless_parameters_types
|
724
|
+
---------------------------------------------------------------------
|
725
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
726
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
727
|
+
----------------------------------------------------
|
728
|
+
ApiTest: test_should_check_api_parameters_validation
|
729
|
+
----------------------------------------------------
|
730
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
731
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
732
|
+
--------------------------------------
|
733
|
+
ApiTest: test_should_check_curl_errors
|
704
734
|
--------------------------------------
|
705
735
|
[1m[35m (0.1ms)[0m rollback transaction
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudstack_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bogdan Guban
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09-
|
11
|
+
date: 2014-09-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|