right-scale-api 0.0.0 → 0.0.1
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/.gitignore +1 -0
- data/VERSION +1 -1
- data/lib/right-scale-api/base.rb +31 -14
- data/lib/right-scale-api/deployment.rb +4 -0
- data/lib/right-scale-api/ec2_ebs_volume.rb +1 -1
- data/lib/right-scale-api/server.rb +4 -0
- data/right-scale-api.gemspec +2 -2
- metadata +3 -3
data/.gitignore
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.1
|
data/lib/right-scale-api/base.rb
CHANGED
@@ -6,11 +6,12 @@ module RightScaleAPI
|
|
6
6
|
#attributes that directly correspond to the api's
|
7
7
|
def self.attributes attrs=nil
|
8
8
|
if attrs
|
9
|
+
@attributes ||= Base.attributes
|
9
10
|
@attributes ||= []
|
10
|
-
@attributes += attrs
|
11
|
+
@attributes += attrs.map {|attr|attr.to_sym}
|
11
12
|
attr_accessor *attrs
|
12
13
|
|
13
|
-
|
14
|
+
attrs.each do |attr|
|
14
15
|
if attr =~ /(.+)_href$/
|
15
16
|
relation = $1
|
16
17
|
attr_accessor relation
|
@@ -21,7 +22,7 @@ module RightScaleAPI
|
|
21
22
|
@attributes
|
22
23
|
end
|
23
24
|
|
24
|
-
attributes [:tags, :created_at, :updated_at,:errors]
|
25
|
+
attributes [:tags, :created_at, :updated_at,:errors, :nickname]
|
25
26
|
|
26
27
|
def self.get id
|
27
28
|
new :id => id
|
@@ -68,13 +69,29 @@ module RightScaleAPI
|
|
68
69
|
delete ''
|
69
70
|
end
|
70
71
|
|
71
|
-
def
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
72
|
+
def send_request method, *args
|
73
|
+
args[0] = "#{path}#{args[0]}"
|
74
|
+
RightScaleAPI::Client.send method, *args
|
75
|
+
end
|
76
|
+
|
77
|
+
def get *args
|
78
|
+
send_request :get, *args
|
79
|
+
end
|
80
|
+
|
81
|
+
def head *args
|
82
|
+
send_request :head, *args
|
83
|
+
end
|
84
|
+
|
85
|
+
def post *args
|
86
|
+
send_request :post, *args
|
87
|
+
end
|
88
|
+
|
89
|
+
def put *args
|
90
|
+
send_request :put, *args
|
91
|
+
end
|
92
|
+
|
93
|
+
def delete *args
|
94
|
+
send_request :delete, *args
|
78
95
|
end
|
79
96
|
|
80
97
|
def uri
|
@@ -108,16 +125,16 @@ module RightScaleAPI
|
|
108
125
|
def self.opts_to_query_opts opts
|
109
126
|
query_opts = opts.dup
|
110
127
|
|
111
|
-
relations = attributes.select {|a|a.include? '_href'}
|
128
|
+
relations = attributes.select {|a|a.to_s.include? '_href'}
|
112
129
|
relations.each do |r|
|
113
|
-
r_name = r.sub('_href','').to_sym
|
130
|
+
r_name = r.to_s.sub('_href','').to_sym
|
114
131
|
if query_opts[r_name]
|
115
132
|
query_opts[r] = query_opts.delete(r_name).href
|
116
133
|
end
|
117
134
|
end
|
118
|
-
query_opts.delete_if {|k,v| ! attributes.include? k.
|
135
|
+
query_opts.delete_if {|k,v| ! attributes.include? k.to_sym }
|
119
136
|
|
120
137
|
query_opts
|
121
138
|
end
|
122
139
|
end
|
123
|
-
end
|
140
|
+
end
|
@@ -15,7 +15,7 @@ class Ec2EbsVolume < Account::SubResource
|
|
15
15
|
|
16
16
|
def attach_to_server server, device, mount
|
17
17
|
account.post '/component_ec2_ebs_volumes', :body => {
|
18
|
-
:
|
18
|
+
:component_ec2_ebs_volume => {
|
19
19
|
:ec2_ebs_volume_href => uri,
|
20
20
|
:component_href => server.href,
|
21
21
|
:device => device,
|
data/right-scale-api.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{right-scale-api}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Nick Howard"]
|
12
|
-
s.date = %q{2010-05-
|
12
|
+
s.date = %q{2010-05-06}
|
13
13
|
s.description = %q{A client for the RightScale API that hides some of the complexity of the API
|
14
14
|
(It doesn't require passing around hrefs as much). Based on HTTParty
|
15
15
|
}
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 1
|
9
|
+
version: 0.0.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Nick Howard
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-05-
|
17
|
+
date: 2010-05-06 00:00:00 -06:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|