cloudstack_ruby_client 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -55,6 +55,8 @@ begin
55
55
  end
56
56
  rescue ArgumentError => e
57
57
  puts "#{e.to_s}"
58
+ rescue CloudstackRubyClient::RequestError => e
59
+ puts "Error #{e.response.code}: #{JSON.pretty_generate(e.json)}"
58
60
  rescue RuntimeError => e
59
61
  puts "Oops! something bad happened. Please try again"
60
62
  rescue
@@ -37,7 +37,8 @@ module CloudstackRubyClient
37
37
  :update_host,
38
38
  :delete_host,
39
39
  :dedicate_host,
40
- :reconnect_host
40
+ :reconnect_host,
41
+ :add_secondary_storage
41
42
  end
42
43
  end
43
- end
44
+ end
@@ -1,3 +1,12 @@
1
+ class CloudstackRubyClient::RequestError < RuntimeError
2
+ attr_reader :response, :json
3
+
4
+ def initialize(response, json)
5
+ @response = response
6
+ @json = json
7
+ end
8
+ end
9
+
1
10
  class CloudstackRubyClient::Client < CloudstackRubyClient::BaseClient
2
11
 
3
12
  @@API_LIST = []
@@ -51,10 +60,8 @@ class CloudstackRubyClient::Client < CloudstackRubyClient::BaseClient
51
60
  end
52
61
 
53
62
  raise RuntimeError, json['errorresponse']['errortext'] if response.code == "432"
54
-
55
- puts 'Error ' + response.code + ':'
56
- puts JSON.pretty_generate(json)
57
- exit 1
63
+
64
+ raise CloudstackRubyClient::RequestError.new(response, json)
58
65
  end
59
66
 
60
67
  json[resp_title]
@@ -90,9 +90,7 @@ class Module
90
90
 
91
91
  raise RuntimeError, json['errorresponse']['errortext'] if response.code == "432"
92
92
 
93
- puts 'Error ' + response.code + ':'
94
- puts JSON.pretty_generate(json)
95
- exit 1
93
+ raise CloudstackRubyClient::RequestError.new(response, json)
96
94
  end
97
95
 
98
96
  json[resp_title]
@@ -1,3 +1,3 @@
1
1
  module CloudstackRubyClient
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,33 +1,24 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: cloudstack_ruby_client
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 2
8
- - 0
9
- version: 0.2.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.1
5
+ prerelease:
10
6
  platform: ruby
11
- authors:
7
+ authors:
12
8
  - Chip Childers
13
9
  autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
-
17
- date: 2013-08-26 00:00:00 -04:00
18
- default_executable:
12
+ date: 2013-09-23 00:00:00.000000000 Z
19
13
  dependencies: []
20
-
21
14
  description: A Ruby client for CloudStack's API, including a simple CLI.
22
- email:
15
+ email:
23
16
  - chip.childers@gmail.com
24
- executables:
17
+ executables:
25
18
  - cloudstack_ruby_client
26
19
  extensions: []
27
-
28
20
  extra_rdoc_files: []
29
-
30
- files:
21
+ files:
31
22
  - .gitignore
32
23
  - Gemfile
33
24
  - LICENSE
@@ -77,37 +68,31 @@ files:
77
68
  - test/unit/template_test.rb
78
69
  - test/unit/vm_test.rb
79
70
  - test/unit/volume_test.rb
80
- has_rdoc: true
81
71
  homepage: http://chipchilders.github.io/cloudstack_ruby_client/
82
72
  licenses: []
83
-
84
73
  post_install_message:
85
74
  rdoc_options: []
86
-
87
- require_paths:
75
+ require_paths:
88
76
  - lib
89
- required_ruby_version: !ruby/object:Gem::Requirement
90
- requirements:
91
- - - ">="
92
- - !ruby/object:Gem::Version
93
- segments:
94
- - 0
95
- version: "0"
96
- required_rubygems_version: !ruby/object:Gem::Requirement
97
- requirements:
98
- - - ">="
99
- - !ruby/object:Gem::Version
100
- segments:
101
- - 0
102
- version: "0"
77
+ required_ruby_version: !ruby/object:Gem::Requirement
78
+ none: false
79
+ requirements:
80
+ - - ! '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ required_rubygems_version: !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - ! '>='
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
103
89
  requirements: []
104
-
105
90
  rubyforge_project:
106
- rubygems_version: 1.3.6
91
+ rubygems_version: 1.8.24
107
92
  signing_key:
108
93
  specification_version: 3
109
94
  summary: A Ruby client for CloudStack's API.
110
- test_files:
95
+ test_files:
111
96
  - test/config.yml
112
97
  - test/integration/client_test.rb
113
98
  - test/unit/accounts_test.rb