better attachment api
This commit is contained in:
parent
b350a51963
commit
881b18b0f0
|
@ -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/,'')
|
||||||
|
|
Loading…
Reference in a new issue