cloudstack_client 1.3.0 → 1.3.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: 33f88f209142dbb3fb845ae73e5b1c8d873b3bcb
4
- data.tar.gz: fca70d09c0f2879944b0d50b4c7b923e15db7f87
3
+ metadata.gz: 34dba51fe3666605497c2ec7f485717c4a04165a
4
+ data.tar.gz: 7cfebfaa6b48835e4320520c11dd811c87b8d131
5
5
  SHA512:
6
- metadata.gz: 3b5e73dc1f14e4198531f36717541536f0de79081d212a1d488420f22ba1b19a9543cf8367ff741a5776a097e88402275c3fde048a24dfd69b83b126f1bc21ac
7
- data.tar.gz: 5677ee055243e7002ccbfb4114fdbb3694dfa712e7385ccbf35126155824c84f0d3060c35ae19a1f7b6cbd5698c1874898826c71bbfc04e3fec8f810f836edb8
6
+ metadata.gz: 620d683ee029823a04dfb22bcfa154d1fcb06d24d4df61820dee4a21f6b8312e0eef96684e7f2bfb87e0d785245d8f612e49bcedfac27b99a3ee9fd524e73662
7
+ data.tar.gz: 6799dea26324f16af8155b9c9bae6d8f47056901c43dc664accdffcc58c02fdfa8f7e17ed0f2d9aeec4edc319c1e1e1c69977f095d73b72130474e748a5aa3f7
data/.travis.yml CHANGED
@@ -7,7 +7,4 @@ rvm:
7
7
  - 2.3.0
8
8
  before_install:
9
9
  - gem update --system
10
- - gem update bundler
11
- install:
12
- - bundle install --deployment --path vendor/bundle
13
- cache: bundler
10
+ - gem install bundler
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cloudstack_client (1.3.0)
4
+ cloudstack_client (1.3.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,8 +1,10 @@
1
1
  require "zlib"
2
2
  require "json"
3
+ require "cloudstack_client/utils"
3
4
 
4
5
  module CloudstackClient
5
6
  class Api
7
+ include Utils
6
8
 
7
9
  DEFAULT_API_VERSION = "4.5"
8
10
  API_PATH = File.expand_path("../../../data/", __FILE__)
@@ -23,15 +25,14 @@ module CloudstackClient
23
25
  end
24
26
 
25
27
  def command_supported?(command)
26
- @commands.has_key? command
28
+ @commands.has_key? underscore_to_camel_case(command)
27
29
  end
28
30
 
29
31
  def command_supports_param?(command, key)
30
- if @commands[command]["params"].detect { |p| p["name"] == key }
31
- true
32
- else
33
- false
34
- end
32
+ command = underscore_to_camel_case(command)
33
+ @commands[command]["params"].detect do |params|
34
+ params["name"] == key.to_s
35
+ end ? true : false
35
36
  end
36
37
 
37
38
  def required_params(command)
@@ -8,6 +8,15 @@ module CloudstackClient
8
8
  tr("-", "_").downcase
9
9
  end
10
10
 
11
+ def underscore_to_camel_case(underscore)
12
+ if underscore.include? "_"
13
+ string = underscore.split('_').collect(&:capitalize).join
14
+ string[0].downcase + string[1..-1]
15
+ else
16
+ underscore
17
+ end
18
+ end
19
+
11
20
  def print_debug_output(output, seperator = '-' * 80)
12
21
  puts
13
22
  puts seperator
@@ -15,6 +24,6 @@ module CloudstackClient
15
24
  puts seperator
16
25
  puts
17
26
  end
18
-
27
+
19
28
  end
20
29
  end
@@ -1,3 +1,3 @@
1
1
  module CloudstackClient
2
- VERSION = "1.3.0"
2
+ VERSION = "1.3.1"
3
3
  end
data/test/api_test.rb CHANGED
@@ -52,13 +52,25 @@ describe CloudstackClient::Api do
52
52
  @api.command_supported?('listVirtualMachines').must_equal true
53
53
  end
54
54
 
55
+ it "must respond positively for 'list_virtual_machines'" do
56
+ @api.command_supported?('list_virtual_machines').must_equal true
57
+ end
58
+
55
59
  it "must respond positively for 'createUser'" do
56
60
  @api.command_supported?('createUser').must_equal true
57
61
  end
58
62
 
63
+ it "must respond positively for 'create_user'" do
64
+ @api.command_supported?('create_user').must_equal true
65
+ end
66
+
59
67
  it "must respond netagively for 'listClowns'" do
60
68
  @api.command_supported?('listClowns').must_equal false
61
69
  end
70
+
71
+ it "must respond netagively for 'list_clowns'" do
72
+ @api.command_supported?('list_clowns').must_equal false
73
+ end
62
74
  end
63
75
 
64
76
  describe "when asked about supported params" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudstack_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nik Wolfgramm
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-20 00:00:00.000000000 Z
11
+ date: 2016-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake