2012-04-25 07:57:15 -04:00
|
|
|
require 'fog/core/collection'
|
|
|
|
require 'fog/brightbox/models/compute/account'
|
|
|
|
|
|
|
|
module Fog
|
|
|
|
module Compute
|
|
|
|
class Brightbox
|
|
|
|
|
|
|
|
class Accounts < Fog::Collection
|
|
|
|
|
|
|
|
model Fog::Compute::Brightbox::Account
|
|
|
|
|
|
|
|
def all
|
2012-12-22 18:29:21 -05:00
|
|
|
data = service.list_accounts
|
2012-04-25 07:57:15 -04:00
|
|
|
load(data)
|
|
|
|
end
|
|
|
|
|
|
|
|
def get(identifier)
|
|
|
|
return nil if identifier.nil? || identifier == ""
|
2012-12-22 18:29:21 -05:00
|
|
|
data = service.get_account(identifier)
|
2012-04-25 07:57:15 -04:00
|
|
|
new(data)
|
|
|
|
rescue Excon::Errors::NotFound
|
|
|
|
nil
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
2012-12-22 18:29:21 -05:00
|
|
|
end
|