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

[bbg] rename requests to more closely reflect api

This commit is contained in:
geemus 2010-06-02 08:44:51 -07:00
parent 9f24c7921a
commit 7fc2a7fd5b
8 changed files with 22 additions and 22 deletions

View file

@ -21,12 +21,12 @@ module Fog
model Fog::Bluebox::Flavor
def all
data = connection.get_flavors.body['flavors']
data = connection.get_product.body['products']
load(data)
end
def get(product_id)
response = connection.get_flavor(product_id)
response = connection.get_product(product_id)
new(response.body)
rescue Excon::Errors::Forbidden, Excon::Errors::NotFound
nil

View file

@ -30,7 +30,7 @@ module Fog
end
def get(template_id)
response = connection.get_image(template_id)
response = connection.get_template(template_id)
new(response.body)
rescue Excon::Errors::Forbidden, Excon::Errors::NotFound
nil

View file

@ -2,7 +2,7 @@ module Fog
module Parsers
module Bluebox
class GetFlavor < Fog::Parsers::Base
class GetProduct < Fog::Parsers::Base
def reset
@response = {}

View file

@ -2,17 +2,17 @@ module Fog
module Parsers
module Bluebox
class GetFlavors < Fog::Parsers::Base
class GetProducts < Fog::Parsers::Base
def reset
@product = {}
@response = { 'flavors' => [] }
@response = { 'products' => [] }
end
def end_element(name)
case name
when 'record'
@response['flavors'] << @product
@response['products'] << @product
@product = {}
when 'cost'
@product[name] = @value.to_f

View file

@ -2,11 +2,11 @@ module Fog
module Parsers
module Bluebox
class GetImages < Fog::Parsers::Base
class GetTemplates < Fog::Parsers::Base
def reset
@template = {}
@response = { 'images' => [] }
@response = { 'templates' => [] }
end
def end_element(name)
@ -18,7 +18,7 @@ module Fog
when 'description'
@template[name] = @value
when 'record'
@response['images'] << @template
@response['templates'] << @template
@template = {}
end
end

View file

@ -4,16 +4,16 @@ module Fog
require 'fog/bluebox/parsers/get_flavor'
# Get details of a flavor
# Get details of a product
#
# ==== Parameters
# * flavor_id<~Integer> - Id of flavor to lookup
# * product_id<~Integer> - Id of flavor to lookup
#
# ==== Returns
# * response<~Excon::Response>:
# * body<~Array>:
# TODO
def get_flavor(flavor_id)
def get_product(product_id)
request(
:expects => 200,
:method => 'GET',
@ -26,7 +26,7 @@ module Fog
class Mock
def get_flavor(flavor_id)
def get_product(product_id)
Fog::Mock.not_implemented
end

View file

@ -2,7 +2,7 @@ module Fog
module Bluebox
class Real
require 'fog/bluebox/parsers/get_flavors'
require 'fog/bluebox/parsers/get_products'
# Get list of products
#
@ -12,11 +12,11 @@ module Fog
# * 'id'<~String> - UUID of the product
# * 'description'<~String> - Description of the product
# * 'cost'<~Decimal> - Hourly cost of the product
def get_flavors
def get_products
request(
:expects => 200,
:method => 'GET',
:parser => Fog::Parsers::Bluebox::GetFlavors.new,
:parser => Fog::Parsers::Bluebox::GetProducts.new,
:path => 'api/block_products.xml'
)
end
@ -25,7 +25,7 @@ module Fog
class Mock
def get_flavors
def get_products
Fog::Mock.not_implemented
end

View file

@ -2,7 +2,7 @@ module Fog
module Bluebox
class Real
require 'fog/bluebox/parsers/get_images'
require 'fog/bluebox/parsers/get_templates'
# Get list of OS templates
#
@ -13,11 +13,11 @@ module Fog
# * 'description'<~String> - Description of the image
# * 'public'<~Boolean> - Public / Private image
# * 'created'<~Datetime> - Timestamp of when the image was created
def get_images
def get_templates
request(
:expects => 200,
:method => 'GET',
:parser => Fog::Parsers::Bluebox::GetImages.new,
:parser => Fog::Parsers::Bluebox::GetTemplates.new,
:path => 'api/block_templates.xml'
)
end
@ -26,7 +26,7 @@ module Fog
class Mock
def get_images
def get_templates
Fog::Mock.not_implemented
end