mailersend-ruby 0.1.5 → 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/CHANGELOG.md +12 -0
- data/README.md +45 -3
- data/lib/mailersend.rb +1 -0
- data/lib/mailersend/domains/domains.rb +12 -1
- data/lib/mailersend/templates/templates.rb +40 -0
- data/lib/mailersend/tokens/tokens.rb +3 -2
- data/lib/mailersend/version.rb +1 -1
- data/mailersend-ruby.gemspec +1 -1
- metadata +4 -3
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/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
## [Released]
|
2
2
|
|
3
|
+
## [0.1.8] - 2021-06-15
|
4
|
+
|
5
|
+
- Fixed unused parameter
|
6
|
+
|
7
|
+
## [0.1.7] - 2021-06-15
|
8
|
+
|
9
|
+
- Added required parameter for token creation
|
10
|
+
-
|
11
|
+
## [0.1.6] - 2021-06-15
|
12
|
+
|
13
|
+
- Fixed small issues in Domains
|
14
|
+
|
3
15
|
## [0.1.5] - 2021-06-15
|
4
16
|
|
5
17
|
- Fixed arguments error in Domains list
|
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
|
|
@@ -129,7 +134,7 @@ ms_email.send
|
|
129
134
|
require "mailersend-ruby"
|
130
135
|
|
131
136
|
ms_tokens = Mailersend::Tokens.new
|
132
|
-
ms_tokens.create(name: "Very nice token", scopes: %w[ email_full domains_read ])
|
137
|
+
ms_tokens.create(name: "Very nice token", scopes: %w[ email_full domains_read ], domain_id: "yourdomainid")
|
133
138
|
```
|
134
139
|
|
135
140
|
### Update a token
|
@@ -296,7 +301,7 @@ ms_domains.list
|
|
296
301
|
require "mailersend-ruby"
|
297
302
|
|
298
303
|
ms_domains = Mailersend::Domains.new
|
299
|
-
ms_domains.
|
304
|
+
ms_domains.single(domain_id: "idofdomain12412")
|
300
305
|
```
|
301
306
|
|
302
307
|
### Delete a domain
|
@@ -381,7 +386,7 @@ ms_webhooks.list(domain_id: "xxx2241ll")
|
|
381
386
|
require "mailersend-ruby"
|
382
387
|
|
383
388
|
ms_webhooks = Mailersend::Webhooks.new
|
384
|
-
ms_webhooks.
|
389
|
+
ms_webhooks.single(webhook_id: "zzz2241ll")
|
385
390
|
```
|
386
391
|
|
387
392
|
### Create a webhook
|
@@ -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"
|
@@ -17,7 +17,18 @@ module Mailersend
|
|
17
17
|
@verified = verified
|
18
18
|
end
|
19
19
|
|
20
|
-
def list(
|
20
|
+
def list(page: nil, limit: nil, verified: nil)
|
21
|
+
hash = {
|
22
|
+
"page" => page,
|
23
|
+
"limit" => limit,
|
24
|
+
"verified" => verified
|
25
|
+
}
|
26
|
+
response = client.http.get(URI::HTTPS.build(host: API_BASE_HOST, path: "/v1/domains",
|
27
|
+
query: URI.encode_www_form(hash.compact)))
|
28
|
+
puts response
|
29
|
+
end
|
30
|
+
|
31
|
+
def single(domain_id:, page: nil, limit: nil, verified: nil)
|
21
32
|
hash = {
|
22
33
|
"page" => page,
|
23
34
|
"limit" => limit,
|
@@ -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
|
@@ -17,10 +17,11 @@ module Mailersend
|
|
17
17
|
@status = {}
|
18
18
|
end
|
19
19
|
|
20
|
-
def create(name:, scopes:)
|
20
|
+
def create(name:, scopes:, domain_id:)
|
21
21
|
json = {
|
22
22
|
"name" => name,
|
23
|
-
"scopes" => scopes
|
23
|
+
"scopes" => scopes,
|
24
|
+
"domain_id" => domain_id
|
24
25
|
}
|
25
26
|
response = client.http.post("#{API_URL}/token", json: json)
|
26
27
|
puts response
|
data/lib/mailersend/version.rb
CHANGED
data/mailersend-ruby.gemspec
CHANGED
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.add_development_dependency "bundler", "~> 2.2.15"
|
30
30
|
spec.add_development_dependency "rake", "~> 13.0"
|
31
31
|
spec.add_development_dependency "rubocop", "~> 1.7"
|
32
|
-
spec.add_dependency "dotenv
|
32
|
+
spec.add_dependency "dotenv", "~> 2.7"
|
33
33
|
spec.add_dependency "http", "~> 5.0"
|
34
34
|
spec.add_dependency "json", "~> 2.5"
|
35
35
|
spec.add_dependency "uri", "~> 0.10.1"
|
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
|
@@ -53,7 +53,7 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.7'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name: dotenv
|
56
|
+
name: dotenv
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
@@ -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
|