squall 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Justin Mazzi
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,17 @@
1
+ = squall
2
+
3
+ Description goes here.
4
+
5
+ == Note on Patches/Pull Requests
6
+
7
+ * Fork the project.
8
+ * Make your feature addition or bug fix.
9
+ * Add tests for it. This is important so I don't break it in a
10
+ future version unintentionally.
11
+ * Commit, do not mess with rakefile, version, or history.
12
+ (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
13
+ * Send me a pull request. Bonus points for topic branches.
14
+
15
+ == Copyright
16
+
17
+ Copyright (c) 2010 Justin Mazzi. See LICENSE for details.
data/Rakefile ADDED
@@ -0,0 +1,55 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "squall"
8
+ gem.summary = %Q{A Ruby library for working with the OnApp REST API}
9
+ gem.description = %Q{A Ruby library for working with the OnApp REST API}
10
+ gem.email = "jmazzi@site5.com"
11
+ gem.homepage = "http://github.com/site5/squall"
12
+ gem.authors = ["Justin Mazzi"]
13
+ gem.add_dependency 'rest-client'
14
+ gem.add_dependency 'json'
15
+ gem.add_development_dependency 'fakeweb'
16
+ gem.add_development_dependency 'redgreen'
17
+ end
18
+ Jeweler::GemcutterTasks.new
19
+ rescue LoadError
20
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
21
+ end
22
+
23
+ require 'rake/testtask'
24
+ Rake::TestTask.new(:test) do |test|
25
+ test.libs << 'lib' << 'test'
26
+ test.pattern = 'test/**/test_*.rb'
27
+ test.verbose = true
28
+ end
29
+
30
+ begin
31
+ require 'rcov/rcovtask'
32
+ Rcov::RcovTask.new do |test|
33
+ test.libs << 'test'
34
+ test.pattern = 'test/**/test_*.rb'
35
+ test.verbose = true
36
+ end
37
+ rescue LoadError
38
+ task :rcov do
39
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
40
+ end
41
+ end
42
+
43
+ task :test => :check_dependencies
44
+
45
+ task :default => :test
46
+
47
+ require 'rake/rdoctask'
48
+ Rake::RDocTask.new do |rdoc|
49
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
50
+
51
+ rdoc.rdoc_dir = 'rdoc'
52
+ rdoc.title = "squall #{version}"
53
+ rdoc.rdoc_files.include('README*')
54
+ rdoc.rdoc_files.include('lib/**/*.rb')
55
+ end
data/VERSION.yml ADDED
@@ -0,0 +1,5 @@
1
+ ---
2
+ :patch: 1
3
+ :build:
4
+ :major: 0
5
+ :minor: 0
@@ -0,0 +1,85 @@
1
+ module Squall
2
+ class Client
3
+
4
+ attr_reader :successful, :request, :response, :result, :message
5
+
6
+ def initialize
7
+ @default_options = {:accept => :json, :content_type => 'application/json'}
8
+ @debug = false
9
+ end
10
+
11
+ def toggle_debug
12
+ if @debug
13
+ @debug = false
14
+ RestClient.log = nil
15
+ else
16
+ @debug = true
17
+ RestClient.log = STDERR
18
+ end
19
+ end
20
+
21
+ def get(uri)
22
+ RestClient.get("#{uri_with_auth}/#{uri}.json", @default_options) { |_response, _request, _result|
23
+ handle_response _response, _request, _result
24
+ }
25
+ end
26
+
27
+ def post(uri, params = {})
28
+ RestClient.post("#{uri_with_auth}/#{uri}.json", params.to_json, @default_options) { |_response, _request, _result|
29
+ handle_response _response, _request, _result
30
+ }
31
+ end
32
+
33
+ def put(uri, params = {})
34
+ RestClient.put("#{uri_with_auth}/#{uri}.json", params.to_json, @default_options) { |_response, _request, _result|
35
+ handle_response _response, _request, _result
36
+ }
37
+ end
38
+
39
+ def delete(uri)
40
+ RestClient.delete("#{uri_with_auth}/#{uri}.json", @default_options) { |_response, _request, _result|
41
+ handle_response _response, _request, _result
42
+ }
43
+ end
44
+
45
+ private
46
+
47
+ def required_options!(required, actual)
48
+ required = required
49
+ actual = actual.keys
50
+ missing_keys = required - [actual].flatten
51
+ raise(ArgumentError, "Missing key(s): #{missing_keys.join(", ")}") unless missing_keys.empty?
52
+ end
53
+
54
+ def valid_options!(accepted, actual)
55
+ unknown_keys = actual.keys - accepted
56
+ raise(ArgumentError, "Unknown key(s): #{unknown_keys.join(", ")}") unless unknown_keys.empty?
57
+ end
58
+
59
+ def uri_with_auth
60
+ uri = Squall.api_endpoint
61
+ protocol = uri.port == 443 ? 'https' : 'http'
62
+ "#{protocol}://#{Squall.api_user}:#{Squall.api_password}@#{uri.host}#{uri.path}"
63
+ end
64
+
65
+ def handle_response(_response, _request, _result)
66
+ @request = _request
67
+ @result = _result
68
+ @response = _response
69
+ @successful = (200..207).include?(_response.code)
70
+
71
+ case _response.code
72
+ when 404
73
+ @message = "404 Not Found"
74
+ when 403
75
+ @message = "Action is not permitted for that account"
76
+ when 422
77
+ @message = "Request Failed: #{@response}"
78
+ else
79
+ @message = (_response.strip.empty? ? _response : JSON.parse(_response))
80
+ _response.return!
81
+ end
82
+ @successful
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,30 @@
1
+ module Squall
2
+ class Hypervisor < Client
3
+
4
+ URI_PREFIX = 'settings/hypervisors'
5
+
6
+ def list
7
+ if get(URI_PREFIX)
8
+ @message.collect { |res| res['hypervisor'] }
9
+ else
10
+ []
11
+ end
12
+ end
13
+
14
+ def show(id)
15
+ get("#{URI_PREFIX}/#{id}") ? @response['hypervisor'] : false
16
+ end
17
+
18
+ def create(params = {})
19
+ required = { :ip_address, :label }
20
+ required_options!(required, params)
21
+ post(URI_PREFIX, { :hypervisor => params })
22
+ @response.code == 201
23
+ end
24
+
25
+ def destroy(id)
26
+ delete("#{URI_PREFIX}/#{id}")
27
+ end
28
+
29
+ end
30
+ end
@@ -0,0 +1,64 @@
1
+ module Squall
2
+ class VirtualMachine < Client
3
+
4
+ URI_PREFIX = 'virtual_machines'
5
+
6
+ def list
7
+ if get(URI_PREFIX)
8
+ @message.collect { |res| res['virtual_machine'] }
9
+ else
10
+ []
11
+ end
12
+ end
13
+
14
+ def show(id)
15
+ get("#{URI_PREFIX}/#{id}") ? @message['virtual_machine'] : false
16
+ end
17
+
18
+ def edit(id, params = {})
19
+ valid = [ :primary_network_id,
20
+ :cpus,
21
+ :label,
22
+ :cpu_shares,
23
+ :template_id,
24
+ :swap_disk_size,
25
+ :memory,
26
+ :required_virtual_machine_build,
27
+ :hypervisor_id,
28
+ :required_ip_address_assignment,
29
+ :rate_limit,
30
+ :primary_disk_size,
31
+ :hostname,
32
+ :initial_root_password,
33
+ :reboot ]
34
+
35
+ valid_options!(valid, params)
36
+
37
+ reboot_after = params.delete(:reboot)
38
+ update_request = put("#{URI_PREFIX}/#{id}", { :virtual_machine => params })
39
+ reboot(id) if reboot_after
40
+ update_request
41
+ end
42
+
43
+ def create(params = {})
44
+ required = [ :memory, :cpus, :label, :template_id, :hypervisor_id, :initial_root_password ]
45
+ required_options!(required, params)
46
+ post(URI_PREFIX, { :virtual_machine => params })
47
+ end
48
+
49
+ def destroy(id)
50
+ delete("#{URI_PREFIX}/#{id}")
51
+ end
52
+
53
+ def reboot(id)
54
+ post("#{URI_PREFIX}/#{id}/reboot")
55
+ end
56
+
57
+ def search(pattern, *fields)
58
+ fields = [:label] if fields.nil?
59
+ list.select do |vm|
60
+ fields.detect { |field| vm[field.to_s].match(/#{pattern}/) }
61
+ end
62
+ end
63
+ end
64
+ end
data/lib/squall.rb ADDED
@@ -0,0 +1,26 @@
1
+ require 'rubygems'
2
+ require 'json'
3
+ require 'rest_client'
4
+ require 'open-uri'
5
+
6
+ [:client, :virtual_machine, :hypervisor].each do |f|
7
+ require File.join(File.dirname(__FILE__), 'squall', f.to_s)
8
+ end
9
+
10
+ module Squall
11
+ class << self
12
+
13
+ # Sepcifies the login and url for making requests
14
+ #
15
+ # example:
16
+ #
17
+ # Squall.config(api_user, api_password, api_url)
18
+ #
19
+ attr_accessor :api_endpoint, :api_user, :api_password
20
+ def config(api_user, api_password, api_url)
21
+ @api_user = api_user
22
+ @api_password = api_password
23
+ @api_endpoint = URI.parse(api_url)
24
+ end
25
+ end
26
+ end
data/squall.gemspec ADDED
@@ -0,0 +1,69 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{squall}
8
+ s.version = "0.0.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Justin Mazzi"]
12
+ s.date = %q{2010-11-17}
13
+ s.description = %q{A Ruby library for working with the OnApp REST API}
14
+ s.email = %q{jmazzi@site5.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ "LICENSE",
22
+ "README.rdoc",
23
+ "Rakefile",
24
+ "VERSION.yml",
25
+ "lib/squall.rb",
26
+ "lib/squall/client.rb",
27
+ "lib/squall/hypervisor.rb",
28
+ "lib/squall/virtual_machine.rb",
29
+ "squall.gemspec",
30
+ "test/fixtures/virtual_machines.json",
31
+ "test/helper.rb",
32
+ "test/test_client.rb",
33
+ "test/test_squall.rb",
34
+ "test/test_virtual_machine.rb"
35
+ ]
36
+ s.homepage = %q{http://github.com/site5/squall}
37
+ s.require_paths = ["lib"]
38
+ s.rubygems_version = %q{1.3.7}
39
+ s.summary = %q{A Ruby library for working with the OnApp REST API}
40
+ s.test_files = [
41
+ "test/helper.rb",
42
+ "test/test_client.rb",
43
+ "test/test_squall.rb",
44
+ "test/test_virtual_machine.rb"
45
+ ]
46
+
47
+ if s.respond_to? :specification_version then
48
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
49
+ s.specification_version = 3
50
+
51
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
52
+ s.add_runtime_dependency(%q<rest-client>, [">= 0"])
53
+ s.add_runtime_dependency(%q<json>, [">= 0"])
54
+ s.add_development_dependency(%q<fakeweb>, [">= 0"])
55
+ s.add_development_dependency(%q<redgreen>, [">= 0"])
56
+ else
57
+ s.add_dependency(%q<rest-client>, [">= 0"])
58
+ s.add_dependency(%q<json>, [">= 0"])
59
+ s.add_dependency(%q<fakeweb>, [">= 0"])
60
+ s.add_dependency(%q<redgreen>, [">= 0"])
61
+ end
62
+ else
63
+ s.add_dependency(%q<rest-client>, [">= 0"])
64
+ s.add_dependency(%q<json>, [">= 0"])
65
+ s.add_dependency(%q<fakeweb>, [">= 0"])
66
+ s.add_dependency(%q<redgreen>, [">= 0"])
67
+ end
68
+ end
69
+
@@ -0,0 +1 @@
1
+ [{"virtual_machine":{"label":"label1","cpus":2,"operating_system_distro":"rhel","created_at":"2010-11-16T17:37:23Z","template_id":9,"operating_system":"linux","cpu_shares":16,"updated_at":"2010-11-16T17:37:23Z","memory":512,"local_remote_access_port":null,"allowed_swap":true,"recovery_mode":null,"allow_resize_without_reboot":true,"xen_id":null,"id":39,"hypervisor_id":1,"total_disk_size":6,"ip_addresses":[],"user_id":5,"template_label":null,"hostname":"label1.example.com","booted":false,"monthly_bandwidth_used":0,"remote_access_password":null,"min_disk_size":5,"initial_root_password":"password1","identifier":"blahblah1","locked":false,"built":false}},{"virtual_machine":{"label":"label2","cpus":2,"operating_system_distro":"rhel","created_at":"2010-11-16T17:37:23Z","template_id":9,"operating_system":"linux","cpu_shares":16,"updated_at":"2010-11-16T17:37:23Z","memory":512,"local_remote_access_port":null,"allowed_swap":true,"recovery_mode":null,"allow_resize_without_reboot":true,"xen_id":null,"id":40,"hypervisor_id":1,"total_disk_size":6,"ip_addresses":[],"user_id":5,"template_label":null,"hostname":"label2.example.com","booted":false,"monthly_bandwidth_used":0,"remote_access_password":null,"min_disk_size":5,"initial_root_password":"password2","identifier":"blahblah2","locked":false,"built":false}}]
data/test/helper.rb ADDED
@@ -0,0 +1,31 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+ require 'redgreen'
4
+
5
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
6
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
7
+
8
+ require 'squall'
9
+ require 'fakeweb'
10
+
11
+ class Test::Unit::TestCase
12
+
13
+ def setup
14
+ FakeWeb.allow_net_connect = false
15
+ FakeWeb.clean_registry
16
+ Squall.config('user', 'stupidpass', 'http://example.com/onapp')
17
+ end
18
+
19
+ def uri_with_login
20
+ "http://#{Squall.api_user}:#{Squall.api_password}@#{Squall.api_endpoint.host}#{Squall.api_endpoint.path}"
21
+ end
22
+
23
+ def stub_json_request(meth, uri, content = nil)
24
+ content = File.read(File.join(File.dirname(__FILE__), "fixtures/#{uri}.json")) if content.nil?
25
+ fake_response = Net::HTTPOK.new('1.1', '200', 'OK')
26
+ fake_response['Content-Type'] = 'application/json'
27
+ fake_response.instance_variable_set('@body', content)
28
+ FakeWeb.register_uri(meth, "#{uri_with_login}/#{uri}.json", :content_type => 'application/json', :response => fake_response)
29
+ end
30
+
31
+ end
@@ -0,0 +1,152 @@
1
+ require File.dirname(__FILE__) + '/helper'
2
+
3
+ class TestClient < Test::Unit::TestCase
4
+
5
+ def setup
6
+ super
7
+ @client = Squall::Client.new
8
+ assert_defaults
9
+ end
10
+
11
+ def test_init
12
+ default_options = {:accept => :json, :content_type => 'application/json'}
13
+ assert_equal default_options, @client.instance_variable_get('@default_options')
14
+ assert_equal false, @client.instance_variable_get('@debug')
15
+ assert_nil defined?(Squall::Client::URI_PREFIX)
16
+ end
17
+
18
+ def test_debug
19
+ assert_nil RestClient.log
20
+ assert_equal false, @client.instance_variable_get('@debug')
21
+
22
+ @client.toggle_debug
23
+ assert_equal true, @client.instance_variable_get('@debug')
24
+ assert_equal STDERR, RestClient.log
25
+
26
+ @client.toggle_debug
27
+ assert_nil RestClient.log
28
+ assert_equal false, @client.instance_variable_get('@debug')
29
+ end
30
+
31
+ def test_get
32
+ stub_json_request(:get, 'test_get', '["test"]')
33
+ @client.get('test_get')
34
+
35
+ assert_equal :get, @client.request.method
36
+ end
37
+
38
+ def test_post
39
+ stub_json_request(:post, 'test_post', '["test"]')
40
+ @client.post('test_post')
41
+ assert_equal :post, @client.request.method
42
+ end
43
+
44
+ def test_put
45
+ stub_json_request(:put, 'test_put', '["test"]')
46
+ @client.put('test_put')
47
+ assert_equal :put, @client.request.method
48
+ end
49
+
50
+ def test_delete
51
+ stub_json_request(:delete, 'test_delete', '["test"]')
52
+ @client.delete('test_delete')
53
+ assert_equal :delete, @client.request.method
54
+ end
55
+
56
+ def test_required_options
57
+ assert_nothing_raised do
58
+ required_options = [:one, :two, :three]
59
+ actual_options = {:one => 1, :two => 2, :three => 3}
60
+ @client.send(:required_options!, required_options, actual_options)
61
+ end
62
+
63
+ assert_nothing_raised do
64
+ required_options = [:one, :two, :three]
65
+ actual_options = {:one => 1, :two => 2, :three => 3, :four => 4}
66
+ @client.send(:required_options!, required_options, actual_options)
67
+ end
68
+
69
+ e = assert_raises ArgumentError do
70
+ required_options = [:one, :two, :three]
71
+ actual_options = {:one => 1 }
72
+ @client.send(:required_options!, required_options, actual_options)
73
+ end
74
+ assert_match /Missing key\(s\): two, three/, e.message
75
+ end
76
+
77
+ def test_valid_options
78
+ assert_nothing_raised do
79
+ accepted = [:one, :two]
80
+ actual = {:one => 1, :two => 2}
81
+ @client.send(:valid_options!, accepted, actual)
82
+ end
83
+
84
+ e = assert_raises ArgumentError do
85
+ accepted = [:one, :two]
86
+ actual = {:one => 1, :two => 2, :three => 3}
87
+ @client.send(:valid_options!, accepted, actual)
88
+ end
89
+ assert_match /Unknown key\(s\): three/, e.message
90
+ end
91
+
92
+ def test_uri_with_auth
93
+ assert_equal "http://user:stupidpass@example.com/onapp", @client.send(:uri_with_auth)
94
+
95
+ Squall.config('user', 'stupidpass', 'example.com/onapp')
96
+ assert_equal "http://user:stupidpass@example.com/onapp", @client.send(:uri_with_auth)
97
+
98
+ Squall.config('user', 'stupidpass', 'https://example.com/onapp')
99
+ assert_equal "https://user:stupidpass@example.com/onapp", @client.send(:uri_with_auth)
100
+ end
101
+
102
+ def test_handle_response_success
103
+ stub_json_request(:get, 'handle_response_success', '["response"]')
104
+ @client.get('handle_response_success')
105
+
106
+ assert_instance_of RestClient::Request, @client.request
107
+ assert_instance_of Net::HTTPOK, @client.result
108
+
109
+ assert_equal true, @client.response.respond_to?(:code)
110
+ assert_equal 200, @client.response.code
111
+ assert_equal ["response"], @client.message
112
+ assert_equal true, @client.successful
113
+ assert_equal '["response"]', @client.response
114
+ end
115
+
116
+ def test_handle_response_error
117
+ FakeWeb.register_uri(:get, "#{uri_with_login}/handle_response_error_404.json",
118
+ :content_type => 'application/json', :body => '', :status => ["404", "Not Found"])
119
+ @client.get('handle_response_error_404')
120
+ assert_equal "404 Not Found", @client.message
121
+ assert_equal false, @client.successful
122
+
123
+ FakeWeb.register_uri(:get, "#{uri_with_login}/handle_response_error_403.json",
124
+ :content_type => 'application/json', :body => '', :status => ["403", "Forbidden"])
125
+ @client.get('handle_response_error_403')
126
+ assert_equal "Action is not permitted for that account", @client.message
127
+ assert_equal false, @client.successful
128
+
129
+ FakeWeb.register_uri(:get, "#{uri_with_login}/handle_response_error_422.json",
130
+ :content_type => 'application/json', :body => '422', :status => ["422", "Failed"])
131
+ @client.get('handle_response_error_422')
132
+ assert_equal "Request Failed: 422", @client.message
133
+ assert_equal false, @client.successful
134
+
135
+ FakeWeb.register_uri(:get, "#{uri_with_login}/handle_response_error_500.json",
136
+ :content_type => 'application/json', :body => '', :status => ["500", "Failed"])
137
+ e = assert_raises RestClient::InternalServerError do
138
+ @client.get('handle_response_error_500')
139
+ end
140
+ assert_match /Internal Server Error/i, e.message
141
+ assert_equal false, @client.successful
142
+ end
143
+
144
+ def assert_defaults
145
+ assert_nil @client.response
146
+ assert_nil @client.result
147
+ assert_nil @client.response
148
+ assert_nil @client.successful
149
+ assert_nil @client.message
150
+ end
151
+
152
+ end
@@ -0,0 +1,12 @@
1
+ require File.dirname(__FILE__) + '/helper'
2
+
3
+ class TestSquall < Test::Unit::TestCase
4
+
5
+ def test_config
6
+ url = 'http://example.com/onapp'
7
+ assert_equal 'user', Squall.api_user
8
+ assert_equal 'stupidpass', Squall.api_password
9
+ assert_not_nil Squall.api_endpoint
10
+ assert_equal URI.parse(url), Squall.api_endpoint
11
+ end
12
+ end
@@ -0,0 +1,21 @@
1
+ require File.dirname(__FILE__) + '/helper'
2
+
3
+ class TestVirtualMachine < Test::Unit::TestCase
4
+ def setup
5
+ super
6
+ @virtual = Squall::VirtualMachine.new
7
+ end
8
+
9
+ def test_uri_prefix
10
+ assert_equal 'virtual_machines' , Squall::VirtualMachine::URI_PREFIX
11
+ end
12
+
13
+ def test_list
14
+ stub_json_request(:get, 'virtual_machines')
15
+ vms = @virtual.list
16
+ assert_equal 2, vms.size
17
+ assert_equal 'label1', vms[0]['label']
18
+ assert_equal 'label2', vms[1]['label']
19
+
20
+ end
21
+ end
metadata ADDED
@@ -0,0 +1,140 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: squall
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Justin Mazzi
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-11-17 00:00:00 -05:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: rest-client
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
32
+ version: "0"
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: json
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ hash: 3
44
+ segments:
45
+ - 0
46
+ version: "0"
47
+ type: :runtime
48
+ version_requirements: *id002
49
+ - !ruby/object:Gem::Dependency
50
+ name: fakeweb
51
+ prerelease: false
52
+ requirement: &id003 !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ hash: 3
58
+ segments:
59
+ - 0
60
+ version: "0"
61
+ type: :development
62
+ version_requirements: *id003
63
+ - !ruby/object:Gem::Dependency
64
+ name: redgreen
65
+ prerelease: false
66
+ requirement: &id004 !ruby/object:Gem::Requirement
67
+ none: false
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ hash: 3
72
+ segments:
73
+ - 0
74
+ version: "0"
75
+ type: :development
76
+ version_requirements: *id004
77
+ description: A Ruby library for working with the OnApp REST API
78
+ email: jmazzi@site5.com
79
+ executables: []
80
+
81
+ extensions: []
82
+
83
+ extra_rdoc_files:
84
+ - LICENSE
85
+ - README.rdoc
86
+ files:
87
+ - .document
88
+ - LICENSE
89
+ - README.rdoc
90
+ - Rakefile
91
+ - VERSION.yml
92
+ - lib/squall.rb
93
+ - lib/squall/client.rb
94
+ - lib/squall/hypervisor.rb
95
+ - lib/squall/virtual_machine.rb
96
+ - squall.gemspec
97
+ - test/fixtures/virtual_machines.json
98
+ - test/helper.rb
99
+ - test/test_client.rb
100
+ - test/test_squall.rb
101
+ - test/test_virtual_machine.rb
102
+ has_rdoc: true
103
+ homepage: http://github.com/site5/squall
104
+ licenses: []
105
+
106
+ post_install_message:
107
+ rdoc_options: []
108
+
109
+ require_paths:
110
+ - lib
111
+ required_ruby_version: !ruby/object:Gem::Requirement
112
+ none: false
113
+ requirements:
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ hash: 3
117
+ segments:
118
+ - 0
119
+ version: "0"
120
+ required_rubygems_version: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ hash: 3
126
+ segments:
127
+ - 0
128
+ version: "0"
129
+ requirements: []
130
+
131
+ rubyforge_project:
132
+ rubygems_version: 1.3.7
133
+ signing_key:
134
+ specification_version: 3
135
+ summary: A Ruby library for working with the OnApp REST API
136
+ test_files:
137
+ - test/helper.rb
138
+ - test/test_client.rb
139
+ - test/test_squall.rb
140
+ - test/test_virtual_machine.rb