mailersend-ruby 3.5.0 → 3.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +13 -0
- data/fixtures/account/account_get.yml +1 -1
- data/fixtures/account/account_get_without_whatsapp.yml +1 -1
- data/fixtures/activity/activity_get_activity.yml +1 -1
- data/fixtures/api_quota/api_quota_get.yml +1 -1
- data/fixtures/bulk_email/bulk_email_send.yml +1 -1
- data/fixtures/bulk_email/bulk_email_status.yml +1 -1
- data/fixtures/dmarc_monitoring/add_favorite.yml +1 -1
- data/fixtures/dmarc_monitoring/create.yml +1 -1
- data/fixtures/dmarc_monitoring/delete.yml +1 -1
- data/fixtures/dmarc_monitoring/list.yml +1 -1
- data/fixtures/dmarc_monitoring/remove_favorite.yml +1 -1
- data/fixtures/dmarc_monitoring/report.yml +1 -1
- data/fixtures/dmarc_monitoring/report_by_ip.yml +1 -1
- data/fixtures/dmarc_monitoring/report_sources.yml +1 -1
- data/fixtures/dmarc_monitoring/update.yml +1 -1
- data/fixtures/domains/domains_add.yml +1 -1
- data/fixtures/domains/domains_delete.yml +1 -1
- data/fixtures/domains/domains_dns.yml +1 -1
- data/fixtures/domains/domains_list.yml +1 -1
- data/fixtures/domains/domains_recipients.yml +1 -1
- data/fixtures/domains/domains_settings.yml +1 -1
- data/fixtures/domains/domains_single.yml +1 -1
- data/fixtures/domains/domains_verify.yml +1 -1
- data/fixtures/email/email_send.yml +1 -1
- data/fixtures/email/email_send_template_language.yml +1 -1
- data/fixtures/emails/emails_list_emails.yml +1 -1
- data/fixtures/emails/emails_list_emails_empty_page.yml +1 -1
- data/fixtures/emails/emails_single_email.yml +1 -1
- data/fixtures/inbound_routing/inbound_routing_delete.yml +1 -1
- data/fixtures/inbound_routing/inbound_routing_list.yml +1 -1
- data/fixtures/inbound_routing/inbound_routing_single.yml +1 -1
- data/fixtures/messages/messages_list_messages.yml +1 -1
- data/fixtures/messages/messages_single_message.yml +1 -1
- data/fixtures/recipients/recipients_delete.yml +1 -1
- data/fixtures/recipients/recipients_list.yml +1 -1
- data/fixtures/recipients/recipients_single.yml +1 -1
- data/fixtures/scheduled_messages/scheduled_messages_delete.yml +1 -1
- data/fixtures/scheduled_messages/scheduled_messages_get_list.yml +1 -1
- data/fixtures/scheduled_messages/scheduled_messages_get_single.yml +1 -1
- data/fixtures/sms_activity/sms_activity_list.yml +1 -1
- data/fixtures/sms_inbounds/sms_inbounds_add_sms_inbound_route.yml +1 -1
- data/fixtures/sms_inbounds/sms_inbounds_delete_sms_inbound_route.yml +1 -1
- data/fixtures/sms_inbounds/sms_inbounds_get_sms_inbound_route.yml +1 -1
- data/fixtures/sms_inbounds/sms_inbounds_list_sms_inbounds.yml +1 -1
- data/fixtures/sms_inbounds/sms_inbounds_update_sms_inbound_route.yml +1 -1
- data/fixtures/sms_messages/sms_messages_list_sms_messages.yml +1 -1
- data/fixtures/sms_number/sms_number_delete.yml +1 -1
- data/fixtures/sms_number/sms_number_get.yml +1 -1
- data/fixtures/sms_number/sms_number_list.yml +1 -1
- data/fixtures/sms_number/sms_number_update.yml +1 -1
- data/fixtures/sms_recipient/sms_recipient_get.yml +1 -1
- data/fixtures/sms_recipient/sms_recipient_list.yml +1 -1
- data/fixtures/sms_recipient/sms_recipient_update.yml +1 -1
- data/fixtures/sms_webhooks/sms_webhooks_add_sms_webhook_route.yml +1 -1
- data/fixtures/sms_webhooks/sms_webhooks_delete_sms_webhook_route.yml +1 -1
- data/fixtures/sms_webhooks/sms_webhooks_get_sms_webhook_route.yml +1 -1
- data/fixtures/sms_webhooks/sms_webhooks_list_sms_webhooks.yml +1 -1
- data/fixtures/sms_webhooks/sms_webhooks_update_sms_webhook_route.yml +1 -1
- data/fixtures/suppressions/suppressions_add_to_blocklist.yml +1 -1
- data/fixtures/suppressions/suppressions_add_to_hard_bounces.yml +1 -1
- data/fixtures/suppressions/suppressions_add_to_spam_complaints.yml +1 -1
- data/fixtures/suppressions/suppressions_add_to_unsubscribers.yml +1 -1
- data/fixtures/suppressions/suppressions_delete_from_blocklist.yml +1 -1
- data/fixtures/suppressions/suppressions_delete_from_hard_bounces.yml +1 -1
- data/fixtures/suppressions/suppressions_delete_from_spam_complaints.yml +1 -1
- data/fixtures/suppressions/suppressions_delete_from_unsubscribers.yml +1 -1
- data/fixtures/suppressions/suppressions_get_from_blocklist.yml +1 -1
- data/fixtures/suppressions/suppressions_get_hard_bounces.yml +1 -1
- data/fixtures/suppressions/suppressions_get_spam_complaints.yml +1 -1
- data/fixtures/suppressions/suppressions_get_unsubscribes.yml +1 -1
- data/fixtures/templates/templates_delete.yml +1 -1
- data/fixtures/templates/templates_list.yml +1 -1
- data/fixtures/templates/templates_single.yml +1 -1
- data/fixtures/tokens/tokens_create.yml +1 -1
- data/fixtures/tokens/tokens_delete.yml +1 -1
- data/fixtures/tokens/tokens_update.yml +1 -1
- data/fixtures/webhooks/webhooks_create.yml +1 -1
- data/fixtures/webhooks/webhooks_delete.yml +1 -1
- data/fixtures/webhooks/webhooks_list.yml +1 -1
- data/fixtures/webhooks/webhooks_single.yml +1 -1
- data/fixtures/whatsapp/whatsapp_send.yml +1 -1
- data/fixtures/whatsapp/whatsapp_send_multiple_recipients.yml +1 -1
- data/fixtures/whatsapp/whatsapp_send_personalization.yml +1 -1
- data/fixtures/whatsapp_activities/whatsapp_activities_list.yml +1 -1
- data/fixtures/whatsapp_inbound_messages/whatsapp_inbound_messages_get.yml +1 -1
- data/fixtures/whatsapp_inbound_messages/whatsapp_inbound_messages_list.yml +1 -1
- data/fixtures/whatsapp_items/whatsapp_items_get.yml +1 -1
- data/fixtures/whatsapp_items/whatsapp_items_list.yml +1 -1
- data/fixtures/whatsapp_messages/whatsapp_messages_get.yml +1 -1
- data/fixtures/whatsapp_messages/whatsapp_messages_list.yml +1 -1
- data/fixtures/whatsapp_recipient/whatsapp_recipient_get.yml +1 -1
- data/fixtures/whatsapp_recipient/whatsapp_recipient_list.yml +1 -1
- data/fixtures/whatsapp_templates/whatsapp_templates_get.yml +1 -1
- data/fixtures/whatsapp_templates/whatsapp_templates_list.yml +1 -1
- data/lib/mailersend/account/account.rb +1 -1
- data/lib/mailersend/activity/activity.rb +1 -1
- data/lib/mailersend/analytics/analytics.rb +4 -4
- data/lib/mailersend/api_quota/api_quota.rb +1 -1
- data/lib/mailersend/bulk_email/bulk_email.rb +2 -2
- data/lib/mailersend/client.rb +16 -1
- data/lib/mailersend/dmarc_monitoring/dmarc_monitoring.rb +9 -9
- data/lib/mailersend/domains/domains.rb +8 -8
- data/lib/mailersend/email/email.rb +1 -1
- data/lib/mailersend/email_verification/email_verification.rb +6 -6
- data/lib/mailersend/emails/emails.rb +2 -2
- data/lib/mailersend/inbound_routing/inbound_routing.rb +5 -5
- data/lib/mailersend/messages/messages.rb +2 -2
- data/lib/mailersend/recipients/recipients.rb +3 -3
- data/lib/mailersend/scheduled_messages/scheduled_messages.rb +3 -3
- data/lib/mailersend/sender_identity/sender_identity.rb +8 -8
- data/lib/mailersend/sms/sms.rb +1 -1
- data/lib/mailersend/sms_activity/sms_activity.rb +1 -1
- data/lib/mailersend/sms_inbounds/sms_inbounds.rb +5 -5
- data/lib/mailersend/sms_messages/sms_messages.rb +2 -2
- data/lib/mailersend/sms_number/sms_number.rb +4 -4
- data/lib/mailersend/sms_recipient/sms_recipient.rb +3 -3
- data/lib/mailersend/sms_webhooks/sms_webhooks.rb +5 -5
- data/lib/mailersend/suppressions/suppressions.rb +12 -12
- data/lib/mailersend/templates/templates.rb +3 -3
- data/lib/mailersend/tokens/tokens.rb +3 -3
- data/lib/mailersend/version.rb +1 -1
- data/lib/mailersend/webhooks/webhooks.rb +5 -5
- data/lib/mailersend/whatsapp/whatsapp.rb +1 -1
- data/lib/mailersend/whatsapp_activities/whatsapp_activities.rb +1 -1
- data/lib/mailersend/whatsapp_inbound_messages/whatsapp_inbound_messages.rb +2 -2
- data/lib/mailersend/whatsapp_items/whatsapp_items.rb +2 -2
- data/lib/mailersend/whatsapp_messages/whatsapp_messages.rb +2 -2
- data/lib/mailersend/whatsapp_recipient/whatsapp_recipient.rb +2 -2
- data/lib/mailersend/whatsapp_templates/whatsapp_templates.rb +2 -2
- data/spec/account_rspec.rb +1 -1
- data/spec/client_rspec.rb +33 -0
- data/spec/emails_rspec.rb +7 -7
- metadata +2 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
http_interactions:
|
|
3
3
|
- request:
|
|
4
4
|
method: post
|
|
5
|
-
uri: https://api.mailersend.com/
|
|
5
|
+
uri: https://api.mailersend.com/2026-10/suppressions/hard-bounces
|
|
6
6
|
body:
|
|
7
7
|
encoding: UTF-8
|
|
8
8
|
string: '{"domain_id":"jpzkmgq7e5vl059v","recipients":["test@mailerlite.com"]}'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
http_interactions:
|
|
3
3
|
- request:
|
|
4
4
|
method: post
|
|
5
|
-
uri: https://api.mailersend.com/
|
|
5
|
+
uri: https://api.mailersend.com/2026-10/suppressions/spam-complaints
|
|
6
6
|
body:
|
|
7
7
|
encoding: UTF-8
|
|
8
8
|
string: '{"domain_id":"jpzkmgq7e5vl059v","recipients":["test@mailerlite.com"]}'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
http_interactions:
|
|
3
3
|
- request:
|
|
4
4
|
method: post
|
|
5
|
-
uri: https://api.mailersend.com/
|
|
5
|
+
uri: https://api.mailersend.com/2026-10/suppressions/unsubscribes
|
|
6
6
|
body:
|
|
7
7
|
encoding: UTF-8
|
|
8
8
|
string: '{"domain_id":"jpzkmgq7e5vl059v","recipients":["test@mailerlite.com"]}'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
http_interactions:
|
|
3
3
|
- request:
|
|
4
4
|
method: delete
|
|
5
|
-
uri: https://api.mailersend.com/
|
|
5
|
+
uri: https://api.mailersend.com/2026-10/suppressions/blocklist
|
|
6
6
|
body:
|
|
7
7
|
encoding: UTF-8
|
|
8
8
|
string: '{"domain_id":"jpzkmgq7e5vl059v","ids":["6764599b1cc3ea355ad717a0"]}'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
http_interactions:
|
|
3
3
|
- request:
|
|
4
4
|
method: delete
|
|
5
|
-
uri: https://api.mailersend.com/
|
|
5
|
+
uri: https://api.mailersend.com/2026-10/suppressions/hard-bounces
|
|
6
6
|
body:
|
|
7
7
|
encoding: UTF-8
|
|
8
8
|
string: '{"domain_id":"jpzkmgq7e5vl059v","ids":["676457b042328d3c98db7600"]}'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
http_interactions:
|
|
3
3
|
- request:
|
|
4
4
|
method: delete
|
|
5
|
-
uri: https://api.mailersend.com/
|
|
5
|
+
uri: https://api.mailersend.com/2026-10/suppressions/spam-complaints
|
|
6
6
|
body:
|
|
7
7
|
encoding: UTF-8
|
|
8
8
|
string: '{"domain_id":"jpzkmgq7e5vl059v","ids":["676457b1ee359d18093fcb99"]}'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
http_interactions:
|
|
3
3
|
- request:
|
|
4
4
|
method: delete
|
|
5
|
-
uri: https://api.mailersend.com/
|
|
5
|
+
uri: https://api.mailersend.com/2026-10/suppressions/unsubscribes
|
|
6
6
|
body:
|
|
7
7
|
encoding: UTF-8
|
|
8
8
|
string: '{"domain_id":"jpzkmgq7e5vl059v","ids":["676457b1252f59f004ea2bac"]}'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
http_interactions:
|
|
3
3
|
- request:
|
|
4
4
|
method: get
|
|
5
|
-
uri: https://api.mailersend.com/
|
|
5
|
+
uri: https://api.mailersend.com/2026-10/templates?domain_id=zkq340ezdqkgd796&limit=10&page=1
|
|
6
6
|
body:
|
|
7
7
|
encoding: ASCII-8BIT
|
|
8
8
|
string: ''
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
http_interactions:
|
|
3
3
|
- request:
|
|
4
4
|
method: delete
|
|
5
|
-
uri: https://api.mailersend.com/
|
|
5
|
+
uri: https://api.mailersend.com/2026-10/token/1dd8e323b92f9953069f9647ca5929a24674e2f972d85734b27de16cd06360256054a070b783c272
|
|
6
6
|
body:
|
|
7
7
|
encoding: ASCII-8BIT
|
|
8
8
|
string: ''
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
http_interactions:
|
|
3
3
|
- request:
|
|
4
4
|
method: put
|
|
5
|
-
uri: https://api.mailersend.com/
|
|
5
|
+
uri: https://api.mailersend.com/2026-10/token/1dd8e323b92f9953069f9647ca5929a24674e2f972d85734b27de16cd06360256054a070b783c272/settings
|
|
6
6
|
body:
|
|
7
7
|
encoding: UTF-8
|
|
8
8
|
string: '{"status":"pause"}'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
http_interactions:
|
|
3
3
|
- request:
|
|
4
4
|
method: post
|
|
5
|
-
uri: https://api.mailersend.com/
|
|
5
|
+
uri: https://api.mailersend.com/2026-10/webhooks
|
|
6
6
|
body:
|
|
7
7
|
encoding: UTF-8
|
|
8
8
|
string: '{"url":"https://example.com/webhook","name":"Test Webhook","events":["activity.sent","activity.delivered"],"domain_id":"jpzkmgq7e5vl059v","enabled":true}'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
http_interactions:
|
|
3
3
|
- request:
|
|
4
4
|
method: post
|
|
5
|
-
uri: https://api.mailersend.com/
|
|
5
|
+
uri: https://api.mailersend.com/2026-10/whatsapp/send
|
|
6
6
|
body:
|
|
7
7
|
encoding: UTF-8
|
|
8
8
|
string: '{"from":"15550001234","to":["+48600000001"],"template_id":"23zxk54v6gjy6v7m"}'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
http_interactions:
|
|
3
3
|
- request:
|
|
4
4
|
method: post
|
|
5
|
-
uri: https://api.mailersend.com/
|
|
5
|
+
uri: https://api.mailersend.com/2026-10/whatsapp/send
|
|
6
6
|
body:
|
|
7
7
|
encoding: UTF-8
|
|
8
8
|
string: '{"from":"15550001234","to":["+48600000001","+48600000002"],"template_id":"23zxk54v6gjy6v7m"}'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
http_interactions:
|
|
3
3
|
- request:
|
|
4
4
|
method: post
|
|
5
|
-
uri: https://api.mailersend.com/
|
|
5
|
+
uri: https://api.mailersend.com/2026-10/whatsapp/send
|
|
6
6
|
body:
|
|
7
7
|
encoding: UTF-8
|
|
8
8
|
string: '{"from":"15550001234","to":["+48600000001"],"template_id":"23zxk54v6gjy6v7m","personalization":[{"to":"+48600000001","data":{"header":["Order #12345"],"body":["John","December 31, 2026"],"buttons":["orders/12345"]}}]}'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
http_interactions:
|
|
3
3
|
- request:
|
|
4
4
|
method: get
|
|
5
|
-
uri: https://api.mailersend.com/
|
|
5
|
+
uri: https://api.mailersend.com/2026-10/whatsapp/activities?date_from=1791936000&date_to=1792022400&limit=25&page=1&recipient=48600000001&type%5B%5D=delivered&type%5B%5D=read&whatsapp_item_id=67f91abe2202f3705540234a&whatsapp_message_id=67f91abd69f79df391e9d78d
|
|
6
6
|
body:
|
|
7
7
|
encoding: ASCII-8BIT
|
|
8
8
|
string: ''
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
http_interactions:
|
|
3
3
|
- request:
|
|
4
4
|
method: get
|
|
5
|
-
uri: https://api.mailersend.com/
|
|
5
|
+
uri: https://api.mailersend.com/2026-10/whatsapp/inbound-messages/62f114a3165fe0d8db0288d1
|
|
6
6
|
body:
|
|
7
7
|
encoding: ASCII-8BIT
|
|
8
8
|
string: ''
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
http_interactions:
|
|
3
3
|
- request:
|
|
4
4
|
method: get
|
|
5
|
-
uri: https://api.mailersend.com/
|
|
5
|
+
uri: https://api.mailersend.com/2026-10/whatsapp/inbound-messages?date_from=1790000000&date_to=1790086400&from=48600000001&limit=25&page=1&type%5B%5D=image&type%5B%5D=text&whatsapp_account_id=3enl6x27wmrxrl2v
|
|
6
6
|
body:
|
|
7
7
|
encoding: ASCII-8BIT
|
|
8
8
|
string: ''
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
http_interactions:
|
|
3
3
|
- request:
|
|
4
4
|
method: get
|
|
5
|
-
uri: https://api.mailersend.com/
|
|
5
|
+
uri: https://api.mailersend.com/2026-10/whatsapp/items?date_from=1791936000&date_to=1792022400&from=15550001234&limit=25&page=1&recipient=48600000002&status%5B%5D=failed&status%5B%5D=read&template_id=23zxk54v6gjy6v7m&whatsapp_account_id=3enl6x27wmrxrl2v&whatsapp_message_id=67f91abd69f79df391e9d78d
|
|
6
6
|
body:
|
|
7
7
|
encoding: ASCII-8BIT
|
|
8
8
|
string: ''
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
http_interactions:
|
|
3
3
|
- request:
|
|
4
4
|
method: get
|
|
5
|
-
uri: https://api.mailersend.com/
|
|
5
|
+
uri: https://api.mailersend.com/2026-10/whatsapp/messages?date_from=1791936000&date_to=1792022400&from=15550001234&limit=25&page=1&template_id=23zxk54v6gjy6v7m&whatsapp_account_id=3enl6x27wmrxrl2v
|
|
6
6
|
body:
|
|
7
7
|
encoding: ASCII-8BIT
|
|
8
8
|
string: ''
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
http_interactions:
|
|
3
3
|
- request:
|
|
4
4
|
method: get
|
|
5
|
-
uri: https://api.mailersend.com/
|
|
5
|
+
uri: https://api.mailersend.com/2026-10/whatsapp/recipients?limit=25&page=1&phone_number=48600000001&status=active
|
|
6
6
|
body:
|
|
7
7
|
encoding: ASCII-8BIT
|
|
8
8
|
string: ''
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
http_interactions:
|
|
3
3
|
- request:
|
|
4
4
|
method: get
|
|
5
|
-
uri: https://api.mailersend.com/
|
|
5
|
+
uri: https://api.mailersend.com/2026-10/whatsapp/templates?category=UTILITY&language=en_US&limit=25&page=1&status=approved&whatsapp_account_id=3enl6x27wmrxrl2v
|
|
6
6
|
body:
|
|
7
7
|
encoding: ASCII-8BIT
|
|
8
8
|
string: ''
|
|
@@ -27,7 +27,7 @@ module Mailersend
|
|
|
27
27
|
date_to: date_to
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST, path: "/
|
|
30
|
+
client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST, path: "#{client.api_path}/activity/#{domain_id}",
|
|
31
31
|
query: URI.encode_www_form(hash.compact)))
|
|
32
32
|
end
|
|
33
33
|
end
|
|
@@ -34,7 +34,7 @@ module Mailersend
|
|
|
34
34
|
'tags[]' => tags
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST, path:
|
|
37
|
+
client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST, path: "#{client.api_path}/analytics/date",
|
|
38
38
|
query: URI.encode_www_form(hash.compact)))
|
|
39
39
|
end
|
|
40
40
|
|
|
@@ -47,7 +47,7 @@ module Mailersend
|
|
|
47
47
|
'tags[]': tags
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST, path:
|
|
50
|
+
client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST, path: "#{client.api_path}/analytics/country",
|
|
51
51
|
query: URI.encode_www_form(hash.compact)))
|
|
52
52
|
end
|
|
53
53
|
|
|
@@ -60,7 +60,7 @@ module Mailersend
|
|
|
60
60
|
'tags[]': tags
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST, path:
|
|
63
|
+
client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST, path: "#{client.api_path}/analytics/ua-name",
|
|
64
64
|
query: URI.encode_www_form(hash.compact)))
|
|
65
65
|
end
|
|
66
66
|
|
|
@@ -73,7 +73,7 @@ module Mailersend
|
|
|
73
73
|
'tags[]': tags
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST, path:
|
|
76
|
+
client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST, path: "#{client.api_path}/analytics/ua-type",
|
|
77
77
|
query: URI.encode_www_form(hash.compact)))
|
|
78
78
|
end
|
|
79
79
|
end
|
|
@@ -24,11 +24,11 @@ module Mailersend
|
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
def send
|
|
27
|
-
client.http.post("#{
|
|
27
|
+
client.http.post("#{client.api_base_url}/bulk-email", json: @messages)
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
def get_bulk_status(bulk_email_id:)
|
|
31
|
-
client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST, path: "/
|
|
31
|
+
client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST, path: "#{client.api_path}/bulk-email/#{bulk_email_id}"))
|
|
32
32
|
end
|
|
33
33
|
end
|
|
34
34
|
end
|
data/lib/mailersend/client.rb
CHANGED
|
@@ -2,19 +2,34 @@
|
|
|
2
2
|
|
|
3
3
|
require 'http'
|
|
4
4
|
|
|
5
|
+
# Deprecated: always points at v1. Use Mailersend::Client#api_base_url.
|
|
5
6
|
MAILERSEND_API_URL = 'https://api.mailersend.com/v1'
|
|
6
7
|
MAILERSEND_API_BASE_HOST = 'api.mailersend.com'
|
|
7
8
|
|
|
8
9
|
# mailersend-ruby is a gem that integrates all endpoints from MailerSend API
|
|
9
10
|
module Mailersend
|
|
11
|
+
DEFAULT_API_VERSION = '2026-10'
|
|
12
|
+
|
|
10
13
|
attr_reader :api_token
|
|
11
14
|
|
|
12
15
|
# Inits the client.
|
|
13
16
|
class Client
|
|
14
|
-
|
|
17
|
+
attr_reader :api_version
|
|
18
|
+
|
|
19
|
+
def initialize(api_token = ENV.fetch('MAILERSEND_API_TOKEN', nil), api_version: DEFAULT_API_VERSION)
|
|
15
20
|
raise ArgumentError, 'API token is not provided' if api_token.nil?
|
|
21
|
+
raise ArgumentError, "Invalid API version #{api_version.inspect}: use 'v1' or a dated version like '2026-10'" unless api_version.to_s.match?(/\A(v1|\d{4}-(0[1-9]|1[0-2]))\z/)
|
|
16
22
|
|
|
17
23
|
@api_token = api_token
|
|
24
|
+
@api_version = api_version.to_s
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def api_path
|
|
28
|
+
"/#{@api_version}"
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def api_base_url
|
|
32
|
+
"https://#{MAILERSEND_API_BASE_HOST}#{api_path}"
|
|
18
33
|
end
|
|
19
34
|
|
|
20
35
|
def http
|
|
@@ -12,48 +12,48 @@ module Mailersend
|
|
|
12
12
|
def list(page: nil, limit: nil)
|
|
13
13
|
hash = { 'page' => page, 'limit' => limit }
|
|
14
14
|
client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST,
|
|
15
|
-
path:
|
|
15
|
+
path: "#{client.api_path}/dmarc-monitoring",
|
|
16
16
|
query: URI.encode_www_form(hash.compact)))
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
def create(domain_id:)
|
|
20
|
-
client.http.post("#{
|
|
20
|
+
client.http.post("#{client.api_base_url}/dmarc-monitoring",
|
|
21
21
|
json: { 'domain_id' => domain_id })
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
def update(monitor_id:, wanted_dmarc_record:)
|
|
25
|
-
client.http.put("#{
|
|
25
|
+
client.http.put("#{client.api_base_url}/dmarc-monitoring/#{monitor_id}",
|
|
26
26
|
json: { 'wanted_dmarc_record' => wanted_dmarc_record })
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
def delete(monitor_id:)
|
|
30
|
-
client.http.delete("#{
|
|
30
|
+
client.http.delete("#{client.api_base_url}/dmarc-monitoring/#{monitor_id}")
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
def report(monitor_id:, page: nil, limit: nil)
|
|
34
34
|
hash = { 'page' => page, 'limit' => limit }
|
|
35
35
|
client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST,
|
|
36
|
-
path: "/
|
|
36
|
+
path: "#{client.api_path}/dmarc-monitoring/#{monitor_id}/report",
|
|
37
37
|
query: URI.encode_www_form(hash.compact)))
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
def report_by_ip(monitor_id:, ip:, page: nil, limit: nil)
|
|
41
41
|
hash = { 'page' => page, 'limit' => limit }
|
|
42
42
|
client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST,
|
|
43
|
-
path: "/
|
|
43
|
+
path: "#{client.api_path}/dmarc-monitoring/#{monitor_id}/report/#{ip}",
|
|
44
44
|
query: URI.encode_www_form(hash.compact)))
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
def report_sources(monitor_id:)
|
|
48
|
-
client.http.get("#{
|
|
48
|
+
client.http.get("#{client.api_base_url}/dmarc-monitoring/#{monitor_id}/report-sources")
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
def add_favorite(monitor_id:, ip:)
|
|
52
|
-
client.http.put("#{
|
|
52
|
+
client.http.put("#{client.api_base_url}/dmarc-monitoring/#{monitor_id}/favorite/#{ip}")
|
|
53
53
|
end
|
|
54
54
|
|
|
55
55
|
def remove_favorite(monitor_id:, ip:)
|
|
56
|
-
client.http.delete("#{
|
|
56
|
+
client.http.delete("#{client.api_base_url}/dmarc-monitoring/#{monitor_id}/favorite/#{ip}")
|
|
57
57
|
end
|
|
58
58
|
end
|
|
59
59
|
end
|
|
@@ -25,7 +25,7 @@ module Mailersend
|
|
|
25
25
|
'limit' => limit,
|
|
26
26
|
'verified' => verified
|
|
27
27
|
}
|
|
28
|
-
client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST, path:
|
|
28
|
+
client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST, path: "#{client.api_path}/domains",
|
|
29
29
|
query: URI.encode_www_form(hash.compact)))
|
|
30
30
|
end
|
|
31
31
|
|
|
@@ -35,7 +35,7 @@ module Mailersend
|
|
|
35
35
|
'limit' => limit,
|
|
36
36
|
'verified' => verified
|
|
37
37
|
}
|
|
38
|
-
client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST, path: "/
|
|
38
|
+
client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST, path: "#{client.api_path}/domains/#{domain_id}",
|
|
39
39
|
query: URI.encode_www_form(hash.compact)))
|
|
40
40
|
end
|
|
41
41
|
|
|
@@ -46,11 +46,11 @@ module Mailersend
|
|
|
46
46
|
'custom_tracking_subdomain' => custom_tracking_subdomain,
|
|
47
47
|
'inbound_routing_subdomain' => inbound_routing_subdomain
|
|
48
48
|
}
|
|
49
|
-
client.http.post("#{
|
|
49
|
+
client.http.post("#{client.api_base_url}/domains", json: hash.compact)
|
|
50
50
|
end
|
|
51
51
|
|
|
52
52
|
def delete(domain_id:)
|
|
53
|
-
client.http.delete(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST, path: "/
|
|
53
|
+
client.http.delete(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST, path: "#{client.api_path}/domains/#{domain_id}"))
|
|
54
54
|
end
|
|
55
55
|
|
|
56
56
|
def recipients(domain_id:)
|
|
@@ -58,7 +58,7 @@ module Mailersend
|
|
|
58
58
|
'page' => page,
|
|
59
59
|
'limit' => limit
|
|
60
60
|
}
|
|
61
|
-
client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST, path: "/
|
|
61
|
+
client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST, path: "#{client.api_path}/domains/#{domain_id}/recipients",
|
|
62
62
|
query: URI.encode_www_form(hash.compact)))
|
|
63
63
|
end
|
|
64
64
|
|
|
@@ -75,15 +75,15 @@ module Mailersend
|
|
|
75
75
|
'custom_tracking_subdomain' => custom_tracking_subdomain,
|
|
76
76
|
'precedence_bulk' => precedence_bulk
|
|
77
77
|
}
|
|
78
|
-
client.http.put("#{
|
|
78
|
+
client.http.put("#{client.api_base_url}/domains/#{domain_id}/settings", json: hash.compact)
|
|
79
79
|
end
|
|
80
80
|
|
|
81
81
|
def dns(domain_id:)
|
|
82
|
-
client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST, path: "/
|
|
82
|
+
client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST, path: "#{client.api_path}/domains/#{domain_id}/dns-records"))
|
|
83
83
|
end
|
|
84
84
|
|
|
85
85
|
def verify(domain_id:)
|
|
86
|
-
client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST, path: "/
|
|
86
|
+
client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST, path: "#{client.api_path}/domains/#{domain_id}/verify"))
|
|
87
87
|
end
|
|
88
88
|
end
|
|
89
89
|
end
|
|
@@ -148,7 +148,7 @@ module Mailersend
|
|
|
148
148
|
'tags' => @tags
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
-
client.http.post("#{
|
|
151
|
+
client.http.post("#{client.api_base_url}/email", json: message.delete_if { |_, value| value.to_s.strip == '' || value == [] || value == {} })
|
|
152
152
|
end
|
|
153
153
|
end
|
|
154
154
|
end
|