silent_bob 0.2.5 → 0.2.7

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
  SHA256:
3
- metadata.gz: f2f02c2941a93861999c265020d2008f2b525f80fdc53b3543852e0d6beb7579
4
- data.tar.gz: 69be3d35c0e9774c4d7a6ae408109e3c851f45b7c4d0f14518efa14ade485c85
3
+ metadata.gz: 32eb6004a8e892ed5eb61d3faecd2aa246dbf349ce0f0ef5500bd0e9b34b621a
4
+ data.tar.gz: b4e694d2bac987d1cd237767c226e3fef21ada50c891084deb69311906bccf82
5
5
  SHA512:
6
- metadata.gz: bb4d9e899a38cbae99706313730f496e38da9899c060e8013e6aa3ea272ad36c27c553dc425a11447b4c86fbe50c7fc957b40f5bf8b0c562863b627a67bba87c
7
- data.tar.gz: 6701a2233d6e71c6dd23444a7c80d58307a8ccb493e52afe6ab912c3221b1c0fbce99d622869bcde6a03c17f4f42af16810e99f8cce15b33d2e8896db0da2ec9
6
+ metadata.gz: 45cfef0803c0b129260ec08420a4b4be3e396658a97f2bfb937200c7e4e94d1b0573beef1ac808013ef2d00e86cd9d014001a8eb3562de268eda5c2e81d76b12
7
+ data.tar.gz: 5cc607a6a99cb383a2b9e17c53d81f358f11d98bbf1fb6cf3f5545bf19e9f95df34289eecf2d95a8feb0d9ab5a5af907bc6a01d58c22b177c581d0d192b0609c
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- silent_bob (0.2.5)
4
+ silent_bob (0.2.7)
5
5
  http (~> 4.3)
6
6
  mail (~> 2.5)
7
7
 
@@ -2,6 +2,7 @@ require 'silent_bob/version'
2
2
  require 'openssl'
3
3
  require 'http'
4
4
  require 'base64'
5
+ require 'mail'
5
6
  require 'silent_bob/configuration'
6
7
  require 'silent_bob/configuration_keeper'
7
8
  require 'silent_bob/delivery'
@@ -36,7 +36,7 @@ module SilentBob
36
36
 
37
37
  def convert_attachments
38
38
  mail.attachments&.map do |attachment|
39
- { name: attachment.filename, body: attachment.body.to_s&.force_encoding('UTF-8')&.encode }
39
+ { name: attachment.filename, body: attachment.body }
40
40
  end
41
41
  end
42
42
  end
@@ -44,8 +44,16 @@ module SilentBob
44
44
 
45
45
  def handle_attachments(attachments)
46
46
  attachments&.map do |attachment|
47
- { name: attachment[:name], body: attachment[:body]&.to_s }
47
+ {
48
+ name: attachment[:name],
49
+ body: Base64.encode64(attachment_body(attachment))
50
+ }
48
51
  end
49
52
  end
53
+
54
+ def attachment_body(attachment)
55
+ body = attachment[:body]
56
+ body.is_a?(Mail::Part) ? body.decoded&.to_s : body.to_s
57
+ end
50
58
  end
51
59
  end
@@ -1,3 +1,3 @@
1
1
  module SilentBob
2
- VERSION = '0.2.5'.freeze
2
+ VERSION = '0.2.7'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: silent_bob
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrey Lobanov