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:
parent
963ba5ed32
commit
e8019a18cf
5 changed files with 60 additions and 3 deletions
41
lib/fog/rackspace/requests/servers/get_flavor_details.rb
Normal file
41
lib/fog/rackspace/requests/servers/get_flavor_details.rb
Normal 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
|
|
@ -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>:
|
||||
|
|
|
@ -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'
|
||||
)
|
||||
|
|
|
@ -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"
|
||||
|
|
15
spec/rackspace/requests/servers/get_flavor_details_spec.rb
Normal file
15
spec/rackspace/requests/servers/get_flavor_details_spec.rb
Normal 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
|
Loading…
Add table
Reference in a new issue