mailersend-ruby 1.0.0 → 1.0.1
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 -0
- data/lib/mailersend/activity/activity.rb +2 -3
- data/lib/mailersend/analytics/analytics.rb +8 -12
- data/lib/mailersend/bulk_email/bulk_email.rb +2 -5
- data/lib/mailersend/client.rb +1 -1
- data/lib/mailersend/domains/domains.rb +8 -13
- data/lib/mailersend/email/email.rb +1 -3
- data/lib/mailersend/messages/messages.rb +3 -5
- data/lib/mailersend/recipients/recipients.rb +4 -7
- data/lib/mailersend/suppressions/suppressions.rb +12 -24
- data/lib/mailersend/templates/templates.rb +4 -7
- data/lib/mailersend/tokens/tokens.rb +3 -6
- data/lib/mailersend/version.rb +1 -1
- data/lib/mailersend/webhooks/webhooks.rb +6 -11
- data/lib/mailersend.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ded61985effba003356ed3d855229fdec41ce8be1be7a36576960e1489f1290
|
4
|
+
data.tar.gz: 68686eeda999cbf33c9e3d4a4b6af052ba71d33651dd4e50d9891fa90c57a35d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7893a39a9222be6667b620f758b45ea8c8597c4a749b285c37e9e68862b47e3661bbec5ee912fe23206e19e4e1da948786836d5080cd590955e02587733e28b
|
7
|
+
data.tar.gz: 9740399eaee44230132a0abf2f1e1b50aff323d13993511c43641302fb1cf574449c8c2b7772b80f6f3b2fb3bbc325fc4b8528af228680e297bb3aee1be466e9
|
data/CHANGELOG.md
CHANGED
@@ -27,9 +27,8 @@ module Mailersend
|
|
27
27
|
date_to: date_to
|
28
28
|
}
|
29
29
|
|
30
|
-
|
31
|
-
|
32
|
-
puts response
|
30
|
+
client.http.get(URI::HTTPS.build(host: API_BASE_HOST, path: "/v1/activity/#{domain_id}",
|
31
|
+
query: URI.encode_www_form(hash.compact)))
|
33
32
|
end
|
34
33
|
end
|
35
34
|
end
|
@@ -34,9 +34,8 @@ module Mailersend
|
|
34
34
|
'tags[]' => tags
|
35
35
|
}
|
36
36
|
|
37
|
-
|
38
|
-
|
39
|
-
puts response
|
37
|
+
client.http.get(URI::HTTPS.build(host: API_BASE_HOST, path: '/v1/analytics/date',
|
38
|
+
query: URI.encode_www_form(hash.compact)))
|
40
39
|
end
|
41
40
|
|
42
41
|
def country(date_from:, date_to:, domain_id: nil, recipient_id: nil, tags: nil)
|
@@ -48,9 +47,8 @@ module Mailersend
|
|
48
47
|
'tags[]': tags
|
49
48
|
}
|
50
49
|
|
51
|
-
|
52
|
-
|
53
|
-
puts response
|
50
|
+
client.http.get(URI::HTTPS.build(host: API_BASE_HOST, path: '/v1/analytics/country',
|
51
|
+
query: URI.encode_www_form(hash.compact)))
|
54
52
|
end
|
55
53
|
|
56
54
|
def ua_name(date_from:, date_to:, domain_id: nil, recipient_id: nil, tags: nil)
|
@@ -62,9 +60,8 @@ module Mailersend
|
|
62
60
|
'tags[]': tags
|
63
61
|
}
|
64
62
|
|
65
|
-
|
66
|
-
|
67
|
-
puts response
|
63
|
+
client.http.get(URI::HTTPS.build(host: API_BASE_HOST, path: '/v1/analytics/ua-name',
|
64
|
+
query: URI.encode_www_form(hash.compact)))
|
68
65
|
end
|
69
66
|
|
70
67
|
def ua_type(date_from:, date_to:, domain_id: nil, recipient_id: nil, tags: nil)
|
@@ -76,9 +73,8 @@ module Mailersend
|
|
76
73
|
'tags[]': tags
|
77
74
|
}
|
78
75
|
|
79
|
-
|
80
|
-
|
81
|
-
puts response
|
76
|
+
client.http.get(URI::HTTPS.build(host: API_BASE_HOST, path: '/v1/analytics/ua-type',
|
77
|
+
query: URI.encode_www_form(hash.compact)))
|
82
78
|
end
|
83
79
|
end
|
84
80
|
end
|
@@ -23,14 +23,11 @@ module Mailersend
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def send
|
26
|
-
|
27
|
-
puts response
|
28
|
-
puts response.status.code
|
26
|
+
client.http.post("#{API_URL}/bulk-email", json: @messages)
|
29
27
|
end
|
30
28
|
|
31
29
|
def get_bulk_status(bulk_email_id:)
|
32
|
-
|
33
|
-
puts response
|
30
|
+
client.http.get(URI::HTTPS.build(host: API_BASE_HOST, path: "/v1/bulk-email/#{bulk_email_id}"))
|
34
31
|
end
|
35
32
|
end
|
36
33
|
end
|
data/lib/mailersend/client.rb
CHANGED
@@ -22,7 +22,7 @@ module Mailersend
|
|
22
22
|
HTTP
|
23
23
|
.timeout(connect: 15, read: 30)
|
24
24
|
.auth("Bearer #{@api_token}")
|
25
|
-
.headers('User-Agent' =>
|
25
|
+
.headers('User-Agent' => "MailerSend-client-ruby/#{Mailersend::VERSION}",
|
26
26
|
'Accept' => 'application/json')
|
27
27
|
end
|
28
28
|
end
|
@@ -23,9 +23,8 @@ module Mailersend
|
|
23
23
|
'limit' => limit,
|
24
24
|
'verified' => verified
|
25
25
|
}
|
26
|
-
|
27
|
-
|
28
|
-
puts response
|
26
|
+
client.http.get(URI::HTTPS.build(host: API_BASE_HOST, path: '/v1/domains',
|
27
|
+
query: URI.encode_www_form(hash.compact)))
|
29
28
|
end
|
30
29
|
|
31
30
|
def single(domain_id:, page: nil, limit: nil, verified: nil)
|
@@ -34,14 +33,12 @@ module Mailersend
|
|
34
33
|
'limit' => limit,
|
35
34
|
'verified' => verified
|
36
35
|
}
|
37
|
-
|
38
|
-
|
39
|
-
puts response
|
36
|
+
client.http.get(URI::HTTPS.build(host: API_BASE_HOST, path: "/v1/domains/#{domain_id}",
|
37
|
+
query: URI.encode_www_form(hash.compact)))
|
40
38
|
end
|
41
39
|
|
42
40
|
def delete(domain_id:)
|
43
|
-
|
44
|
-
puts response
|
41
|
+
client.http.delete(URI::HTTPS.build(host: API_BASE_HOST, path: "/v1/domains/#{domain_id}"))
|
45
42
|
end
|
46
43
|
|
47
44
|
def recipients(domain_id:)
|
@@ -49,9 +46,8 @@ module Mailersend
|
|
49
46
|
'page' => page,
|
50
47
|
'limit' => limit
|
51
48
|
}
|
52
|
-
|
53
|
-
|
54
|
-
puts response
|
49
|
+
client.http.get(URI::HTTPS.build(host: API_BASE_HOST, path: "/v1/domains/#{domain_id}/recipients",
|
50
|
+
query: URI.encode_www_form(hash.compact)))
|
55
51
|
end
|
56
52
|
|
57
53
|
def settings(domain_id:, send_paused: nil, track_clicks: nil, track_opens: nil, track_unsubscribe: nil, track_unsubscribe_html: nil, track_unsubscribe_plain: nil, track_content: nil, custom_tracking_enabled: nil, custom_tracking_subdomain: nil)
|
@@ -66,8 +62,7 @@ module Mailersend
|
|
66
62
|
'custom_tracking_enabled' => custom_tracking_enabled,
|
67
63
|
'custom_tracking_subdomain' => custom_tracking_subdomain
|
68
64
|
}
|
69
|
-
|
70
|
-
puts response
|
65
|
+
client.http.put("#{API_URL}/domains/#{domain_id}/settings", json: hash.compact)
|
71
66
|
end
|
72
67
|
end
|
73
68
|
end
|
@@ -109,9 +109,7 @@ module Mailersend
|
|
109
109
|
'attachments' => @attachments
|
110
110
|
}
|
111
111
|
|
112
|
-
|
113
|
-
puts response
|
114
|
-
puts response.status.code
|
112
|
+
client.http.post("#{API_URL}/email", json: message.delete_if { |_, value| value.to_s.strip == '' || value == [] || value == {} })
|
115
113
|
end
|
116
114
|
end
|
117
115
|
end
|
@@ -21,14 +21,12 @@ module Mailersend
|
|
21
21
|
'limit' => limit
|
22
22
|
}
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
puts response
|
24
|
+
client.http.get(URI::HTTPS.build(host: API_BASE_HOST, path: '/v1/messages',
|
25
|
+
query: URI.encode_www_form(hash)))
|
27
26
|
end
|
28
27
|
|
29
28
|
def single(message_id:)
|
30
|
-
|
31
|
-
puts response
|
29
|
+
client.http.get("#{API_URL}/messages/#{message_id}")
|
32
30
|
end
|
33
31
|
end
|
34
32
|
end
|
@@ -21,19 +21,16 @@ module Mailersend
|
|
21
21
|
'limit' => limit
|
22
22
|
}
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
puts response
|
24
|
+
client.http.get(URI::HTTPS.build(host: API_BASE_HOST, path: '/v1/recipients',
|
25
|
+
query: URI.encode_www_form(hash)))
|
27
26
|
end
|
28
27
|
|
29
28
|
def single(recipient_id:)
|
30
|
-
|
31
|
-
puts response
|
29
|
+
client.http.get("#{API_URL}/recipients/#{recipient_id}")
|
32
30
|
end
|
33
31
|
|
34
32
|
def delete(recipient_id:)
|
35
|
-
|
36
|
-
puts response
|
33
|
+
client.http.delete("#{API_URL}/recipients/#{recipient_id}")
|
37
34
|
end
|
38
35
|
end
|
39
36
|
end
|
@@ -16,23 +16,19 @@ module Mailersend
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def get_from_blocklist(*)
|
19
|
-
|
20
|
-
puts response
|
19
|
+
client.http.get("#{API_URL}/suppressions/blocklist")
|
21
20
|
end
|
22
21
|
|
23
22
|
def get_hard_bounces(*)
|
24
|
-
|
25
|
-
puts response
|
23
|
+
client.http.get("#{API_URL}/suppressions/hard-bounces")
|
26
24
|
end
|
27
25
|
|
28
26
|
def get_spam_complaints(*)
|
29
|
-
|
30
|
-
puts response
|
27
|
+
client.http.get("#{API_URL}/suppressions/spam-complaints")
|
31
28
|
end
|
32
29
|
|
33
30
|
def get_unsubscribes(*)
|
34
|
-
|
35
|
-
puts response
|
31
|
+
client.http.get("#{API_URL}/suppressions/unsubscribes")
|
36
32
|
end
|
37
33
|
|
38
34
|
def add_to_blocklist(recipients: nil, patterns: nil)
|
@@ -40,8 +36,7 @@ module Mailersend
|
|
40
36
|
'recipients' => recipients,
|
41
37
|
'patterns' => patterns
|
42
38
|
}
|
43
|
-
|
44
|
-
puts response
|
39
|
+
client.http.post("#{API_URL}/suppressions/blocklist", json: hash.compact)
|
45
40
|
end
|
46
41
|
|
47
42
|
def delete_from_blocklist(domain_id: nil, ids: nil, all: nil)
|
@@ -50,8 +45,7 @@ module Mailersend
|
|
50
45
|
'ids' => ids,
|
51
46
|
'all' => all
|
52
47
|
}
|
53
|
-
|
54
|
-
puts response
|
48
|
+
client.http.delete("#{API_URL}/suppressions/blocklist", json: hash.compact)
|
55
49
|
end
|
56
50
|
|
57
51
|
def add_to_hard_bounces(domain_id: nil, recipients: nil)
|
@@ -59,8 +53,7 @@ module Mailersend
|
|
59
53
|
'domain_id' => domain_id,
|
60
54
|
'recipients' => recipients
|
61
55
|
}
|
62
|
-
|
63
|
-
puts response
|
56
|
+
client.http.post("#{API_URL}/suppressions/hard-bounces", json: hash.compact)
|
64
57
|
end
|
65
58
|
|
66
59
|
def delete_from_hard_bounces(domain_id: nil, ids: nil, all: nil)
|
@@ -69,8 +62,7 @@ module Mailersend
|
|
69
62
|
'ids' => ids,
|
70
63
|
'all' => all
|
71
64
|
}
|
72
|
-
|
73
|
-
puts response
|
65
|
+
client.http.delete("#{API_URL}/suppressions/hard-bounces", json: hash.compact)
|
74
66
|
end
|
75
67
|
|
76
68
|
def add_to_spam_complaints(domain_id: nil, recipients: nil)
|
@@ -78,8 +70,7 @@ module Mailersend
|
|
78
70
|
'domain_id' => domain_id,
|
79
71
|
'recipients' => recipients
|
80
72
|
}
|
81
|
-
|
82
|
-
puts response
|
73
|
+
client.http.post("#{API_URL}/suppressions/spam-complaints", json: hash.compact)
|
83
74
|
end
|
84
75
|
|
85
76
|
def delete_from_spam_complaints(domain_id: nil, ids: nil, all: nil)
|
@@ -88,8 +79,7 @@ module Mailersend
|
|
88
79
|
'ids' => ids,
|
89
80
|
'all' => all
|
90
81
|
}
|
91
|
-
|
92
|
-
puts response
|
82
|
+
client.http.delete("#{API_URL}/suppressions/spam-complaints", json: hash.compact)
|
93
83
|
end
|
94
84
|
|
95
85
|
def add_to_unsubscribers(domain_id: nil, recipients: nil)
|
@@ -97,8 +87,7 @@ module Mailersend
|
|
97
87
|
'domain_id' => domain_id,
|
98
88
|
'recipients' => recipients
|
99
89
|
}
|
100
|
-
|
101
|
-
puts response
|
90
|
+
client.http.post("#{API_URL}/suppressions/unsubscribes", json: hash.compact)
|
102
91
|
end
|
103
92
|
|
104
93
|
def delete_from_unsubscribers(domain_id: nil, ids: nil, all: nil)
|
@@ -107,8 +96,7 @@ module Mailersend
|
|
107
96
|
'ids' => ids,
|
108
97
|
'all' => all
|
109
98
|
}
|
110
|
-
|
111
|
-
puts response
|
99
|
+
client.http.delete("#{API_URL}/suppressions/unsubscribes", json: hash.compact)
|
112
100
|
end
|
113
101
|
end
|
114
102
|
end
|
@@ -22,19 +22,16 @@ module Mailersend
|
|
22
22
|
'limit' => limit
|
23
23
|
}
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
puts response
|
25
|
+
client.http.get(URI::HTTPS.build(host: API_BASE_HOST, path: '/v1/templates',
|
26
|
+
query: URI.encode_www_form(hash)))
|
28
27
|
end
|
29
28
|
|
30
29
|
def single(template_id:)
|
31
|
-
|
32
|
-
puts response
|
30
|
+
client.http.get("#{API_URL}/templates/#{template_id}")
|
33
31
|
end
|
34
32
|
|
35
33
|
def delete(template_id:)
|
36
|
-
|
37
|
-
puts response
|
34
|
+
client.http.delete("#{API_URL}/templates/#{template_id}")
|
38
35
|
end
|
39
36
|
end
|
40
37
|
end
|
@@ -23,21 +23,18 @@ module Mailersend
|
|
23
23
|
'scopes' => scopes,
|
24
24
|
'domain_id' => domain_id
|
25
25
|
}
|
26
|
-
|
27
|
-
puts response
|
26
|
+
client.http.post("#{API_URL}/token", json: json)
|
28
27
|
end
|
29
28
|
|
30
29
|
def update(token_id:, status:)
|
31
30
|
status = {
|
32
31
|
status: status
|
33
32
|
}
|
34
|
-
|
35
|
-
puts response
|
33
|
+
client.http.put("#{API_URL}/token/#{token_id}/settings", json: status)
|
36
34
|
end
|
37
35
|
|
38
36
|
def delete(token_id:)
|
39
|
-
|
40
|
-
puts response
|
37
|
+
client.http.delete("#{API_URL}/token/#{token_id}")
|
41
38
|
end
|
42
39
|
end
|
43
40
|
end
|
data/lib/mailersend/version.rb
CHANGED
@@ -24,14 +24,12 @@ module Mailersend
|
|
24
24
|
hash = {
|
25
25
|
'domain_id' => domain_id
|
26
26
|
}
|
27
|
-
|
28
|
-
|
29
|
-
puts response
|
27
|
+
client.http.get(URI::HTTPS.build(host: API_BASE_HOST, path: '/v1/webhooks',
|
28
|
+
query: URI.encode_www_form(hash)))
|
30
29
|
end
|
31
30
|
|
32
31
|
def single(webhook_id:)
|
33
|
-
|
34
|
-
puts response
|
32
|
+
client.http.get("#{API_URL}/webhooks/#{webhook_id}")
|
35
33
|
end
|
36
34
|
|
37
35
|
def create(url:, name:, events:, domain_id:, enabled: nil)
|
@@ -43,8 +41,7 @@ module Mailersend
|
|
43
41
|
'enabled' => enabled.to_s == 'true'
|
44
42
|
}
|
45
43
|
|
46
|
-
|
47
|
-
puts response
|
44
|
+
client.http.post("#{API_URL}/webhooks", json: hash.compact)
|
48
45
|
end
|
49
46
|
|
50
47
|
def update(webhook_id:, url: nil, name: nil, events: nil, enabled: nil)
|
@@ -54,13 +51,11 @@ module Mailersend
|
|
54
51
|
'events' => events,
|
55
52
|
'enabled' => enabled.to_s == 'true'
|
56
53
|
}
|
57
|
-
|
58
|
-
puts response
|
54
|
+
client.http.put("#{API_URL}/webhooks/#{webhook_id}", json: hash.compact)
|
59
55
|
end
|
60
56
|
|
61
57
|
def delete(webhook_id:)
|
62
|
-
|
63
|
-
puts response
|
58
|
+
client.http.delete("#{API_URL}/webhooks/#{webhook_id}")
|
64
59
|
end
|
65
60
|
end
|
66
61
|
end
|
data/lib/mailersend.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: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nikola Milojević
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-02-
|
11
|
+
date: 2022-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|