mailersend-ruby 0.1.9 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +42 -0
- data/lib/mailersend.rb +1 -0
- data/lib/mailersend/templates/templates.rb +40 -0
- data/lib/mailersend/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c4e0823bdc82739f6623c90f41582065cb9ef11abeafb918f19464004c8f771b
|
4
|
+
data.tar.gz: 617c135a9ccfeacbc578cd51335fa14ee78b07ed6c9222924e8fda0977ec9df3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b0cd7c1327c248a64229318d292ea6a410b926dad0892b8d06fa02e8959a6456605ef459962e303cf50f0ba4648b1d09f060a7b0d22e8cc5448cb39d1cd8843
|
7
|
+
data.tar.gz: 10d4ef77fb271eef8eef32025a4eba43e7096fb1501d5aa00a8d9cc831c3331bc425f20776366d17cb1c99c421759b103d71410019f4967ba54b626052fe7c34
|
data/README.md
CHANGED
@@ -42,6 +42,11 @@ MailerSend Ruby SDK
|
|
42
42
|
- [Get a webhook](#get-a-webhook)
|
43
43
|
- [Create a webhook](#create-a-webhook)
|
44
44
|
- [Update a webhook](#update-a-webhook)
|
45
|
+
- [Delete a webhook](#delete-a-webhook)
|
46
|
+
- [Templates](#templates)
|
47
|
+
- [Get templates](#get-templates)
|
48
|
+
- [Get a single template](#get-a-single-template)
|
49
|
+
- [Delete template](#delete-template)
|
45
50
|
- [Support and Feedback](#support-and-feedback)
|
46
51
|
- [License](#license)
|
47
52
|
|
@@ -400,6 +405,43 @@ ms_webhooks = Mailersend::Webhooks.new
|
|
400
405
|
ms_webhooks.update(webhook_id: "zzz2241ll", enabled: false)
|
401
406
|
```
|
402
407
|
|
408
|
+
### Delete a webhook
|
409
|
+
```ruby
|
410
|
+
require "mailersend-ruby"
|
411
|
+
|
412
|
+
ms_webhooks = Mailersend::Webhooks.new
|
413
|
+
ms_webhooks.delete(webhook_id: "zzz2241ll")
|
414
|
+
```
|
415
|
+
|
416
|
+
## Templates
|
417
|
+
|
418
|
+
### Get templates
|
419
|
+
|
420
|
+
```ruby
|
421
|
+
require "mailersend-ruby"
|
422
|
+
|
423
|
+
ms_templates = Mailersend::Templates.new
|
424
|
+
ms_templates.list(domain_id: "aax455lll", page: 1, limit: 10)
|
425
|
+
```
|
426
|
+
|
427
|
+
### Get a single template
|
428
|
+
|
429
|
+
```ruby
|
430
|
+
require "mailersend-ruby"
|
431
|
+
|
432
|
+
ms_templates = Mailersend::Templates.new
|
433
|
+
ms_templates.single(template_id: "id124")
|
434
|
+
```
|
435
|
+
|
436
|
+
### Delete template
|
437
|
+
|
438
|
+
```ruby
|
439
|
+
require "mailersend-ruby"
|
440
|
+
|
441
|
+
ms_templates = Mailersend::Templates.new
|
442
|
+
ms_templates.delete(template_id: "id124")
|
443
|
+
```
|
444
|
+
|
403
445
|
# Support and Feedback
|
404
446
|
|
405
447
|
In case you find any bugs, submit an issue directly here in GitHub.
|
data/lib/mailersend.rb
CHANGED
@@ -7,5 +7,6 @@ require "mailersend/domains/domains"
|
|
7
7
|
require "mailersend/email/email"
|
8
8
|
require "mailersend/messages/messages"
|
9
9
|
require "mailersend/recipients/recipients"
|
10
|
+
require "mailersend/templates/templates"
|
10
11
|
require "mailersend/tokens/tokens"
|
11
12
|
require "mailersend/webhooks/webhooks"
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Mailersend
|
4
|
+
# Templates endpoint from MailerSend API.
|
5
|
+
class Templates
|
6
|
+
attr_accessor :client,
|
7
|
+
:page,
|
8
|
+
:limit,
|
9
|
+
:template_id
|
10
|
+
|
11
|
+
def initialize(client = Mailersend::Client.new)
|
12
|
+
@client = client
|
13
|
+
@page = page
|
14
|
+
@limit = limit
|
15
|
+
@template_id = template_id
|
16
|
+
end
|
17
|
+
|
18
|
+
def list(domain_id: nil, page: nil, limit: nil)
|
19
|
+
hash = {
|
20
|
+
"domain_id" => domain_id,
|
21
|
+
"page" => page,
|
22
|
+
"limit" => limit
|
23
|
+
}
|
24
|
+
|
25
|
+
response = client.http.get(URI::HTTPS.build(host: API_BASE_HOST, path: "/v1/templates",
|
26
|
+
query: URI.encode_www_form(hash)))
|
27
|
+
puts response
|
28
|
+
end
|
29
|
+
|
30
|
+
def single(template_id:)
|
31
|
+
response = client.http.get("#{API_URL}/templates/#{template_id}")
|
32
|
+
puts response
|
33
|
+
end
|
34
|
+
|
35
|
+
def delete(template_id:)
|
36
|
+
response = client.http.delete("#{API_URL}/templates/#{template_id}")
|
37
|
+
puts response
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
data/lib/mailersend/version.rb
CHANGED
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.
|
4
|
+
version: 0.2.0
|
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-07-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -138,6 +138,7 @@ files:
|
|
138
138
|
- lib/mailersend/email/email.rb
|
139
139
|
- lib/mailersend/messages/messages.rb
|
140
140
|
- lib/mailersend/recipients/recipients.rb
|
141
|
+
- lib/mailersend/templates/templates.rb
|
141
142
|
- lib/mailersend/tokens/tokens.rb
|
142
143
|
- lib/mailersend/version.rb
|
143
144
|
- lib/mailersend/webhooks/webhooks.rb
|