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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 67e4a34df871520e4ce1551f53d77cc74985d98c
4
- data.tar.gz: 4671b8568f935726133425ed64474698e92d41cd
3
+ metadata.gz: a752e24460e1d6fc8cf00c9559af2f2be244387d
4
+ data.tar.gz: 21094c71f3df84d38d8eb86da5e46f3c70001fb0
5
5
  SHA512:
6
- metadata.gz: 39ae6cf57a4a667c9ff9b1d44f4967fa1d6696991829fce18951ba894f93b838e558b1e10f36ad68fdc29dfb02e4e3f13d2a4da8a3a4f28576f93b564afe21ca
7
- data.tar.gz: 925e1a15653ce0f2ea5f98ae00cdfb7ceb165f5ad64fb052b4c9dabde4503f463da5b8b6e2ce170edbb208fa643a134ba1d3f56b3a5069be7eed1e32cd07941d
6
+ metadata.gz: 2cbeb233b8c84f344130f593718903d2386b3713f75f6ada4d215cc5220b67c11b53e62933e4c327884c2fcae1cd1fc98301d2591eaf33de74906b6d055bd193
7
+ data.tar.gz: 2d417e18b9147627481684279ed654f1b624e2ec34ab00e4221381e0dac82e856b9319511b4c5481a97dcc7da831062d45004225281729604b16238c2133acfd
@@ -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
- attachment_data = { file_name.to_s => { 'content_type' => mime_type,
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
- database.attach id_as_resource, CGI.escape(file_name), body, { 'Content-Type' => mime_type }
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
@@ -1,3 +1,3 @@
1
1
  module Dolly
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
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.0
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-06 00:00:00.000000000 Z
11
+ date: 2016-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties