lib/shuck/xml_adapter.rb in shuck-0.0.8 vs lib/shuck/xml_adapter.rb in shuck-0.0.9
- old
+ new
@@ -42,10 +42,24 @@
err.RequestId(1)
}
output
end
+ def self.error_no_such_key(name)
+ output = ""
+ xml = Builder::XmlMarkup.new(:target => output)
+ xml.instruct! :xml, :version=>"1.0", :encoding=>"UTF-8"
+ xml.Error { |err|
+ err.Code("NoSuchKey")
+ err.Message("The specified key does not exist")
+ err.Key(name)
+ err.RequestId(1)
+ err.HostId(2)
+ }
+ output
+ end
+
def self.bucket(bucket)
output = ""
xml = Builder::XmlMarkup.new(:target => output)
xml.instruct! :xml, :version=>"1.0", :encoding=>"UTF-8"
xml.ListBucketResult(:xmlns => "http://s3.amazonaws.com/doc/2006-03-01/") { |lbr|
@@ -56,7 +70,29 @@
lbr.IsTruncated("false")
}
output
end
+ # ACL xml
+ def self.acl(object = nil)
+ output = ""
+ xml = Builder::XmlMarkup.new(:target => output)
+ xml.instruct! :xml, :version=>"1.0", :encoding=>"UTF-8"
+ xml.AccessControlPolicy(:xmlns => "http://s3.amazonaws.com/doc/2006-03-01/") { |acp|
+ acp.Owner do |owner|
+ owner.ID("abc")
+ owner.DisplayName("You")
+ end
+ acp.AccessControlList do |acl|
+ acl.Grant do |grant|
+ grant.Grantee("xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance", "xsi:type" => "CanonicalUser") do |grantee|
+ grantee.ID("abc")
+ grantee.DisplayName("You")
+ end
+ grant.Permission("FULL_CONTROL")
+ end
+ end
+ }
+ output
+ end
end
end