Class: Aeolus::Image::Warehouse::Icicle

Inherits:
WarehouseModel show all
Defined in:
lib/aeolus_image/model/warehouse/icicle.rb

Instance Attribute Summary

Attributes inherited from WarehouseModel

#body

Instance Method Summary collapse

Methods inherited from WarehouseModel

#==, all, #bucket_object, bucket_objects, config, config=, create!, delete, find, first, #id, #initialize, iwhd_url, last, oauth_consumer_key, oauth_consumer_secret, #set_attr, set_warehouse_and_bucket, use_oauth?, where

Constructor Details

This class inherits a constructor from Aeolus::Image::Warehouse::WarehouseModel

Instance Method Details

#descriptionObject



33
34
35
36
37
38
39
40
41
42
# File 'lib/aeolus_image/model/warehouse/icicle.rb', line 33

def description
  unless @description
    begin
      @description = get_icicle.xpath('icicle/description').text
    rescue
      @description = []
    end
  end
  @description
end

#get_icicleObject



44
45
46
47
48
49
50
51
52
53
54
# File 'lib/aeolus_image/model/warehouse/icicle.rb', line 44

def get_icicle
  unless @icicle_xml
      icicle = Icicle.bucket.objects.find(@uuid) if @uuid
    begin
      @icicle_xml = Nokogiri::XML icicle.first.body
    rescue
      @icicle_xml = Nokogiri::XML '<icicle></icicle>'
    end
  end
  @icicle_xml
end

#packagesObject



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/aeolus_image/model/warehouse/icicle.rb', line 21

def packages
  unless @packages
    begin
      package_elems = get_icicle.xpath('icicle/packages/package')
      @packages = package_elems.map { |node| node.attributes['name'].text }
    rescue
      @packages = []
    end
  end
  @packages
end