mailersend-ruby 1.4.0 → 1.5.1

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: 143a0364d9fc6022b8a7b7a246fa01ca47f6b19546334e1d54576bd3da3a774e
4
- data.tar.gz: ddf12b66f4809ff3e015129fd2e4e0f667a9777c485243f9bac5571d0c6e421b
3
+ metadata.gz: 7f52bbbd2d912636c141fb8806196c42020a2519b01fedcd0cae0d9daaddcc54
4
+ data.tar.gz: 5b41dfa0deb782158ac72ad3a3d02686fd1bfa2332bdba3d730840d329611416
5
5
  SHA512:
6
- metadata.gz: 96dd151f391c1f27c51420dd4429d2175b3feca2c8fa785761c8404c86ceb4297c89f7f183d54ece3a8d73e79f1ea7b1223f809df4a92cd3949d38244960b4e2
7
- data.tar.gz: d295d63460b934052cba1b99cd1ccbc82011499cde501f8a51ba110834c9d42606c6cbd9e1cd57c6e6a5b79e02dae338d901ecb6e92408378ef7e3efc03bd0c1
6
+ metadata.gz: adf9d68a242b761630343959abd74d0ca704b6753ca184bd849aa6848a28db524edbd9cf87a4402e32d1b4c6c4860f14db148ea8f8eaefe9e620661bbb19a83e
7
+ data.tar.gz: 77613e73b046b527e3bbb3d1fd32f66cf06a0aa06e2298807222856abdb6b3a816e54681285ad004517d4d947d99802d0f87446bbaf927ea2f122b15ca1857a5
@@ -8,7 +8,7 @@ jobs:
8
8
  steps:
9
9
  - uses: actions/checkout@v3
10
10
  - name: Set up Ruby
11
- uses: ruby/setup-ruby@v1.133.2
11
+ uses: ruby/setup-ruby@v1.148.0
12
12
  with:
13
13
  ruby-version: 3.0
14
14
  bundler-cache: true
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  ## [Released]
2
2
 
3
+ ## [1.5.1] - 2023-05-09
4
+
5
+ - Added supports for base64 attachment
6
+
7
+ ## [1.5.0] - 2023-05-08
8
+
9
+ - API Quota
10
+ - Single eMail Verification
11
+
3
12
  ## [1.4.0] - 2023-01-17
4
13
 
5
14
  - Sender Identities
