better attachment api

This commit is contained in:
Chris Anderson 2008-06-07 09:05:29 -07:00
parent b350a51963
commit 881b18b0f0

View file

@ -63,14 +63,10 @@ class CouchRest
end end
private private
def encode_attachments attachments def encode_attachments attachments
result = {}
attachments.each do |k,v| attachments.each do |k,v|
result[k] = { v['data'] = base64(v['data'])
"type" => v['type'],
"data" => base64(v['data'])
}
end end
result attachments
end end
def base64 data def base64 data
Base64.encode64(data).gsub(/\s/,'') Base64.encode64(data).gsub(/\s/,'')