1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

get_flavor_details implementation

This commit is contained in:
Wesley Beary 2009-11-15 19:58:26 -08:00
parent 963ba5ed32
commit e8019a18cf
5 changed files with 60 additions and 3 deletions

View file

@ -0,0 +1,41 @@
unless Fog.mocking?
module Fog
module Rackspace
class Servers
# Get details for flavor by id
#
# ==== Returns
# * response<~Excon::Response>:
# * body<~Hash>:
# * 'id'<~Integer> - Id of the flavor
# * 'name'<~String> - Name of the flavor
# * 'ram'<~Integer> - Amount of ram for the flavor
# * 'disk'<~Integer> - Amount of diskspace for the flavor
def get_flavor_details(flavor_id)
request(
:expects => [200, 203],
:method => 'GET',
:path => "flavors/#{flavor_id}.json"
)
end
end
end
end
else
module Fog
module Rackspace
class Servers
def get_flavor_details(flavor_id)
end
end
end
end
end

View file

@ -4,7 +4,7 @@ unless Fog.mocking?
module Rackspace
class Servers
# List all images (IDs and names only)
# List all flavors (IDs and names only)
#
# ==== Returns
# * response<~Excon::Response>:

View file

@ -4,7 +4,7 @@ unless Fog.mocking?
module Rackspace
class Servers
# List all images (IDs and names only)
# List all flavors
#
# ==== Returns
# * response<~Excon::Response>:
@ -15,7 +15,7 @@ unless Fog.mocking?
# * 'disk'<~Integer> - Amount of diskspace for the flavor
def list_flavors_detail
request(
:expects => 200,
:expects => [200, 203],
:method => 'GET',
:path => 'flavors/detail.json'
)

View file

@ -22,6 +22,7 @@ module Fog
load "fog/rackspace/requests/servers/create_server.rb"
load "fog/rackspace/requests/servers/delete_image.rb"
load "fog/rackspace/requests/servers/delete_server.rb"
load "fog/rackspace/requests/servers/get_flavor_details.rb"
load "fog/rackspace/requests/servers/get_server_details.rb"
load "fog/rackspace/requests/servers/list_addresses.rb"
load "fog/rackspace/requests/servers/list_private_addresses.rb"

View file

@ -0,0 +1,15 @@
require File.dirname(__FILE__) + '/../../../spec_helper'
describe 'Rackspace::Servers.get_flavor_details' do
describe 'success' do
it "should return proper attributes" do
actual = servers.get_flavor_details(1).body['flavor']
actual['disk'].should be_an(Integer)
actual['id'].should be_an(Integer)
actual['name'].should be_a(String)
actual['ram'].should be_an(Integer)
end
end
end