data/README.md CHANGED
@@ -74,6 +74,7 @@ MailerSend Ruby SDK
74
74
  - [Get a single template](#get-a-single-template)
75
75
  - [Delete template](#delete-template)
76
76
  - [Email Verification](#email-verification)
77
+ - [Verify an email](#verify-an-email)
77
78
  - [Get all email verification lists](#get-all-email-verification-lists)
78
79
  - [Get an email verification list](#get-an-email-verification-list)
79
80
  - [Create an email verification list](#create-an-email-verification-list)
@@ -106,6 +107,8 @@ MailerSend Ruby SDK
106
107
  - [Create an SMS webhook](#create-an-sms-webhook)
107
108
  - [Update an SMS webhook](#update-an-sms-webhook)
108
109
  - [Delete an SMS webhook](#delete-an-sms-webhook)
110
+ - [Other endpoints](#other-endpoints)
111
+ - [Get API quota](#get-api-quota)
109
112
  - [Support and Feedback](#support-and-feedback)
110
113
  - [License](#license)
111
114
 
@@ -770,6 +773,15 @@ ms_templates.delete(template_id: "id124")
770
773
 
771
774
  ## Email Verification
772
775
 
776
+ ### Verify an email
777
+
778
+ ```ruby
779
+ require "mailersend-ruby"
780
+
781
+ ms_email_verification = Mailersend::EmailVerification.new
782
+ ms_email_verification.verify_an_email(email: 'example@email.com')
783
+ ```
784
+
773
785
  ### Get all email verification lists
774
786
 
775
787
  ```ruby
@@ -1120,6 +1132,20 @@ ms_sms_webhooks = Mailersend::SMSWebhooks.new
1120
1132
  ms_sms_webhooks.delete_sms_webhook_route(sms_webhook_id: 'your-sms-webhook-id')
1121
1133
  ```
1122
1134
 
1135
+ ## Other endpoints
1136
+
1137
+ ### Get API quota
1138
+
1139
+ ```ruby
1140
+ require "mailersend-ruby"
1141
+
1142
+ # Intialize the API Quota class
1143
+ ms_api_quota = Mailersend::APIQuota.new
1144
+
1145
+ # Add parameters
1146
+ ms_api_quota.get_api_quota
1147
+ ```
1148
+
1123
1149
  # Support and Feedback
1124
1150
 
1125
1151
  In case you find any bugs, submit an issue directly here in GitHub.
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mailersend
4
+ # API Quota endpoint from MailerSend API
5
+ class APIQuota
6
+ attr_accessor :client
7
+
8
+ def initialize(client = Mailersend::Client.new)
9
+ @client = client
10
+ end
11
+
12
+ def get_api_quota(*)
13
+ client.http.get("#{API_URL}/api-quota")
14
+ end
15
+ end
16
+ end
@@ -87,13 +87,19 @@ module Mailersend
87
87
  end
88
88
 
89
89
  def add_attachment(content:, filename:, disposition:)
90
- data = File.read(content.to_s)
91
- encoded = Base64.strict_encode64(data)
92
- @attachments << {
93
- 'content' => encoded,
94
- 'filename' => filename,
95
- 'disposition' => disposition
96
- }
90
+ # content: Can be one of the following:
91
+ # file_path(String) i.e. 'app/Sample-jpg-image-50kb.jpeg'
92
+ # Base64 encoded string (String)
93
+ # Supported types are: https://developers.mailersend.com/api/v1/email.html#supported-file-types
94
+
95
+ content_string = content.to_s
96
+ if File.readable?(content_string)
97
+ data = File.read(content_string)
98
+ base64_encoded = Base64.strict_encode64(data)
99
+ else
100
+ base64_encoded = content_string
101
+ end
102
+ @attachments << { 'content' => base64_encoded, 'filename' => filename, 'disposition' => disposition }
97
103
  end
98
104
 
99
105
  def add_send_at(send_at)
@@ -15,6 +15,13 @@ module Mailersend
15
15
  @email_verification_id = email_verification_id
16
16
  end
17
17
 
18
+ def verify_an_email(email: nil)
19
+ hash = {
20
+ 'email' => email
21
+ }
22
+ client.http.post("#{API_URL}/email-verification/verify", json: hash.compact)
23
+ end
24
+
18
25
  def list(page: nil, limit: nil)
19
26
  hash = {
20
27
  'page' => page,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Mailersend
4
- VERSION = '1.4.0'
4
+ VERSION = '1.5.1'
5
5
  end
data/lib/mailersend.rb CHANGED
@@ -3,6 +3,7 @@
3
3
  require_relative 'mailersend/client'
4
4
  require_relative 'mailersend/version'
5
5
  require_relative 'mailersend/activity/activity'
6
+ require_relative 'mailersend/api_quota/api_quota'
6
7
  require_relative 'mailersend/analytics/analytics'
7
8
  require_relative 'mailersend/bulk_email/bulk_email'
8
9
  require_relative 'mailersend/domains/domains'
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.4.0
4
+ version: 1.5.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: 2023-01-17 00:00:00.000000000 Z
11
+ date: 2023-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -135,6 +135,7 @@ files:
135
135
  - lib/mailersend.rb
136
136
  - lib/mailersend/activity/activity.rb
137
137
  - lib/mailersend/analytics/analytics.rb
138
+ - lib/mailersend/api_quota/api_quota.rb
138
139
  - lib/mailersend/bulk_email/bulk_email.rb
139
140
  - lib/mailersend/client.rb
140
141
  - lib/mailersend/domains/domains.rb
@@ -183,7 +184,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
183
184
  - !ruby/object:Gem::Version
184
185
  version: '0'
185
186
  requirements: []
186
- rubygems_version: 3.4.1
187
+ rubygems_version: 3.4.10
187
188
  signing_key:
188
189
  specification_version: 4
189
190
  summary: MailerSend's official Ruby SDK