dolly 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dolly/document.rb +18 -6
- data/lib/dolly/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a752e24460e1d6fc8cf00c9559af2f2be244387d
|
4
|
+
data.tar.gz: 21094c71f3df84d38d8eb86da5e46f3c70001fb0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2cbeb233b8c84f344130f593718903d2386b3713f75f6ada4d215cc5220b67c11b53e62933e4c327884c2fcae1cd1fc98301d2591eaf33de74906b6d055bd193
|
7
|
+
data.tar.gz: 2d417e18b9147627481684279ed654f1b624e2ec34ab00e4221381e0dac82e856b9319511b4c5481a97dcc7da831062d45004225281729604b16238c2133acfd
|
data/lib/dolly/document.rb
CHANGED
@@ -105,17 +105,29 @@ module Dolly
|
|
105
105
|
end
|
106
106
|
|
107
107
|
def attach_file! file_name, mime_type, body, opts={}
|
108
|
+
attach_file file_name, mime_type, body, opts
|
109
|
+
save
|
110
|
+
end
|
111
|
+
|
112
|
+
def attach_file file_name, mime_type, body, opts={}
|
108
113
|
if opts[:inline]
|
109
|
-
|
110
|
-
'data' => Base64.encode64(body)} }
|
111
|
-
doc['_attachments'] ||= {}
|
112
|
-
doc['_attachments'].merge! attachment_data
|
113
|
-
save
|
114
|
+
attach_inline_file file_name, mime_type, body
|
114
115
|
else
|
115
|
-
|
116
|
+
attach_standalone_file file_name, mime_type, body
|
116
117
|
end
|
117
118
|
end
|
118
119
|
|
120
|
+
def attach_inline_file file_name, mime_type, body
|
121
|
+
attachment_data = { file_name.to_s => { 'content_type' => mime_type,
|
122
|
+
'data' => Base64.encode64(body)} }
|
123
|
+
doc['_attachments'] ||= {}
|
124
|
+
doc['_attachments'].merge! attachment_data
|
125
|
+
end
|
126
|
+
|
127
|
+
def attach_standalone_file file_name, mime_type, body
|
128
|
+
database.attach id_as_resource, CGI.escape(file_name), body, { 'Content-Type' => mime_type }
|
129
|
+
end
|
130
|
+
|
119
131
|
def self.create options = {}
|
120
132
|
obj = new options
|
121
133
|
obj.save
|
data/lib/dolly/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dolly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- javierg
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-06-
|
11
|
+
date: 2016-06-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|