def to_xml
Nokogiri::XML::Builder.new do |xml|
xml.LifecycleConfiguration do
rules.each do |rule|
xml.Rule do
xml.ID rule.id
xml.Prefix rule.prefix
xml.Status rule.status
xml.Expiration do
if Integer === rule.expiration_time
xml.Days rule.expiration_time
else
date = rule.expiration_time.to_s
xml.Date "#{date}T00:00:00Z"
end
end if rule.expiration_time
xml.Transition do
xml.StorageClass 'GLACIER'
if Integer === rule.glacier_transition_time
xml.Days rule.glacier_transition_time
else
date = rule.glacier_transition_time.to_s
xml.Date "#{date}T00:00:00Z"
end
end if rule.glacier_transition_time
end
end
end
end.doc.root.to_xml
end