cloudstack_helper 0.3 → 0.4

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.
data/README.md CHANGED
@@ -4,6 +4,7 @@ cloudstack_helper is a simple ruby library that helps making request to CloudSta
4
4
  ## Library Usage
5
5
 
6
6
  ```ruby
7
+ require 'rubygems'
7
8
  require 'cloudstack_helper'
8
9
 
9
10
  API_URL = "http://mycloudstack:8080/client/api"
@@ -12,10 +13,17 @@ cloudstack_helper is a simple ruby library that helps making request to CloudSta
12
13
  cs_helper = CloudStackHelper.new(:api_key => API_KEY, :secret_key => SECRET_KEY, :api_url => API_URL)
13
14
 
14
15
  params = {:command => "listZones"}
15
- puts cs_helper.get(params).body
16
+ result = cs_helper.get(params).body
17
+ puts result
16
18
 
17
19
  params[:response] = "json"
18
- puts cs_helper.get(params).body
20
+ result = cs_helper.get(params).body
21
+ puts result
22
+
23
+ params.merge!({:command => 'deployVirtualMachine', :serviceofferingid => 12, :templateid => 4, :zoneid => 1, :displayname => 'my shiny vm'})
24
+ result = cs_helper.get(params).body
25
+ puts result
26
+
19
27
  ```
20
28
 
21
29
  ## Script Usage
@@ -35,10 +43,11 @@ cloudstack_helper is a simple ruby library that helps making request to CloudSta
35
43
  ```
36
44
 
37
45
  ####Configuration
38
- By default, if you don't specify a config file, cloudstack_rb assumes there is a config file in the current working directory under the name 'cloudstack.yaml'
46
+ By default, if you don't specify a config file, cloudstack_rb assumes there is a config file in the current working directory under the name 'cloudstack.yml'
39
47
  The config file should look like this
48
+
40
49
  ```
41
50
  api_url: "http://mycloudstack:8080/client/api"
42
51
  api_key: "WiUVlx74PpVE8w7z7J7gtojiOQasdaFL3A054D_IPeSxxcm1PadgasdgujGSJBGiS2uBcG0GoLwLisosDCA"
43
52
  secret_key: "uqzgrfMXnYSVvUiasdgj0DgvtXBemILs_npqi90Ki0xigOKjagvQTtYg093EUrHSLZJEnI3lV1z9PrQmv2SxQ"
44
- ````
53
+ ```
@@ -4,7 +4,7 @@ $LOAD_PATH.push File.expand_path("../lib", __FILE__)
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "cloudstack_helper"
7
- s.version = "0.3"
7
+ s.version = "0.4"
8
8
  s.platform = Gem::Platform::RUBY
9
9
  s.authors = ["Darren Dao"]
10
10
  s.email = ["darrendao@gmail.com"]
@@ -27,7 +27,7 @@ class CloudStackHelper
27
27
  # with the user’s Secret Key.
28
28
  # 4. Base64 encode the resulting byte array in UTF-8 so that it can be safely transmitted via HTTP.
29
29
  def generate_signature(params)
30
- params.each { |k,v| params[k] = CGI.escape(v).gsub('+', '%20').downcase }
30
+ params.each { |k,v| params[k] = CGI.escape(v.to_s).gsub('+', '%20').downcase }
31
31
  sorted_params = params.sort_by{|key,value| key.to_s}
32
32
 
33
33
  data = parameterize(sorted_params, false)
metadata CHANGED
@@ -1,12 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudstack_helper
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 3
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 3
9
- version: "0.3"
8
+ - 4
9
+ version: "0.4"
10
10
  platform: ruby
11
11
  authors:
12
12
  - Darren Dao