2013-06-18 12:56:19 -04:00
|
|
|
require 'fog/core/model'
|
|
|
|
|
|
|
|
module Fog
|
|
|
|
module Compute
|
|
|
|
class Vcloudng
|
|
|
|
|
|
|
|
class Catalog < Fog::Model
|
|
|
|
|
|
|
|
identity :id
|
|
|
|
|
|
|
|
attribute :name
|
|
|
|
attribute :type
|
|
|
|
attribute :href
|
2013-06-19 11:06:24 -04:00
|
|
|
attribute :description, :aliases => :Description
|
2013-07-08 14:54:54 -04:00
|
|
|
attribute :is_published, :aliases => :IsPublished, :type => :boolean
|
2013-06-18 12:56:19 -04:00
|
|
|
|
|
|
|
def catalog_items
|
2013-06-18 14:51:12 -04:00
|
|
|
requires :id
|
|
|
|
service.catalog_items(:catalog => self)
|
2013-06-18 12:56:19 -04:00
|
|
|
end
|
|
|
|
|
2013-07-08 14:54:54 -04:00
|
|
|
def initialize(attrs={})
|
|
|
|
super(attrs)
|
|
|
|
[:description, :is_published].each { |attr| attributes[attr]= NonLoaded if attributes[attr].nil? }
|
|
|
|
end
|
|
|
|
|
|
|
|
def description
|
|
|
|
reload if attributes[:description] == NonLoaded and !@inspecting
|
|
|
|
attributes[:description]
|
|
|
|
end
|
|
|
|
|
|
|
|
def is_published
|
|
|
|
reload if attributes[:is_published] == NonLoaded and !@inspecting
|
|
|
|
attributes[:is_published]
|
|
|
|
end
|
|
|
|
|
|
|
|
def inspect
|
|
|
|
@inspecting = true
|
|
|
|
out = super
|
|
|
|
@inspecting = false
|
|
|
|
out
|
|
|
|
end
|
|
|
|
|
2013-06-18 12:56:19 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|