snails 0.5.4 → 0.5.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/snails/mailer.rb +14 -1
- data/snails.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5267382f7965de74e32c6aa85f3d4326c0aa209b844d2e2d7dd94501ac6f303
|
4
|
+
data.tar.gz: 7fb6a268b8b5fafcfbfb48c693eee7fe23f847ccb14671af538f438239da0edc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33461597fc9830163588f753a564486192ffa2db5ba5c88cac1f5e0ec22c0332b648b7ea8f24855fbf6bb04b23552182f600059683ec2f610b205e19bfc02bc6
|
7
|
+
data.tar.gz: 4bd52a394347686cfe220780ec9fcb89296f31fc805b0cd6ac78e8930cbe654f8adb769b2431f7ffbcfc4ce9b8d8d41aa55ec272dedce6c0d5175795705b5e52
|
data/lib/snails/mailer.rb
CHANGED
@@ -200,6 +200,17 @@ A <%= @exception.class %> occurred in <%= @url %>:
|
|
200
200
|
|
201
201
|
class MailgunBackend < Backend
|
202
202
|
|
203
|
+
class Attachment < StringIO
|
204
|
+
attr_reader :original_filename, :content_type, :path
|
205
|
+
|
206
|
+
def initialize(data, filename, content_type)
|
207
|
+
super(data)
|
208
|
+
@path = '' # path
|
209
|
+
@original_filename = filename
|
210
|
+
@content_type = content_type || 'application/octet-stream'
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
203
214
|
def initialize(api_key:, domain_name:)
|
204
215
|
# @key = api_key
|
205
216
|
@url = "https://api:#{api_key}@api.mailgun.net/v3/#{domain_name}/messages"
|
@@ -222,7 +233,9 @@ A <%= @exception.class %> occurred in <%= @url %>:
|
|
222
233
|
end
|
223
234
|
|
224
235
|
if email[:attachments]
|
225
|
-
data[:attachment] = email[:attachments].map
|
236
|
+
data[:attachment] = email[:attachments].map do |att|
|
237
|
+
Attachment.new(att[:content], att[:filename], att[:content_type])
|
238
|
+
end
|
226
239
|
end
|
227
240
|
|
228
241
|
resp = RestClient.post(@url, data)
|
data/snails.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: snails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomás Pollak
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-10-
|
11
|
+
date: 2022-10-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|