mailersend-ruby 1.5.0 → 1.5.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
  SHA256:
3
- metadata.gz: 119a856edc8f4a572776df083628ac9e91b03ad7d84c010d000f659dea7c5d02
4
- data.tar.gz: e8c4db7ef5ee7753acdeef7fb2e6696c215b614dc0c84c4c78b1e8dbeeb4b069
3
+ metadata.gz: 7f52bbbd2d912636c141fb8806196c42020a2519b01fedcd0cae0d9daaddcc54
4
+ data.tar.gz: 5b41dfa0deb782158ac72ad3a3d02686fd1bfa2332bdba3d730840d329611416
5
5
  SHA512:
6
- metadata.gz: ce60ac31b7af6e94b5b1ea51b9d7f4e0fa16b56bc870576b4ed49df45f93f032e6bcf68870d591ee84518dc248918086c5723e9bcf23b9b039d69276ebf6cbd5
7
- data.tar.gz: da94cb3b0fa6c9e92037401bb0d0adf6e70a84d9a066266bdcdef0bc038d9c01eb8db42280fac757853bb9e50d55942cc23c159dab358d6c5df1acb5db29f906
6
+ metadata.gz: adf9d68a242b761630343959abd74d0ca704b6753ca184bd849aa6848a28db524edbd9cf87a4402e32d1b4c6c4860f14db148ea8f8eaefe9e620661bbb19a83e
7
+ data.tar.gz: 77613e73b046b527e3bbb3d1fd32f66cf06a0aa06e2298807222856abdb6b3a816e54681285ad004517d4d947d99802d0f87446bbaf927ea2f122b15ca1857a5
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Released]
2
2
 
3
+ ## [1.5.1] - 2023-05-09
4
+
5
+ - Added supports for base64 attachment
6
+
3
7
  ## [1.5.0] - 2023-05-08
4
8
 
5
9
  - API Quota
@@ -87,13 +87,19 @@ module Mailersend
87
87
  end
88
88
 
89
89
  def add_attachment(content:, filename:, disposition:)
90
- data = File.read(content.to_s)
91
- encoded = Base64.strict_encode64(data)
92
- @attachments << {
93
- 'content' => encoded,
94
- 'filename' => filename,
95
- 'disposition' => disposition
96
- }
90
+ # content: Can be one of the following:
91
+ # file_path(String) i.e. 'app/Sample-jpg-image-50kb.jpeg'
92
+ # Base64 encoded string (String)
93
+ # Supported types are: https://developers.mailersend.com/api/v1/email.html#supported-file-types
94
+
95
+ content_string = content.to_s
96
+ if File.readable?(content_string)
97
+ data = File.read(content_string)
98
+ base64_encoded = Base64.strict_encode64(data)
99
+ else
100
+ base64_encoded = content_string
101
+ end
102
+ @attachments << { 'content' => base64_encoded, 'filename' => filename, 'disposition' => disposition }
97
103
  end
98
104
 
99
105
  def add_send_at(send_at)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Mailersend
4
- VERSION = '1.5.0'
4
+ VERSION = '1.5.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mailersend-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nikola Milojević