1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/bluebox/models/products.rb
2010-06-03 14:48:53 -07:00

37 lines
632 B
Ruby

require 'fog/collection'
require 'fog/bluebox/models/product'
module Fog
module Bluebox
class Mock
def products
Fog::Bluebox::Products.new(:connection => self)
end
end
class Real
def products
Fog::Bluebox::Products.new(:connection => self)
end
end
class Products < Fog::Collection
model Fog::Bluebox::Product
def all
data = connection.get_products.body['products']
load(data)
end
def get(product_id)
connection.get_product(product_id)
rescue Excon::Errors::Forbidden
nil
end
end
end
end