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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0f11b89a182816197699f2c30fc072c86e6243dabfb7ea7089314f1b9c48fa5c
4
- data.tar.gz: 6f70d52ec51ea4f7415bddf0401039ead13cbe7d951b5be6efb635059755c02d
3
+ metadata.gz: c4e0823bdc82739f6623c90f41582065cb9ef11abeafb918f19464004c8f771b
4
+ data.tar.gz: 617c135a9ccfeacbc578cd51335fa14ee78b07ed6c9222924e8fda0977ec9df3
5
5
  SHA512:
6
- metadata.gz: 2f7997c489fd9d5fd1521cc0f087b7a2942daa9a082f38926238addae6a600d802637ba760a9e1ac292330940becddd97c15c2eb595dfc4a9fe1929f1554de81
7
- data.tar.gz: ec6ad6558b98f87b89f6770bba4cd240c8023d888cb1c9b82117da9d6ce5f587e9fa7d1493a8ab078b89ea78de30cebda55fdb14d2316679401d60c992f4446b
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Mailersend
4
- VERSION = "0.1.9"
4
+ VERSION = "0.2.0"
5
5
  end
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.9
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-06-28 00:00:00.000000000 Z
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