cloudstack_client 1.2.2 → 1.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 78dbb44a009c1262105ad07b65cbb9f92c571df6
4
- data.tar.gz: 4fea6765ad36f163af34743ea7878f8ff0275a5b
3
+ metadata.gz: 0921c7eeb5229893005cc11e6910024b0ddb6a9b
4
+ data.tar.gz: 31967afe8b669bc7356fe65e0f529da6c672a6dc
5
5
  SHA512:
6
- metadata.gz: 0daa750d4b5c589411155f350895ea875e7deb2ff405d291d39f389522596f71b4b3b43156e311f513e341fc92a9298cfa4bffeac8b02fdd8e4cbebc75e6e964
7
- data.tar.gz: dfbf9a3ca07346304ad9c6ac4240ebb20a068e6de3a3a9ec05e952dcd3bf92f1681ce4a7c85a7af944c0d73d2abe22bb3472555ef5017a88bd4d50babfd26ca1
6
+ metadata.gz: e758f622732829762ee5cc3b1978183aa5685f1c07bcc574fdfe4157f479327bf11c0161f4288b2ebe7b310431c3d851f51eca320059cdf2a6259d856d18bca6
7
+ data.tar.gz: 368fbf30e876457c9e4db3e9e03c040bb2f7c58688d811f7234f2b14f945911bfc8c60e6b65dc2ed3c282d812abb8db085fa3167e5b733c44a4b66b68848ba97
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cloudstack_client (1.2.1)
4
+ cloudstack_client (1.2.3)
5
5
  multi_json (~> 1.11)
6
6
 
7
7
  GEM
@@ -10,7 +10,7 @@ GEM
10
10
  bond (0.5.1)
11
11
  minitest (5.8.3)
12
12
  multi_json (1.11.2)
13
- rake (10.4.2)
13
+ rake (10.5.0)
14
14
  ripl (0.7.1)
15
15
  bond (~> 0.5.1)
16
16
  thor (0.19.1)
@@ -82,7 +82,7 @@ module CloudstackClient
82
82
 
83
83
  print "cloudstack_client version #{CloudstackClient::VERSION}"
84
84
  puts " (CloudStack API version #{cs_client.api.api_version})"
85
- puts ' try: list_virtual_machines state: "Started"'
85
+ puts " try: list_virtual_machines state: \"running\""
86
86
 
87
87
  ARGV.clear
88
88
  env = options[:env] ? options[:env] : load_configuration.last
@@ -33,8 +33,14 @@ module CloudstackClient
33
33
  params['apiKey'] = @api_key
34
34
 
35
35
  params_arr = params.sort.map do |key, value|
36
- value = CGI.escape(value.to_s).gsub('+', '%20').gsub(' ','%20')
37
- "#{key}=#{value}"
36
+ if value.is_a?(Hash)
37
+ value.each_with_index.map do |(k, v), i|
38
+ "#{key}[#{i}].key=#{escape(k)}&" +
39
+ "#{key}[#{i}].value=#{escape(v)}"
40
+ end.join("&")
41
+ else
42
+ "#{key}=#{escape(value)}"
43
+ end
38
44
  end
39
45
 
40
46
  print_debug_output MultiJson.dump(params, pretty: true) if @debug
@@ -67,7 +73,7 @@ module CloudstackClient
67
73
  "Response from server is not readable. Check if the API endpoint (#{@api_url}) is valid and accessible."
68
74
  end
69
75
 
70
- if response.is_a? Net::HTTPOK
76
+ if response.is_a?(Net::HTTPOK)
71
77
  return body unless body.respond_to?(:keys)
72
78
  if body.size == 2 && body.key?('count')
73
79
  return body.reject { |key, _| key == 'count' }.values.first
@@ -123,5 +129,9 @@ module CloudstackClient
123
129
  (@async_timeout / @async_poll_interval).round
124
130
  end
125
131
 
132
+ def escape(input)
133
+ CGI.escape(input.to_s).gsub('+', '%20').gsub(' ','%20')
134
+ end
135
+
126
136
  end
127
137
  end
@@ -1,3 +1,3 @@
1
1
  module CloudstackClient
2
- VERSION = "1.2.2"
2
+ VERSION = "1.2.3"
3
3
  end
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.2.2
4
+ version: 1.2.3
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-01-10 00:00:00.000000000 Z
11
+ date: 2016-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -134,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
134
134
  version: '0'
135
135
  requirements: []
136
136
  rubyforge_project:
137
- rubygems_version: 2.4.5.1
137
+ rubygems_version: 2.2.2
138
138
  signing_key:
139
139
  specification_version: 4
140
140
  summary: CloudStack API client written in Ruby