mailtrap 2.7.0 → 2.8.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/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/README.md +4 -2
- data/lib/mailtrap/account_access.rb +20 -0
- data/lib/mailtrap/account_accesses_api.rb +43 -0
- data/lib/mailtrap/billing_api.rb +18 -0
- data/lib/mailtrap/billing_usage.rb +16 -0
- data/lib/mailtrap/project.rb +1 -1
- data/lib/mailtrap/version.rb +1 -1
- data/lib/mailtrap.rb +2 -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: ad3283b7e6c8af70b1ac8bb3a965868e3b312c01682615c86f7da5104add3bcb
|
|
4
|
+
data.tar.gz: 8bab417f54c310a6a92b93ed4a1c6ca6a4cd88dae2e0614e3d2f21cda05d8cf0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 317490e679342d1c9ac8ae12162268c4102ee410a3d4a9896237894c2a5cd39063595c613d248938a1770cd8f24c7cb4dc72f109c1dabec48f920f92f47cd89d
|
|
7
|
+
data.tar.gz: 7da01e190af37689aff6aacdeb411f0858c7c75baf809b51266db920e2988021343e73f164728d9d9bf857139ee2f30cbf004b6c50782d7394685ef6513f05d8
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -191,9 +191,11 @@ Contact management:
|
|
|
191
191
|
|
|
192
192
|
General:
|
|
193
193
|
|
|
194
|
-
- Templates CRUD – [`email_templates_api.rb`](examples/email_templates_api.rb)
|
|
195
|
-
- Action Mailer – [`action_mailer.rb`](examples/action_mailer.rb)
|
|
196
194
|
- Accounts API – [`accounts_api.rb`](examples/accounts_api.rb)
|
|
195
|
+
- Account Accesses API – [`account_accesses_api.rb`](examples/account_accesses_api.rb)
|
|
196
|
+
- Billing API – [`billing_api.rb`](examples/billing_api.rb)
|
|
197
|
+
- Templates API – [`email_templates_api.rb`](examples/email_templates_api.rb)
|
|
198
|
+
- Action Mailer – [`action_mailer.rb`](examples/action_mailer.rb)
|
|
197
199
|
|
|
198
200
|
## Migration guide v1 → v2
|
|
199
201
|
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Mailtrap
|
|
4
|
+
# Data Transfer Object for AccountAccess
|
|
5
|
+
# @see https://docs.mailtrap.io/developers/account-management/access-control
|
|
6
|
+
# @attr_reader id [Integer] The access ID
|
|
7
|
+
# @attr_reader specifier_type [String] The type of the specifier
|
|
8
|
+
# @attr_reader specifier [Hash] The specifier for the access
|
|
9
|
+
# @attr_reader resources [Array<Hash>] The resources this access applies to
|
|
10
|
+
# @attr_reader permissions [Hash] The permissions granted
|
|
11
|
+
#
|
|
12
|
+
AccountAccess = Struct.new(
|
|
13
|
+
:id,
|
|
14
|
+
:specifier_type,
|
|
15
|
+
:specifier,
|
|
16
|
+
:resources,
|
|
17
|
+
:permissions,
|
|
18
|
+
keyword_init: true
|
|
19
|
+
)
|
|
20
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'base_api'
|
|
4
|
+
require_relative 'account_access'
|
|
5
|
+
|
|
6
|
+
module Mailtrap
|
|
7
|
+
class AccountAccessesAPI
|
|
8
|
+
include BaseAPI
|
|
9
|
+
|
|
10
|
+
attr_reader :account_id
|
|
11
|
+
|
|
12
|
+
self.response_class = AccountAccess
|
|
13
|
+
|
|
14
|
+
# Retrieves a list of account accesses with optional filtering by domain, inbox, or project IDs
|
|
15
|
+
# @param domain_ids [Array<Integer>] Optional array of domain IDs to filter by
|
|
16
|
+
# @param inbox_ids [Array<Integer>] Optional array of inbox IDs to filter by
|
|
17
|
+
# @param project_ids [Array<Integer>] Optional array of project IDs to filter by
|
|
18
|
+
# @return [Array<AccountAccess>] List of account access objects
|
|
19
|
+
# @!macro api_errors
|
|
20
|
+
def list(domain_ids: [], inbox_ids: [], project_ids: [])
|
|
21
|
+
query_params = {}
|
|
22
|
+
query_params[:domain_ids] = domain_ids unless domain_ids.empty?
|
|
23
|
+
query_params[:inbox_ids] = inbox_ids unless inbox_ids.empty?
|
|
24
|
+
query_params[:project_ids] = project_ids unless project_ids.empty?
|
|
25
|
+
|
|
26
|
+
base_list(query_params)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Deletes an account access
|
|
30
|
+
# @param account_access_id [Integer] The account access ID
|
|
31
|
+
# @return [Hash]
|
|
32
|
+
# @!macro api_errors
|
|
33
|
+
def delete(account_access_id)
|
|
34
|
+
base_delete(account_access_id)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
private
|
|
38
|
+
|
|
39
|
+
def base_path
|
|
40
|
+
"/api/accounts/#{account_id}/account_accesses"
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'base_api'
|
|
4
|
+
require_relative 'billing_usage'
|
|
5
|
+
|
|
6
|
+
module Mailtrap
|
|
7
|
+
class BillingAPI
|
|
8
|
+
include BaseAPI
|
|
9
|
+
|
|
10
|
+
# Get current billing cycle usage
|
|
11
|
+
# @return [BillingUsage] Billing usage data for account
|
|
12
|
+
# @!macro api_errors
|
|
13
|
+
def usage
|
|
14
|
+
response = client.get("/api/accounts/#{account_id}/billing/usage")
|
|
15
|
+
build_entity(response, BillingUsage)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Mailtrap
|
|
4
|
+
# Data Transfer Object for Billing Usage data
|
|
5
|
+
# @see https://docs.mailtrap.io/developers/account-management/billing
|
|
6
|
+
# @attr_reader billing [Hash] The billing cycle details
|
|
7
|
+
# @attr_reader testing [Hash] Testing subscription usage
|
|
8
|
+
# @attr_reader sending [Hash] Sending subscription usage
|
|
9
|
+
#
|
|
10
|
+
BillingUsage = Struct.new(
|
|
11
|
+
:billing,
|
|
12
|
+
:testing,
|
|
13
|
+
:sending,
|
|
14
|
+
keyword_init: true
|
|
15
|
+
)
|
|
16
|
+
end
|
data/lib/mailtrap/project.rb
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
module Mailtrap
|
|
4
4
|
# Data Transfer Object for Project
|
|
5
|
-
# @see https://
|
|
5
|
+
# @see https://docs.mailtrap.io/developers/email-sandbox/projects
|
|
6
6
|
# @attr_reader id [Integer] The project ID
|
|
7
7
|
# @attr_reader name [String] The project name
|
|
8
8
|
# @attr_reader share_links [Hash] Admin and viewer share links
|
data/lib/mailtrap/version.rb
CHANGED
data/lib/mailtrap.rb
CHANGED
|
@@ -5,6 +5,8 @@ require_relative 'mailtrap/mail'
|
|
|
5
5
|
require_relative 'mailtrap/errors'
|
|
6
6
|
require_relative 'mailtrap/version'
|
|
7
7
|
require_relative 'mailtrap/accounts_api'
|
|
8
|
+
require_relative 'mailtrap/account_accesses_api'
|
|
9
|
+
require_relative 'mailtrap/billing_api'
|
|
8
10
|
require_relative 'mailtrap/email_templates_api'
|
|
9
11
|
require_relative 'mailtrap/contacts_api'
|
|
10
12
|
require_relative 'mailtrap/contact_lists_api'
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mailtrap
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.8.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Railsware Products Studio LLC
|
|
@@ -43,12 +43,16 @@ files:
|
|
|
43
43
|
- Rakefile
|
|
44
44
|
- lib/mailtrap.rb
|
|
45
45
|
- lib/mailtrap/account.rb
|
|
46
|
+
- lib/mailtrap/account_access.rb
|
|
47
|
+
- lib/mailtrap/account_accesses_api.rb
|
|
46
48
|
- lib/mailtrap/accounts_api.rb
|
|
47
49
|
- lib/mailtrap/action_mailer.rb
|
|
48
50
|
- lib/mailtrap/action_mailer/delivery_method.rb
|
|
49
51
|
- lib/mailtrap/action_mailer/railtie.rb
|
|
50
52
|
- lib/mailtrap/attachment.rb
|
|
51
53
|
- lib/mailtrap/base_api.rb
|
|
54
|
+
- lib/mailtrap/billing_api.rb
|
|
55
|
+
- lib/mailtrap/billing_usage.rb
|
|
52
56
|
- lib/mailtrap/client.rb
|
|
53
57
|
- lib/mailtrap/contact.rb
|
|
54
58
|
- lib/mailtrap/contact_field.rb
|