mailersend-ruby 0.1.0 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.env.example +1 -1
- data/CHANGELOG.md +20 -0
- data/README.md +49 -61
- data/lib/mailersend/activity/activity.rb +1 -1
- data/lib/mailersend/client.rb +1 -1
- data/lib/mailersend/domains/domains.rb +2 -2
- data/lib/mailersend/tokens/tokens.rb +2 -2
- data/lib/mailersend/version.rb +1 -1
- data/mailersend-ruby.gemspec +2 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ac665fe97374d246c31952ff4e34a63c0a302e2833186a27750424450ebf332
|
4
|
+
data.tar.gz: 121fc72092e62063cfaa753e72272c4ff03b2038ff5eec7eb7431884e3b6995a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 395e71b85cff75f893a0f7f522d70b059ee893b06bece2ed42965587cce2cdb120c1bb822999d3d55ee33792e1e1058c83f504737ef2c05136c9249e1a2410c7
|
7
|
+
data.tar.gz: 90805ef350b1ec3f3efccefe12e5fb05f16d2ac8035e545e40811bb6bf3cf37497eee215394198d20644ef421d278735259f0bbfe64745c173c868bb7e862659
|
data/.env.example
CHANGED
@@ -1 +1 @@
|
|
1
|
-
API_TOKEN="
|
1
|
+
API_TOKEN="superlongkey"
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,25 @@
|
|
1
1
|
## [Released]
|
2
2
|
|
3
|
+
## [0.1.5] - 2021-06-15
|
4
|
+
|
5
|
+
- Fixed arguments error in Domains list
|
6
|
+
|
7
|
+
## [0.1.4] - 2021-06-15
|
8
|
+
|
9
|
+
- Fixed Domains init
|
10
|
+
|
11
|
+
## [0.1.3] - 2021-06-14
|
12
|
+
|
13
|
+
- Updated gem description
|
14
|
+
|
15
|
+
## [0.1.2] - 2021-06-14
|
16
|
+
|
17
|
+
- Fixed activity and tokens endpoints.
|
18
|
+
|
19
|
+
## [0.1.1] - 2021-06-14
|
20
|
+
|
21
|
+
- Updated token format so you don't have to include `Bearer` in env variable.
|
22
|
+
|
3
23
|
## [0.1.0] - 2021-06-14
|
4
24
|
|
5
25
|
- Initial release
|
data/README.md
CHANGED
@@ -9,8 +9,12 @@ MailerSend Ruby SDK
|
|
9
9
|
- [Usage](#usage)
|
10
10
|
- [Email](#email)
|
11
11
|
- [Send an email](#send-an-email)
|
12
|
-
- [
|
13
|
-
- [Send a
|
12
|
+
- [Add CC, BCC recipients](#add-cc-bcc-recipients)
|
13
|
+
- [Send a template-based email](#send-a-template-based-email)
|
14
|
+
- [Tokens](#tokens)
|
15
|
+
- [Create a token](#create-a-token)
|
16
|
+
- [Update a token](#update-a-token)
|
17
|
+
- [Delete a token](#delete-a-token)
|
14
18
|
- [Advanced personalization](#advanced-personalization)
|
15
19
|
- [Simple personalization](#simple-personalization)
|
16
20
|
- [Send email with attachment](#send-email-with-attachment)
|
@@ -33,10 +37,6 @@ MailerSend Ruby SDK
|
|
33
37
|
- [Get recipients](#get-recipients)
|
34
38
|
- [Get a single recipient](#get-a-single-recipient)
|
35
39
|
- [Delete a recipient](#delete-a-recipient)
|
36
|
-
- [Tokens](#tokens)
|
37
|
-
- [Create a token](#create-a-token)
|
38
|
-
- [Update a token](#update-a-token)
|
39
|
-
- [Delete a token](#delete-a-token)
|
40
40
|
- [Webhooks](#webhooks)
|
41
41
|
- [List webhooks](#list-webhooks)
|
42
42
|
- [Get a webhook](#get-a-webhook)
|
@@ -81,7 +81,7 @@ ms_email.add_html("<b>Time is money, money is power, power is pizza, and pizza i
|
|
81
81
|
ms_email.send
|
82
82
|
```
|
83
83
|
|
84
|
-
###
|
84
|
+
### Add CC, BCC recipients
|
85
85
|
|
86
86
|
```ruby
|
87
87
|
require "mailersend-ruby"
|
@@ -103,7 +103,7 @@ ms_email.add_html("<b>Time is money, money is power, power is pizza, and pizza i
|
|
103
103
|
ms_email.send
|
104
104
|
```
|
105
105
|
|
106
|
-
### Send a
|
106
|
+
### Send a template-based email
|
107
107
|
|
108
108
|
```ruby
|
109
109
|
require "mailersend-ruby"
|
@@ -122,6 +122,32 @@ ms_email.add_template_id(12415125)
|
|
122
122
|
ms_email.send
|
123
123
|
```
|
124
124
|
|
125
|
+
## Tokens
|
126
|
+
|
127
|
+
### Create a token
|
128
|
+
```ruby
|
129
|
+
require "mailersend-ruby"
|
130
|
+
|
131
|
+
ms_tokens = Mailersend::Tokens.new
|
132
|
+
ms_tokens.create(name: "Very nice token", scopes: %w[ email_full domains_read ])
|
133
|
+
```
|
134
|
+
|
135
|
+
### Update a token
|
136
|
+
```ruby
|
137
|
+
require "mailersend-ruby"
|
138
|
+
|
139
|
+
ms_tokens = Mailersend::Tokens.new
|
140
|
+
ms_tokens.update(token_id: "d2220fx04", status: "paused")
|
141
|
+
```
|
142
|
+
|
143
|
+
### Delete a token
|
144
|
+
```ruby
|
145
|
+
require "mailersend-ruby"
|
146
|
+
|
147
|
+
ms_tokens = Mailersend::Tokens.new
|
148
|
+
ms_tokens.delete(token_id: "d2220fx04")
|
149
|
+
```
|
150
|
+
|
125
151
|
### Advanced personalization
|
126
152
|
|
127
153
|
```ruby
|
@@ -132,26 +158,15 @@ ms_email = Mailersend::Email.new
|
|
132
158
|
|
133
159
|
# Add parameters
|
134
160
|
ms_email.add_recipients("email" => "ron@parksandrec.com", "name" => "Ron")
|
135
|
-
ms_email.add_recipients("email" => "leslie@parksandrec.com", "name" => "Leslie")
|
136
161
|
ms_email.add_from("email" => "april@parksandrec.com", "name" => "April")
|
137
|
-
ms_email.add_subject("Time")
|
138
|
-
ms_email.add_text("Time is money, money is power, power is pizza, and pizza is knowledge. Let's go.")
|
139
|
-
ms_email.add_html("<b>Time is money, money is power, power is pizza, and pizza is knowledge. Let's go.</b>")
|
162
|
+
ms_email.add_subject("Time {{ test }}")
|
163
|
+
ms_email.add_text("{{ test }}Time is money, money is power, power is pizza, and pizza is knowledge. Let's go.")
|
164
|
+
ms_email.add_html("<b>{{ test }}Time is money, money is power, power is pizza, and pizza is knowledge. Let's go.</b>")
|
140
165
|
|
141
166
|
personalization = {
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
"boolean": true,
|
146
|
-
"object": {
|
147
|
-
"key": "object-value"
|
148
|
-
},
|
149
|
-
"number": 2,
|
150
|
-
"array": [
|
151
|
-
1,
|
152
|
-
2,
|
153
|
-
3
|
154
|
-
]
|
167
|
+
email: 'ron@parksandrec.com',
|
168
|
+
data: {
|
169
|
+
test: 'Test Value'
|
155
170
|
}
|
156
171
|
}
|
157
172
|
|
@@ -170,18 +185,17 @@ ms_email = Mailersend::Email.new
|
|
170
185
|
|
171
186
|
# Add parameters
|
172
187
|
ms_email.add_recipients("email" => "ron@parksandrec.com", "name" => "Ron")
|
173
|
-
ms_email.add_recipients("email" => "leslie@parksandrec.com", "name" => "Leslie")
|
174
188
|
ms_email.add_from("email" => "april@parksandrec.com", "name" => "April")
|
175
|
-
ms_email.add_subject("Time")
|
176
|
-
ms_email.add_text("Time is money, money is power, power is pizza, and pizza is knowledge. Let's go.")
|
177
|
-
ms_email.add_html("<b>Time is money, money is power, power is pizza, and pizza is knowledge. Let's go.</b>")
|
189
|
+
ms_email.add_subject("Time {$test}")
|
190
|
+
ms_email.add_text("{$test} Time is money, money is power, power is pizza, and pizza is knowledge. Let's go.")
|
191
|
+
ms_email.add_html("<b>{$test} Time is money, money is power, power is pizza, and pizza is knowledge. Let's go.</b>")
|
178
192
|
|
179
193
|
variables = {
|
180
|
-
|
181
|
-
|
194
|
+
email: 'ron@parksandrec.com',
|
195
|
+
substitutions: [
|
182
196
|
{
|
183
|
-
|
184
|
-
|
197
|
+
var: 'test',
|
198
|
+
value: 'Test Value'
|
185
199
|
}
|
186
200
|
]
|
187
201
|
}
|
@@ -235,7 +249,7 @@ ms_activity.get(domain_id: "xxx2241ll", page: 3, limit: 5, date_from: 1620643567
|
|
235
249
|
require "mailersend-ruby"
|
236
250
|
|
237
251
|
ms_analytics = Mailersend::Analytics.new
|
238
|
-
ms_analytics.date(date_from: 1620643567, date_to: 1623321967, events: %w[sent queued])
|
252
|
+
ms_analytics.date(date_from: 1620643567, date_to: 1623321967, events: %w[sent queued])
|
239
253
|
```
|
240
254
|
|
241
255
|
### Opens by country
|
@@ -352,32 +366,6 @@ ms_recipients = Mailersend::Recipients.new
|
|
352
366
|
ms_recipients.delete(recipient_id: "id124")
|
353
367
|
```
|
354
368
|
|
355
|
-
## Tokens
|
356
|
-
|
357
|
-
### Create a token
|
358
|
-
```ruby
|
359
|
-
require "mailersend-ruby"
|
360
|
-
|
361
|
-
ms_tokens = Mailersend::Tokens.new
|
362
|
-
ms_tokens.create(name: "Very nice token", scopes: %w[ email_full domains_read ])
|
363
|
-
```
|
364
|
-
|
365
|
-
### Update a token
|
366
|
-
```ruby
|
367
|
-
require "mailersend-ruby"
|
368
|
-
|
369
|
-
ms_tokens = Mailersend::Tokens.new
|
370
|
-
ms_tokens.update(token_id: "d2220fx04", name: "Very nice token", scopes: %w[ email_full domains_read activity_read ])
|
371
|
-
```
|
372
|
-
|
373
|
-
### Delete a token
|
374
|
-
```ruby
|
375
|
-
require "mailersend-ruby"
|
376
|
-
|
377
|
-
ms_tokens = Mailersend::Tokens.new
|
378
|
-
ms_tokens.delete(token_id: "d2220fx04")
|
379
|
-
```
|
380
|
-
|
381
369
|
## Webhooks
|
382
370
|
|
383
371
|
### List webhooks
|
@@ -424,4 +412,4 @@ The official documentation is at [https://developers.mailersend.com](https://dev
|
|
424
412
|
|
425
413
|
# License
|
426
414
|
|
427
|
-
[The MIT License (MIT)](LICENSE)
|
415
|
+
[The MIT License (MIT)](LICENSE)
|
@@ -27,7 +27,7 @@ module Mailersend
|
|
27
27
|
date_to: date_to
|
28
28
|
}
|
29
29
|
|
30
|
-
response = client.http.get(URI::HTTPS.build(host: API_BASE_HOST, path: "/v1/
|
30
|
+
response = client.http.get(URI::HTTPS.build(host: API_BASE_HOST, path: "/v1/activity/#{domain_id}",
|
31
31
|
query: URI.encode_www_form(hash.compact)))
|
32
32
|
puts response
|
33
33
|
end
|
data/lib/mailersend/client.rb
CHANGED
@@ -9,7 +9,7 @@ module Mailersend
|
|
9
9
|
:limit,
|
10
10
|
:verified
|
11
11
|
|
12
|
-
def initialize(client = Mailersend.
|
12
|
+
def initialize(client = Mailersend::Client.new)
|
13
13
|
@client = client
|
14
14
|
@domain_id = domain_id
|
15
15
|
@page = page
|
@@ -17,7 +17,7 @@ module Mailersend
|
|
17
17
|
@verified = verified
|
18
18
|
end
|
19
19
|
|
20
|
-
def list
|
20
|
+
def list(domain_id:, page: nil, limit: nil, verified: nil)
|
21
21
|
hash = {
|
22
22
|
"page" => page,
|
23
23
|
"limit" => limit,
|
data/lib/mailersend/version.rb
CHANGED
data/mailersend-ruby.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
|
|
11
11
|
spec.email = ["info@mailersend.com"]
|
12
12
|
|
13
13
|
spec.summary = "MailerSend's official Ruby SDK"
|
14
|
-
spec.description = "MailerSend's official Ruby SDK. Interacts
|
14
|
+
spec.description = "MailerSend's official Ruby SDK. Interacts with all endpoints at MailerSend API."
|
15
15
|
spec.homepage = "https://www.mailersend.com"
|
16
16
|
spec.license = "MIT"
|
17
17
|
spec.required_ruby_version = ">= 2.5.0"
|
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.metadata["homepage_uri"] = spec.homepage
|
22
22
|
spec.metadata["source_code_uri"] = "https://github.com/mailersend/mailersend-ruby"
|
23
|
-
spec.metadata["changelog_uri"] = "https://github.com/mailersend/mailersend-ruby/CHANGELOG.md"
|
23
|
+
spec.metadata["changelog_uri"] = "https://github.com/mailersend/mailersend-ruby/blob/main/CHANGELOG.md"
|
24
24
|
|
25
25
|
spec.files = `git ls-files -z`.split("\x0")
|
26
26
|
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.1.
|
4
|
+
version: 0.1.5
|
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-06-
|
11
|
+
date: 2021-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -108,7 +108,7 @@ dependencies:
|
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: 0.10.1
|
111
|
-
description: MailerSend's official Ruby SDK. Interacts
|
111
|
+
description: MailerSend's official Ruby SDK. Interacts with all endpoints at MailerSend
|
112
112
|
API.
|
113
113
|
email:
|
114
114
|
- info@mailersend.com
|
@@ -149,7 +149,7 @@ metadata:
|
|
149
149
|
allowed_push_host: https://rubygems.org
|
150
150
|
homepage_uri: https://www.mailersend.com
|
151
151
|
source_code_uri: https://github.com/mailersend/mailersend-ruby
|
152
|
-
changelog_uri: https://github.com/mailersend/mailersend-ruby/CHANGELOG.md
|
152
|
+
changelog_uri: https://github.com/mailersend/mailersend-ruby/blob/main/CHANGELOG.md
|
153
153
|
post_install_message:
|
154
154
|
rdoc_options: []
|
155
155
|
require_paths:
|