mailersend-ruby 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -1
- data/README.md +39 -0
- data/lib/mailersend/bulk_email/bulk_email.rb +36 -0
- data/lib/mailersend/version.rb +1 -1
- data/lib/mailersend.rb +1 -0
- data/mailersend-ruby.gemspec +1 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '08ba885c0049c372636873518510b62965493ebbcd9198111d72308d17a7b0f2'
|
4
|
+
data.tar.gz: 74ac4b75d90f18c2d7e57a65d32925a5d8d112ccd13529409156c71a87451ce1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92cb6a3deb8cae056d38dbd7a64fb17c5a9ee5d4e30ef040687c4b81870f01eced6d4ae99d7f9cdb9e126a5aedb88dd0955cae8db58f0aac80435ece8e640791
|
7
|
+
data.tar.gz: 8fdcb78aff4eea89a2b97c9ba91f20fa65c77aa46f1400f7f2b1be4a2c8b0365ddfafff4944fe27b3430db9d059892156a9472e69ea838e868322c0d6a9d944d
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -13,6 +13,9 @@ MailerSend Ruby SDK
|
|
13
13
|
- [Send a template-based email](#send-a-template-based-email)
|
14
14
|
- [Advanced personalization](#advanced-personalization)
|
15
15
|
- [Simple personalization](#simple-personalization)
|
16
|
+
- [Bulk Email](#bulk-email)
|
17
|
+
- [Send bulk email](#send-bulk-email)
|
18
|
+
- [Get bulk email status](#get-bulk-email-status)
|
16
19
|
- [Tokens](#tokens)
|
17
20
|
- [Create a token](#create-a-token)
|
18
21
|
- [Update a token](#update-a-token)
|
@@ -189,6 +192,42 @@ ms_email.add_variables(variables)
|
|
189
192
|
ms_email.send
|
190
193
|
```
|
191
194
|
|
195
|
+
## Bulk Email
|
196
|
+
|
197
|
+
### Send bulk email
|
198
|
+
```ruby
|
199
|
+
require "mailersend-ruby"
|
200
|
+
|
201
|
+
ms_bulk_email = Mailersend::BulkEmail.new
|
202
|
+
|
203
|
+
ms_bulk_email.messages = [
|
204
|
+
{
|
205
|
+
'from' => {"email" => "april@parksandrec.com", "name" => "April"},
|
206
|
+
'to' => [{"email" => "ron@parksandrec.com", "name" => "Ron"}],
|
207
|
+
'subject' => "Time",
|
208
|
+
'text' => "Time is money, money is power, power is pizza, and pizza is knowledge. Let's go.",
|
209
|
+
'html' => "<b>Time is money, money is power, power is pizza, and pizza is knowledge. Let's go.</b>",
|
210
|
+
},
|
211
|
+
{
|
212
|
+
'from' => {"email" => "april@parksandrec.com", "name" => "April"},
|
213
|
+
'to' => [{"email" => "leslie@parksandrec.com", "name" => "Leslie"}],
|
214
|
+
'subject' => "Lorem Ipsum",
|
215
|
+
'text' => "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
|
216
|
+
'html' => "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>",
|
217
|
+
}
|
218
|
+
]
|
219
|
+
|
220
|
+
ms_bulk_email.send
|
221
|
+
```
|
222
|
+
|
223
|
+
### Get bulk email status
|
224
|
+
```ruby
|
225
|
+
require "mailersend-ruby"
|
226
|
+
|
227
|
+
ms_bulk_email = Mailersend::BulkEmail.new
|
228
|
+
ms_bulk_email.get_bulk_status(bulk_email_id: 'yourbulkemailid')
|
229
|
+
```
|
230
|
+
|
192
231
|
## Tokens
|
193
232
|
|
194
233
|
### Create a token
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'base64'
|
4
|
+
|
5
|
+
module Mailersend
|
6
|
+
# Send an email through MailerSend API
|
7
|
+
class BulkEmail
|
8
|
+
attr_accessor :client,
|
9
|
+
:messages
|
10
|
+
|
11
|
+
def initialize(client = Mailersend::Client.new)
|
12
|
+
@client = client
|
13
|
+
@messages = []
|
14
|
+
end
|
15
|
+
|
16
|
+
def add_attachment(content:, filename:)
|
17
|
+
data = File.open(content.to_s).read
|
18
|
+
encoded = Base64.strict_encode64(data)
|
19
|
+
@attachments << {
|
20
|
+
'content' => encoded,
|
21
|
+
'filename' => filename
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
def send
|
26
|
+
response = client.http.post("#{API_URL}/bulk-email", json: @messages)
|
27
|
+
puts response
|
28
|
+
puts response.status.code
|
29
|
+
end
|
30
|
+
|
31
|
+
def get_bulk_status(bulk_email_id:)
|
32
|
+
response = client.http.get(URI::HTTPS.build(host: API_BASE_HOST, path: "/v1/bulk-email/#{bulk_email_id}"))
|
33
|
+
puts response
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
data/lib/mailersend/version.rb
CHANGED
data/lib/mailersend.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
require_relative 'mailersend/client'
|
4
4
|
require_relative 'mailersend/activity/activity'
|
5
5
|
require_relative 'mailersend/analytics/analytics'
|
6
|
+
require_relative 'mailersend/bulk_email/bulk_email'
|
6
7
|
require_relative 'mailersend/domains/domains'
|
7
8
|
require_relative 'mailersend/email/email'
|
8
9
|
require_relative 'mailersend/messages/messages'
|
data/mailersend-ruby.gemspec
CHANGED
@@ -21,6 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.metadata['homepage_uri'] = spec.homepage
|
22
22
|
spec.metadata['source_code_uri'] = 'https://github.com/mailersend/mailersend-ruby'
|
23
23
|
spec.metadata['changelog_uri'] = 'https://github.com/mailersend/mailersend-ruby/blob/main/CHANGELOG.md'
|
24
|
+
spec.metadata['rubygems_mfa_required'] = 'true'
|
24
25
|
|
25
26
|
spec.files = `git ls-files -z`.split("\x0")
|
26
27
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mailersend-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nikola Milojević
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -133,6 +133,7 @@ files:
|
|
133
133
|
- lib/mailersend.rb
|
134
134
|
- lib/mailersend/activity/activity.rb
|
135
135
|
- lib/mailersend/analytics/analytics.rb
|
136
|
+
- lib/mailersend/bulk_email/bulk_email.rb
|
136
137
|
- lib/mailersend/client.rb
|
137
138
|
- lib/mailersend/domains/domains.rb
|
138
139
|
- lib/mailersend/email/email.rb
|
@@ -153,6 +154,7 @@ metadata:
|
|
153
154
|
homepage_uri: https://www.mailersend.com
|
154
155
|
source_code_uri: https://github.com/mailersend/mailersend-ruby
|
155
156
|
changelog_uri: https://github.com/mailersend/mailersend-ruby/blob/main/CHANGELOG.md
|
157
|
+
rubygems_mfa_required: 'true'
|
156
158
|
post_install_message:
|
157
159
|
rdoc_options: []
|
158
160
|
require_paths:
|