deltacloud-client 0.0.6 → 0.0.7

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/lib/deltacloud.rb CHANGED
@@ -199,16 +199,15 @@ module DeltaCloud
199
199
  end
200
200
  # Public and private addresses are returned as Array
201
201
  when "public_addresses", "private_addresses":
202
- define_method :"#{attribute.name.sanitize}" do
203
- attribute.xpath('address').collect { |address| address.text }
204
- end
202
+ attr_accessor :"#{attribute.name.sanitize}"
203
+ obj.send(:"#{attribute.name.sanitize}=",
204
+ attribute.xpath('address').collect { |address| address.text })
205
205
  # Value for other attributes are just returned using
206
206
  # method with same name as attribute (eg. .owner_id, .state)
207
207
  else
208
- define_method :"#{attribute.name.sanitize}" do
209
- attribute.text.convert
210
- end
211
- logger << "[DC] Added method #{attribute.name} to #{obj.class.name}\n"
208
+ attr_accessor :"#{attribute.name.sanitize}"
209
+ obj.send(:"#{attribute.name.sanitize}=", attribute.text.convert)
210
+ logger << "[DC] Added method #{attribute.name}[#{attribute.text}] to #{obj.class.name}\n"
212
211
  end
213
212
  end
214
213
  end
@@ -32,9 +32,9 @@ describe "instances" do
32
32
  instance.owner_id.should_not be_nil
33
33
  instance.owner_id.should be_a( String )
34
34
  instance.image.should_not be_nil
35
- instance.image.should be_a( DeltaCloud::Image )
35
+ instance.image.should be_a( DeltaCloud::API::Image )
36
36
  instance.hardware_profile.should_not be_nil
37
- instance.hardware_profile.should be_a( DeltaCloud::HardwareProfile )
37
+ instance.hardware_profile.should be_a( DeltaCloud::API::HardwareProfile )
38
38
  instance.state.should_not be_nil
39
39
  instance.state.should be_a( String )
40
40
  instance.public_addresses.should_not be_nil
@@ -172,8 +172,10 @@ describe "instances" do
172
172
  instance.uri.should eql( API_URL + '/instances/inst1' )
173
173
  instance.id.should eql( 'inst1' )
174
174
  instance.stop!
175
+ instance = client.instance( 'inst1' )
175
176
  instance.state.should eql( "STOPPED" )
176
177
  instance.start!
178
+ instance = client.instance( 'inst1' )
177
179
  instance.state.should eql( "RUNNING" )
178
180
  end
179
181
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deltacloud-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Red Hat, Inc.
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-07-07 00:00:00 +02:00
12
+ date: 2010-07-08 00:00:00 +02:00
13
13
  default_executable: deltacloudc
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency