class Blobsterix::Storage::BucketList

Attributes

buckets[RW]

Public Class Methods

new() { |self| ... } click to toggle source
# File lib/blobsterix/storage/bucket_list.rb, line 6
def initialize()
  @buckets = []
  yield self if block_given?
end

Public Instance Methods

to_xml() click to toggle source
# File lib/blobsterix/storage/bucket_list.rb, line 11
def to_xml()
  date = Date.today
  xml = Nokogiri::XML::Builder.new do |xml|
    xml.ListAllMyBucketsResult(:xmlns => "http://doc.s3.amazonaws.com/#{date.year}-#{date.month}-#{date.day}") {
      xml.Buckets {
        buckets.each{|entry|
          entry.insert_xml(xml)
        }
      }
    }
  end
  xml.to_xml
end