rest_connection 0.0.10 → 0.0.11

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.10
1
+ 0.0.11
@@ -30,6 +30,26 @@ class Server
30
30
  newrecord
31
31
  end
32
32
 
33
+ # The RightScale api returns the server parameters as a hash with "name" and "value".
34
+ # This must be transformed into a hash in case we want to PUT this back to the API.
35
+ def transform_parameters(parameters)
36
+ new_params_hash = {}
37
+ parameters.each do |parameter_hash|
38
+ new_params_hash[parameter_hash["name"]] = parameter_hash["value"]
39
+ end
40
+ new_params_hash
41
+ end
42
+
43
+ # This is overriding the default save with one that can massage the parameters
44
+ def save
45
+ # if the parameters are an array of hashes, that means we need to transform.
46
+ if @params['parameters'].is_a?(Array)
47
+ @params['parameters'] = transform_parameters(@params['parameters'])
48
+ end
49
+ uri = URI.parse(self.href)
50
+ connection.put(uri.path, resource_singular_name.to_sym => @params)
51
+ end
52
+
33
53
  # waits until the specified state is reached for this Server
34
54
  # *st <~String> the name of the state to wait for, eg. "operational"
35
55
  # *timeout <~Integer> optional, how long to wait for the state before declare failure (in seconds).
@@ -53,7 +73,7 @@ class Server
53
73
  wait_for_state("operational")
54
74
  while(timeout > 0)
55
75
  self.settings
56
- break if self['dns-name'] && !self['dns-name'].empty?
76
+ break if self['dns-name'] && !self['dns-name'].empty? && self['private-dns-name'] && !self['private-dns-name'].empty?
57
77
  connection.logger "waiting for dns-name for #{self.nickname}"
58
78
  sleep 30
59
79
  timeout -= 30
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rest_connection}
8
- s.version = "0.0.10"
8
+ s.version = "0.0.11"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jeremy Deininger"]
12
- s.date = %q{2010-09-02}
12
+ s.date = %q{2010-10-01}
13
13
  s.description = %q{provides rest_connection}
14
14
  s.email = %q{jeremy@rubyonlinux.org}
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rest_connection
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 9
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 10
10
- version: 0.0.10
9
+ - 11
10
+ version: 0.0.11
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jeremy Deininger
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-09-02 00:00:00 -07:00
18
+ date: 2010-10-01 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency