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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1a71fad5fd898a7b1c3660a34b5c9eb251049ebb
4
- data.tar.gz: 3045b355845b58ccb21352d8f394cff175a0a921
3
+ metadata.gz: d0179b1289f4e567a079e7565888d294ae20a26b
4
+ data.tar.gz: 6cf313b6bb31a92739a837e22e169221837d54ff
5
5
  SHA512:
6
- metadata.gz: 864c0045e465200e2e5b6b41706b5c8dfbfd6aedc630a552f2b4c29d833531db344d3a0b624e8373855b56276c76ef19470886ac93f6092c79d0aa852df59467
7
- data.tar.gz: c8f27faf0e8175c605f32435fd2b4f17886e5c11cc18ceda50d829099e6b3067b62e465885b0ac16ba8ac2426de7ab37fb71f9aee61807b4da687a7ade358cff
6
+ metadata.gz: d1ad07f9385a5642879efd7f8df183ad84c324234ad6936d9b289d42718be6297ab547013fd42093e956a6ee4c125bb967ac846aeb2fbe15afa843eca9f027c9
7
+ data.tar.gz: 803a9da578f5a57b3e101d68e22976f19c74a4c9891761a9f9e040545cff22fdcaa0628dae7a3a49c99cc8de7f611fa46b4791db4ac2b207be4c95cb12a7893c
@@ -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
- # retrieve parameters that belongs
153
- allowed_params = Cloudstack.config.command_params(@command)
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")
@@ -1,3 +1,3 @@
1
1
  module Cloudstack
2
- VERSION = '1.0.0'
2
+ VERSION = '1.0.1'
3
3
  end
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
@@ -701,5 +701,35 @@ ApiTest: test_should_check_api_parameters_validation
701
701
   (0.1ms) begin transaction
702
702
  --------------------------------------
703
703
  ApiTest: test_should_check_curl_errors
704
+ --------------------------------------
705
+  (0.1ms) rollback transaction
706
+  (0.1ms) begin transaction
707
+ ---------------------------------------------------------------------
708
+ ApiTest: test_api_should_request_same_url_regardless_parameters_types
709
+ ---------------------------------------------------------------------
710
+  (0.1ms) rollback transaction
711
+  (0.1ms) begin transaction
712
+ ----------------------------------------------------
713
+ ApiTest: test_should_check_api_parameters_validation
714
+ ----------------------------------------------------
715
+  (0.1ms) rollback transaction
716
+  (0.1ms) begin transaction
717
+ --------------------------------------
718
+ ApiTest: test_should_check_curl_errors
719
+ --------------------------------------
720
+  (0.1ms) rollback transaction
721
+  (0.2ms) begin transaction
722
+ ---------------------------------------------------------------------
723
+ ApiTest: test_api_should_request_same_url_regardless_parameters_types
724
+ ---------------------------------------------------------------------
725
+  (0.1ms) rollback transaction
726
+  (0.1ms) begin transaction
727
+ ----------------------------------------------------
728
+ ApiTest: test_should_check_api_parameters_validation
729
+ ----------------------------------------------------
730
+  (0.1ms) rollback transaction
731
+  (0.1ms) begin transaction
732
+ --------------------------------------
733
+ ApiTest: test_should_check_curl_errors
704
734
  --------------------------------------
705
735
   (0.1ms) 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.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-10 00:00:00.000000000 Z
11
+ date: 2014-09-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails