simple_stack 0.0.20 → 0.0.21

Sign up to get free protection for your applications and to get access to all the features.
data/lib/simple_stack.rb CHANGED
@@ -8,6 +8,7 @@ require "simple_stack/cacheable"
8
8
  require "simple_stack/collection"
9
9
  require "simple_stack/hypervisor"
10
10
  require "simple_stack/entity"
11
+ require "simple_stack/storage"
11
12
  require "simple_stack/guest"
12
13
  require "simple_stack/snapshot"
13
14
  require "simple_stack/network_interface"
@@ -11,7 +11,7 @@ module SimpleStack
11
11
  end
12
12
 
13
13
  def info
14
- cached_attributes[:info] ||= hypervisor.get url
14
+ cached_attributes[:info] ||= hypervisor.get(url).parsed_response
15
15
  end
16
16
 
17
17
  def update(attributes = {})
@@ -34,5 +34,14 @@ module SimpleStack
34
34
  def connection
35
35
  hypervisor.connection
36
36
  end
37
+
38
+ def method_missing(method, *args, &block)
39
+ entity_info = info
40
+ if entity_info.keys.include?(method.to_s)
41
+ entity_info[method]
42
+ else
43
+ super
44
+ end
45
+ end
37
46
  end
38
47
  end
@@ -42,6 +42,10 @@ module SimpleStack
42
42
  cached_attributes[:info] ||= self.get url
43
43
  end
44
44
 
45
+ def storages
46
+ cached_attributes[:storages] ||= SimpleStack::Collection.new self, self, "#{url}/storages", SimpleStack::Storage
47
+ end
48
+
45
49
  def guests
46
50
  cached_attributes[:guests] ||= SimpleStack::Collection.new self, self, "#{url}/guests", SimpleStack::Guest
47
51
  end
@@ -0,0 +1,4 @@
1
+ module SimpleStack
2
+ class Storage < Entity
3
+ end
4
+ end
@@ -1,3 +1,3 @@
1
1
  module SimpleStack
2
- VERSION = "0.0.20"
2
+ VERSION = "0.0.21"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_stack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.20
4
+ version: 0.0.21
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-26 00:00:00.000000000 Z
12
+ date: 2012-07-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &2153582800 !ruby/object:Gem::Requirement
16
+ requirement: &2155225320 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *2153582800
24
+ version_requirements: *2155225320
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: httparty
27
- requirement: &2153582240 !ruby/object:Gem::Requirement
27
+ requirement: &2155224900 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2153582240
35
+ version_requirements: *2155224900
36
36
  description: A Simple Stack gem
37
37
  email:
38
38
  - thiago.morello@locaweb.com.br
@@ -55,6 +55,7 @@ files:
55
55
  - lib/simple_stack/hypervisor.rb
56
56
  - lib/simple_stack/network_interface.rb
57
57
  - lib/simple_stack/snapshot.rb
58
+ - lib/simple_stack/storage.rb
58
59
  - lib/simple_stack/version.rb
59
60
  - simple_stack.gemspec
60
61
  - spec/simple_stack/connection_spec.rb