snails 0.5.4 → 0.5.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/snails/mailer.rb +14 -1
  3. data/snails.gemspec +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 63c1da08259ce1c37de080d5a1d6ed958e0d955256dceb9af72f83680904f34c
4
- data.tar.gz: 432e821c86311cd5c3e7ed354bc759d63da4e100f744b34e3e38a4a1b6c3a0ef
3
+ metadata.gz: e5267382f7965de74e32c6aa85f3d4326c0aa209b844d2e2d7dd94501ac6f303
4
+ data.tar.gz: 7fb6a268b8b5fafcfbfb48c693eee7fe23f847ccb14671af538f438239da0edc
5
5
  SHA512:
6
- metadata.gz: 958fd97d0cb0483cf685a7451f8c7c6b13dc3ab488d3b557c4f443eb270e0d7a914a1337848062003d323fe8e3bcf9ec0cfdde5348e75d91c1a3318977e7d920
7
- data.tar.gz: f8a35986ae97d517aabeb4d08b552d1ea67b9d5c59937c137a634304fb6a041e1a324693e486c26e79b8c221d9c3863bd697c70b0f271a347e4635e9a16ca4f7
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 { |att| att[:content] }
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
@@ -3,7 +3,7 @@
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "snails"
6
- s.version = '0.5.4'
6
+ s.version = '0.5.5'
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ['Tomás Pollak']
9
9
  s.email = ['tomas@forkhq.com']
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
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-19 00:00:00.000000000 Z
11
+ date: 2022-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler