rest_connection 0.1.9 → 0.1.10
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 +1 -1
- data/lib/rest_connection/rightscale/mc_multi_cloud_image.rb +12 -4
- data/lib/rest_connection/rightscale/mc_multi_cloud_image_setting.rb +8 -1
- data/lib/rest_connection/rightscale/mc_server_template.rb +1 -1
- data/lib/rest_connection/rightscale/multi_cloud_image.rb +1 -1
- data/lib/rest_connection/rightscale/rightscale_api_gateway.rb +6 -1
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.10
|
@@ -29,9 +29,8 @@ class McMultiCloudImage
|
|
29
29
|
extend RightScale::Api::GatewayExtend
|
30
30
|
include RightScale::Api::McTaggable
|
31
31
|
extend RightScale::Api::McTaggableExtend
|
32
|
-
attr_reader :settings
|
33
32
|
|
34
|
-
deny_methods :
|
33
|
+
deny_methods :update #supported in API, not imp'd in code yet
|
35
34
|
|
36
35
|
def resource_plural_name
|
37
36
|
"multi_cloud_images"
|
@@ -58,10 +57,17 @@ class McMultiCloudImage
|
|
58
57
|
end
|
59
58
|
|
60
59
|
def supported_cloud_ids
|
61
|
-
|
60
|
+
settings.map { |mcics| mcics.cloud_id }
|
62
61
|
end
|
63
62
|
|
64
|
-
def
|
63
|
+
def reload
|
64
|
+
@settings = nil
|
65
|
+
super
|
66
|
+
end
|
67
|
+
|
68
|
+
# Note, only returns API 1.5 clouds, API 1.0 omitted
|
69
|
+
def settings
|
70
|
+
return @settings if @settings
|
65
71
|
@settings = []
|
66
72
|
url = URI.parse(self.href)
|
67
73
|
connection.get(url.path + '/settings').each { |s|
|
@@ -69,4 +75,6 @@ class McMultiCloudImage
|
|
69
75
|
}
|
70
76
|
@settings
|
71
77
|
end
|
78
|
+
def get_settings; settings; end
|
79
|
+
|
72
80
|
end
|
@@ -28,7 +28,7 @@ class McMultiCloudImageSetting
|
|
28
28
|
include RightScale::Api::Gateway
|
29
29
|
extend RightScale::Api::GatewayExtend
|
30
30
|
|
31
|
-
deny_methods :
|
31
|
+
deny_methods :update #supported in API, not imp'd in code yet
|
32
32
|
|
33
33
|
def resource_plural_name
|
34
34
|
"settings"
|
@@ -57,4 +57,11 @@ class McMultiCloudImageSetting
|
|
57
57
|
def cloud_id
|
58
58
|
self.cloud.split(/\//).last.to_i
|
59
59
|
end
|
60
|
+
|
61
|
+
# API 1.5 MultiCloudImageSetting is posted to url
|
62
|
+
# /api/multi_cloud_images/:id/settings but the object it posts to the
|
63
|
+
# API is named :multi_cloud_image_setting => { attrs }
|
64
|
+
def self.resource_post_name
|
65
|
+
"multi_cloud_image_setting"
|
66
|
+
end
|
60
67
|
end
|
@@ -53,7 +53,7 @@ class McServerTemplate
|
|
53
53
|
|
54
54
|
def get_mcis_and_settings
|
55
55
|
@params["multi_cloud_images"] = McMultiCloudImage.find_all(self.rs_id)
|
56
|
-
@params["multi_cloud_images"].each { |mci| mci.
|
56
|
+
@params["multi_cloud_images"].each { |mci| mci.settings } # Eager load
|
57
57
|
@mci_links = McServerTemplateMultiCloudImage.find_with_filter(:server_template_href => self.href)
|
58
58
|
end
|
59
59
|
|
@@ -41,7 +41,7 @@ class MultiCloudImage
|
|
41
41
|
# The .settings call filters out non-ec2 images
|
42
42
|
more_settings = []
|
43
43
|
if total_image_count > internal.settings.size
|
44
|
-
more_settings = McMultiCloudImage.find(rs_id.to_i).
|
44
|
+
more_settings = McMultiCloudImage.find(rs_id.to_i).settings
|
45
45
|
end
|
46
46
|
@params["multi_cloud_image_cloud_settings"] = internal.settings + more_settings
|
47
47
|
end
|
@@ -280,6 +280,11 @@ module RightScale
|
|
280
280
|
[]
|
281
281
|
end
|
282
282
|
|
283
|
+
# Hack for McMultiCloudImageSetting class to fix a API quirk
|
284
|
+
def resource_post_name
|
285
|
+
self.resource_singular_name
|
286
|
+
end
|
287
|
+
|
283
288
|
def create(*args)
|
284
289
|
if args.last.is_a?(Hash)
|
285
290
|
opts = args.pop
|
@@ -287,7 +292,7 @@ module RightScale
|
|
287
292
|
raise ArgumentError.new("create requires the last argument to be a Hash")
|
288
293
|
end
|
289
294
|
url = "#{parse_args(*args)}#{self.resource_plural_name}"
|
290
|
-
location = connection.post(url, self.
|
295
|
+
location = connection.post(url, self.resource_post_name.to_sym => opts)
|
291
296
|
newrecord = self.new('links' => [ {'rel' => 'self', 'href' => location } ])
|
292
297
|
newrecord.reload
|
293
298
|
newrecord
|
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:
|
4
|
+
hash: 15
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 10
|
10
|
+
version: 0.1.10
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jeremy Deininger
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2012-
|
19
|
+
date: 2012-05-14 00:00:00 Z
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
22
|
name: activesupport
|