mailersend-ruby 3.4.1 → 3.5.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 +14 -0
- data/fixtures/account/account_get.yml +43 -0
- data/fixtures/account/account_get_without_whatsapp.yml +43 -0
- data/fixtures/sms_number/sms_number_delete.yml +1 -1
- data/lib/mailersend/account/account.rb +16 -0
- data/lib/mailersend/version.rb +1 -1
- data/lib/mailersend.rb +1 -0
- data/spec/account_rspec.rb +43 -0
- metadata +5 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 11e81f98436cdc2dfed4f6f1698d45b4fa4b4290432e9c22b8cc5bf043db16c9
|
|
4
|
+
data.tar.gz: 4f23f65693276d116b7de40524c1be037e857135379a75bb4e9d88ad9b951aa7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1ada53e94173c0b3698a0a28858e3155cec9780b28b87db45ffd7713b02da70bab541d72b9a079440be79bb864aaebc70019cd5d062ec660e9b098c4440377da
|
|
7
|
+
data.tar.gz: 84a99338090731e4745cd2cbedda499521ae261c06ec8b27dfbc52169417a6ead54400212c811af90e9a2693da88878c0127f58d0d28f5bc3de7e7ea0ba7a731
|
data/README.md
CHANGED
|
@@ -145,6 +145,7 @@ MailerSend Ruby SDK
|
|
|
145
145
|
- [Update an SMS webhook](#update-an-sms-webhook)
|
|
146
146
|
- [Delete an SMS webhook](#delete-an-sms-webhook)
|
|
147
147
|
- [Other endpoints](#other-endpoints)
|
|
148
|
+
- [Get account](#get-account)
|
|
148
149
|
- [Get API quota](#get-api-quota)
|
|
149
150
|
- [Support and Feedback](#support-and-feedback)
|
|
150
151
|
- [License](#license)
|
|
@@ -1837,6 +1838,19 @@ ms_whatsapp_templates.get(whatsapp_template_id: 'your-whatsapp-template-id')
|
|
|
1837
1838
|
|
|
1838
1839
|
## Other endpoints
|
|
1839
1840
|
|
|
1841
|
+
### Get account
|
|
1842
|
+
|
|
1843
|
+
```ruby
|
|
1844
|
+
require "mailersend-ruby"
|
|
1845
|
+
|
|
1846
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
|
1847
|
+
|
|
1848
|
+
# Intialize the Account class
|
|
1849
|
+
ms_account = Mailersend::Account.new(ms_client)
|
|
1850
|
+
|
|
1851
|
+
ms_account.get_account
|
|
1852
|
+
```
|
|
1853
|
+
|
|
1840
1854
|
### Get API quota
|
|
1841
1855
|
|
|
1842
1856
|
```ruby
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
http_interactions:
|
|
3
|
+
- request:
|
|
4
|
+
method: get
|
|
5
|
+
uri: https://api.mailersend.com/v1/account
|
|
6
|
+
body:
|
|
7
|
+
encoding: ASCII-8BIT
|
|
8
|
+
string: ''
|
|
9
|
+
headers:
|
|
10
|
+
Authorization:
|
|
11
|
+
- "<AUTH>"
|
|
12
|
+
User-Agent:
|
|
13
|
+
- MailerSend-client-ruby/3.4.0
|
|
14
|
+
Accept:
|
|
15
|
+
- application/json
|
|
16
|
+
Connection:
|
|
17
|
+
- close
|
|
18
|
+
Host:
|
|
19
|
+
- api.mailersend.com
|
|
20
|
+
response:
|
|
21
|
+
status:
|
|
22
|
+
code: 200
|
|
23
|
+
message: OK
|
|
24
|
+
headers:
|
|
25
|
+
Date:
|
|
26
|
+
- Thu, 05 Nov 2026 08:00:00 GMT
|
|
27
|
+
Content-Type:
|
|
28
|
+
- application/json
|
|
29
|
+
Transfer-Encoding:
|
|
30
|
+
- chunked
|
|
31
|
+
Connection:
|
|
32
|
+
- close
|
|
33
|
+
Cache-Control:
|
|
34
|
+
- no-cache, private
|
|
35
|
+
Strict-Transport-Security:
|
|
36
|
+
- max-age=31536000; includeSubDomains
|
|
37
|
+
Server:
|
|
38
|
+
- cloudflare
|
|
39
|
+
body:
|
|
40
|
+
encoding: UTF-8
|
|
41
|
+
string: '{"data":{"name":"Acme Inc","status":"approved","plan_type":"starter","data_retention_days":7,"emails":{"sent":12000,"received":430,"limit":-1},"rate_limits":{"general":60,"email":120,"bulk_email":10,"activity":10},"resources":{"domains":{"used":3,"limit":10},"users":{"used":2,"limit":5},"free_accountant_seat":{"used":0,"limit":0},"templates":{"used":41,"limit":250},"smtp_users":{"used":1,"limit":50},"api_tokens":{"used":4,"limit":50},"webhooks":{"used":2,"limit":50}},"addons":{"sms":{"sent":120,"received":30,"limit":-1},"whatsapp":{"sent":800,"limit":1000},"phone_numbers":1,"domain_spaces":2,"data_retention_days":30,"dedicated_ips":0}}}'
|
|
42
|
+
recorded_at: Thu, 05 Nov 2026 08:00:00 GMT
|
|
43
|
+
recorded_with: VCR 6.3.1
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
http_interactions:
|
|
3
|
+
- request:
|
|
4
|
+
method: get
|
|
5
|
+
uri: https://api.mailersend.com/v1/account
|
|
6
|
+
body:
|
|
7
|
+
encoding: ASCII-8BIT
|
|
8
|
+
string: ''
|
|
9
|
+
headers:
|
|
10
|
+
Authorization:
|
|
11
|
+
- "<AUTH>"
|
|
12
|
+
User-Agent:
|
|
13
|
+
- MailerSend-client-ruby/3.4.0
|
|
14
|
+
Accept:
|
|
15
|
+
- application/json
|
|
16
|
+
Connection:
|
|
17
|
+
- close
|
|
18
|
+
Host:
|
|
19
|
+
- api.mailersend.com
|
|
20
|
+
response:
|
|
21
|
+
status:
|
|
22
|
+
code: 200
|
|
23
|
+
message: OK
|
|
24
|
+
headers:
|
|
25
|
+
Date:
|
|
26
|
+
- Thu, 05 Nov 2026 08:00:00 GMT
|
|
27
|
+
Content-Type:
|
|
28
|
+
- application/json
|
|
29
|
+
Transfer-Encoding:
|
|
30
|
+
- chunked
|
|
31
|
+
Connection:
|
|
32
|
+
- close
|
|
33
|
+
Cache-Control:
|
|
34
|
+
- no-cache, private
|
|
35
|
+
Strict-Transport-Security:
|
|
36
|
+
- max-age=31536000; includeSubDomains
|
|
37
|
+
Server:
|
|
38
|
+
- cloudflare
|
|
39
|
+
body:
|
|
40
|
+
encoding: UTF-8
|
|
41
|
+
string: '{"data":{"name":"Acme Inc","status":"approved","plan_type":"starter","data_retention_days":7,"emails":{"sent":12000,"received":430,"limit":-1},"rate_limits":{"general":60,"email":120,"bulk_email":10,"activity":10},"resources":{"domains":{"used":3,"limit":10},"users":{"used":2,"limit":5},"free_accountant_seat":{"used":1,"limit":1},"templates":{"used":41,"limit":250},"smtp_users":{"used":1,"limit":50},"api_tokens":{"used":4,"limit":50},"webhooks":{"used":0,"limit":null}},"addons":{"sms":{"sent":120,"received":30,"limit":-1},"whatsapp":null,"phone_numbers":1,"domain_spaces":2,"data_retention_days":30,"dedicated_ips":0}}}'
|
|
42
|
+
recorded_at: Thu, 05 Nov 2026 08:00:00 GMT
|
|
43
|
+
recorded_with: VCR 6.3.1
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Mailersend
|
|
4
|
+
# Account endpoint from MailerSend API
|
|
5
|
+
class Account
|
|
6
|
+
attr_accessor :client
|
|
7
|
+
|
|
8
|
+
def initialize(client = Mailersend::Client.new)
|
|
9
|
+
@client = client
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def get_account(*)
|
|
13
|
+
client.http.get("#{MAILERSEND_API_URL}/account")
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
data/lib/mailersend/version.rb
CHANGED
data/lib/mailersend.rb
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require_relative 'mailersend/client'
|
|
4
4
|
require_relative 'mailersend/version'
|
|
5
|
+
require_relative 'mailersend/account/account'
|
|
5
6
|
require_relative 'mailersend/activity/activity'
|
|
6
7
|
require_relative 'mailersend/api_quota/api_quota'
|
|
7
8
|
require_relative 'mailersend/analytics/analytics'
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'rspec'
|
|
4
|
+
require 'vcr'
|
|
5
|
+
require 'json'
|
|
6
|
+
|
|
7
|
+
VCR.configure do |config|
|
|
8
|
+
config.cassette_library_dir = './fixtures'
|
|
9
|
+
config.hook_into :webmock
|
|
10
|
+
config.filter_sensitive_data('<AUTH>') do |interaction|
|
|
11
|
+
interaction.request.headers['Authorization'][0]
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
RSpec.describe Mailersend::Account do
|
|
16
|
+
let(:client) { Mailersend::Client.new(API_TOKEN) }
|
|
17
|
+
let(:account) { Mailersend::Account.new(client) }
|
|
18
|
+
|
|
19
|
+
it 'returns the account' do
|
|
20
|
+
VCR.use_cassette('account/account_get') do
|
|
21
|
+
response = account.get_account
|
|
22
|
+
data = JSON.parse(response.body)['data']
|
|
23
|
+
|
|
24
|
+
expect(response.status).to eq(200)
|
|
25
|
+
expect(response.uri.to_s).to eq('https://api.mailersend.com/v1/account')
|
|
26
|
+
expect(data).to include('name' => 'Acme Inc', 'status' => 'approved', 'plan_type' => 'starter', 'data_retention_days' => 7)
|
|
27
|
+
expect(data['emails']).to eq('sent' => 12_000, 'received' => 430, 'limit' => -1)
|
|
28
|
+
expect(data['rate_limits']).to eq('general' => 60, 'email' => 120, 'bulk_email' => 10, 'activity' => 10)
|
|
29
|
+
expect(data['resources']).to include('domains' => { 'used' => 3, 'limit' => 10 }, 'free_accountant_seat' => { 'used' => 0, 'limit' => 0 })
|
|
30
|
+
expect(data['addons']).to include('whatsapp' => { 'sent' => 800, 'limit' => 1000 }, 'sms' => { 'sent' => 120, 'received' => 30, 'limit' => -1 })
|
|
31
|
+
expect(data['addons']).to include('phone_numbers' => 1, 'domain_spaces' => 2, 'data_retention_days' => 30, 'dedicated_ips' => 0)
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
it 'returns the account without a WhatsApp add-on' do
|
|
36
|
+
VCR.use_cassette('account/account_get_without_whatsapp') do
|
|
37
|
+
data = JSON.parse(account.get_account.body)['data']
|
|
38
|
+
|
|
39
|
+
expect(data['addons']).to include('whatsapp' => nil)
|
|
40
|
+
expect(data['resources']).to include('free_accountant_seat' => { 'used' => 1, 'limit' => 1 }, 'webhooks' => { 'used' => 0, 'limit' => nil })
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mailersend-ruby
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Nikola Milojević
|
|
@@ -77,6 +77,8 @@ files:
|
|
|
77
77
|
- Rakefile
|
|
78
78
|
- bin/console
|
|
79
79
|
- bin/setup
|
|
80
|
+
- fixtures/account/account_get.yml
|
|
81
|
+
- fixtures/account/account_get_without_whatsapp.yml
|
|
80
82
|
- fixtures/activity/activity_get_activity.yml
|
|
81
83
|
- fixtures/api_quota/api_quota_get.yml
|
|
82
84
|
- fixtures/bulk_email/bulk_email_send.yml
|
|
@@ -175,6 +177,7 @@ files:
|
|
|
175
177
|
- lefthook.yml
|
|
176
178
|
- lib/mailersend-ruby.rb
|
|
177
179
|
- lib/mailersend.rb
|
|
180
|
+
- lib/mailersend/account/account.rb
|
|
178
181
|
- lib/mailersend/activity/activity.rb
|
|
179
182
|
- lib/mailersend/analytics/analytics.rb
|
|
180
183
|
- lib/mailersend/api_quota/api_quota.rb
|
|
@@ -211,6 +214,7 @@ files:
|
|
|
211
214
|
- lib/mailersend/whatsapp_templates/whatsapp_templates.rb
|
|
212
215
|
- mailersend-ruby.gemspec
|
|
213
216
|
- renovate.json
|
|
217
|
+
- spec/account_rspec.rb
|
|
214
218
|
- spec/activity_rspec.rb
|
|
215
219
|
- spec/api_quota_rspec.rb
|
|
216
220
|
- spec/bulk_email_rspec.rb
|