better attachment api
This commit is contained in:
parent
bf1acd8355
commit
b350a51963
|
@ -66,8 +66,8 @@ class CouchRest
|
||||||
result = {}
|
result = {}
|
||||||
attachments.each do |k,v|
|
attachments.each do |k,v|
|
||||||
result[k] = {
|
result[k] = {
|
||||||
"type" => "base64",
|
"type" => v['type'],
|
||||||
"data" => base64(v)
|
"data" => base64(v['data'])
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
result
|
result
|
||||||
|
|
|
@ -190,7 +190,10 @@ describe CouchRest::Database do
|
||||||
"_id" => "mydocwithattachment",
|
"_id" => "mydocwithattachment",
|
||||||
"field" => ["some value"],
|
"field" => ["some value"],
|
||||||
"_attachments" => {
|
"_attachments" => {
|
||||||
"test.html" => @attach
|
"test.html" => {
|
||||||
|
"type" => "text/html",
|
||||||
|
"data" => @attach
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@db.save(@doc)
|
@db.save(@doc)
|
||||||
|
@ -211,7 +214,10 @@ describe CouchRest::Database do
|
||||||
@doc = {
|
@doc = {
|
||||||
"field" => ["some other value"],
|
"field" => ["some other value"],
|
||||||
"_attachments" => {
|
"_attachments" => {
|
||||||
"http://example.com/stuff.cgi?things=and%20stuff" => @attach
|
"http://example.com/stuff.cgi?things=and%20stuff" => {
|
||||||
|
"type" => "text/html",
|
||||||
|
"data" => @attach
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@docid = @db.save(@doc)['id']
|
@docid = @db.save(@doc)['id']
|
||||||
|
|
Loading…
Reference in a new issue