mailgun-ruby 1.2.12 → 1.2.13
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/.ruby-env.yml.example +1 -0
- data/CHANGELOG.md +2 -2
- data/README.md +3 -0
- data/docs/EmailValidation.md +34 -0
- data/docs/Subaccounts.md +68 -0
- data/docs/Suppressions.md +10 -0
- data/docs/railgun/EmailValidation.md +34 -0
- data/lib/mailgun/client.rb +11 -0
- data/lib/mailgun/subaccounts/subaccounts.rb +84 -0
- data/lib/mailgun/version.rb +1 -1
- data/lib/mailgun.rb +1 -0
- data/lib/railgun/mailer.rb +2 -0
- data/mailgun.gemspec +1 -1
- data/spec/integration/subaccounts_spec.rb +58 -0
- data/vcr_cassettes/subaccounts.yml +270 -0
- metadata +11 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 63fbab3c08481c2364ca4fef89def410a12672507954764103e900bb0f081858
|
4
|
+
data.tar.gz: e2fed301bb806d720b6e7f9f8707d415756ed92f5b841592ebc100eb53a71d74
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69ad70a850bdb1cbc859647509315b118aa7508747c8af281eeb7ec4514156f1416aa16b4d0e10e07fa168adc705ba110d20b28aae3137b26c454cdf9115b191
|
7
|
+
data.tar.gz: e5f30539ca1dfd25ab6bd489c7544febd7b54ae00b407c3378e9ecd3c7166efd961d76f73943e931015436880eab72b607cea5629bf26fda811cbfec1dc1e787
|
data/.ruby-env.yml.example
CHANGED
data/CHANGELOG.md
CHANGED
@@ -4,11 +4,11 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
|
5
5
|
## [Unreleased]
|
6
6
|
|
7
|
-
## [1.2.
|
7
|
+
## [1.2.13] - 2023-11-25
|
8
8
|
|
9
9
|
### Added
|
10
10
|
|
11
|
-
-
|
11
|
+
- Subaccounts API support (https://github.com/mailgun/mailgun-ruby/pull/300).
|
12
12
|
|
13
13
|
### Fixed
|
14
14
|
|
data/README.md
CHANGED
@@ -188,8 +188,11 @@ This SDK includes the following components:
|
|
188
188
|
- [Domains](docs/Domains.md)
|
189
189
|
- [Webhooks](docs/Webhooks.md)
|
190
190
|
- [Events](docs/Events.md)
|
191
|
+
- [Snippets](docs/Snippets.md)
|
192
|
+
- [Subaccounts](docs/Subaccounts.md)
|
191
193
|
- [Suppressions](docs/Suppressions.md)
|
192
194
|
- [Templates](docs/Templates.md)
|
195
|
+
- [EmailValidation](docs/EmailValidation.md)
|
193
196
|
|
194
197
|
Message Builder allows you to quickly create the array of parameters, required
|
195
198
|
to send a message, by calling a methods for each parameter.
|
@@ -0,0 +1,34 @@
|
|
1
|
+
Mailgun - Email Validation
|
2
|
+
====================
|
3
|
+
|
4
|
+
This is the Mailgun Ruby *Email Validation* utilities.
|
5
|
+
|
6
|
+
The below assumes you've already installed the Mailgun Ruby SDK in to your
|
7
|
+
project. If not, go back to the master README for instructions.
|
8
|
+
|
9
|
+
Usage - Email Validation
|
10
|
+
-----------------------
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
# First, instantiate the Mailgun Address. It pulls api key for Client from Mailgun.api_key variable.
|
14
|
+
email_validator = Mailgun::Address.new
|
15
|
+
|
16
|
+
# Given an arbitrary address, validates address based off defined checks.
|
17
|
+
# Response Example:
|
18
|
+
# {
|
19
|
+
# "address": "existingemail@realdomain.com",
|
20
|
+
# "is_disposable_address": false,
|
21
|
+
# "is_role_address": false,
|
22
|
+
# "reason": [],
|
23
|
+
# "result": "deliverable",
|
24
|
+
# "risk": "low"
|
25
|
+
# }
|
26
|
+
email_validator.validate('email@example.com')
|
27
|
+
|
28
|
+
|
29
|
+
```
|
30
|
+
|
31
|
+
More Documentation
|
32
|
+
------------------
|
33
|
+
See the official [Mailgun Email Validation Docs](https://documentation.mailgun.com/en/latest/api-email-validation.html)
|
34
|
+
for more information
|
data/docs/Subaccounts.md
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
Mailgun - [Subaccounts](https://help.mailgun.com/hc/en-us/articles/16380043681435-Subaccounts)
|
2
|
+
====================
|
3
|
+
|
4
|
+
Rails
|
5
|
+
-----
|
6
|
+
|
7
|
+
The library can be initialized with a Rails initializer containing similar:
|
8
|
+
```ruby
|
9
|
+
Mailgun.configure do |config|
|
10
|
+
config.api_key = 'your-secret-api-key'
|
11
|
+
end
|
12
|
+
```
|
13
|
+
Or have the initializer read your environment setting if you prefer.
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
Mailgun.api_key = 'your-secret-api-key'
|
17
|
+
```
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
mb_obj = Mailgun::Subaccounts.new
|
21
|
+
|
22
|
+
# Get subaccounts list
|
23
|
+
mb_obj.get_subaccounts(limit: 10, skip: 0, sort: 'ask', enabled: true)
|
24
|
+
=> {"subaccounts"=>[{"id"=>"XYZ", "name"=>"test.subaccount1", "status"=>"open"}, {"id"=>"YYY", "name"=>"test.subaccount2", "status"=>"open"}], "total"=>2}
|
25
|
+
|
26
|
+
# Get subaccount information
|
27
|
+
mb_obj.info(subaccount_id)
|
28
|
+
=> {"subaccount"=>{"id"=>"XYZ", "name"=>"test.subaccount1", "status"=>"open"}
|
29
|
+
|
30
|
+
# Add Subaccount
|
31
|
+
mb_obj.create(name)
|
32
|
+
=> {"subaccount"=>{"id"=>"XYZ", "name"=>"test.subaccount1", "status"=>"open"}}
|
33
|
+
|
34
|
+
# Disable
|
35
|
+
mb_obj.disable(subaccount_id)
|
36
|
+
=> {"subaccount"=>{"id"=>"XYZ", "name"=>"test.subaccount1", "status"=>"disabled"}}
|
37
|
+
|
38
|
+
# Enable
|
39
|
+
mb_obj.enable(subaccount_id)
|
40
|
+
=> {"subaccount"=>{"id"=>"XYZ", "name"=>"test.subaccount1", "status"=>"open"}}
|
41
|
+
```
|
42
|
+
|
43
|
+
Primary accounts can make API calls on behalf of their subaccounts.
|
44
|
+
```ruby
|
45
|
+
# First, instantiate the Mailgun Client with your API key
|
46
|
+
mg_client = Mailgun::Client.new 'your-api-key'
|
47
|
+
mg_client.set_subaccount('SUBACCOUNT_ID')
|
48
|
+
|
49
|
+
# Define your message parameters
|
50
|
+
message_params = { from: 'bob@SUBACCOUNT_DOMAIN',
|
51
|
+
to: 'sally@example.com',
|
52
|
+
subject: 'The Ruby SDK is awesome!',
|
53
|
+
text: 'It is really easy to send a message!'
|
54
|
+
}
|
55
|
+
|
56
|
+
# Send your message through the client
|
57
|
+
# Note: This will not actually hit the API, and will return a generic OK response.
|
58
|
+
mg_client.send_message('SUBACCOUNT_DOMAIN', message_params)
|
59
|
+
|
60
|
+
# Reset subaccount for primary usage
|
61
|
+
mg_client.reset_subaccount
|
62
|
+
```
|
63
|
+
|
64
|
+
|
65
|
+
More Documentation
|
66
|
+
------------------
|
67
|
+
See the official [Mailgun Docs](https://documentation.mailgun.com/en/latest/subaccounts.html#subaccounts)
|
68
|
+
for more information.
|
data/docs/Suppressions.md
CHANGED
@@ -38,6 +38,16 @@ supp_client.list_complaints
|
|
38
38
|
|
39
39
|
----
|
40
40
|
|
41
|
+
To get the next or previous suppressions page:
|
42
|
+
|
43
|
+
```ruby
|
44
|
+
supp_client.list_bounces # returns first *limit* records + next, previous pages urls
|
45
|
+
supp_client.next # returns next *limit* records
|
46
|
+
supp_client.prev # returns previous *limit* records
|
47
|
+
```
|
48
|
+
|
49
|
+
----
|
50
|
+
|
41
51
|
To batch-add a set of bounces:
|
42
52
|
|
43
53
|
```ruby
|
@@ -0,0 +1,34 @@
|
|
1
|
+
Mailgun - Email Validation
|
2
|
+
====================
|
3
|
+
|
4
|
+
This is the Mailgun Ruby *Email Validation* utilities.
|
5
|
+
|
6
|
+
The below assumes you've already installed the Mailgun Ruby SDK in to your
|
7
|
+
project. If not, go back to the master README for instructions.
|
8
|
+
|
9
|
+
Usage - Email Validation
|
10
|
+
-----------------------
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
# First, instantiate the Mailgun Address. It pulls api key for Client from Mailgun.api_key variable.
|
14
|
+
email_validator = Mailgun::Address.new
|
15
|
+
|
16
|
+
# Given an arbitrary address, validates address based off defined checks.
|
17
|
+
# Response Example:
|
18
|
+
# {
|
19
|
+
# "address": "existingemail@realdomain.com",
|
20
|
+
# "is_disposable_address": false,
|
21
|
+
# "is_role_address": false,
|
22
|
+
# "reason": [],
|
23
|
+
# "result": "deliverable",
|
24
|
+
# "risk": "low"
|
25
|
+
# }
|
26
|
+
email_validator.validate('email@example.com')
|
27
|
+
|
28
|
+
|
29
|
+
```
|
30
|
+
|
31
|
+
More Documentation
|
32
|
+
------------------
|
33
|
+
See the official [Mailgun Email Validation Docs](https://documentation.mailgun.com/en/latest/api-email-validation.html)
|
34
|
+
for more information
|
data/lib/mailgun/client.rb
CHANGED
@@ -9,6 +9,7 @@ module Mailgun
|
|
9
9
|
#
|
10
10
|
# See the Github documentation for full examples.
|
11
11
|
class Client
|
12
|
+
SUBACCOUNT_HEADER = 'X-Mailgun-On-Behalf-Of'.freeze
|
12
13
|
|
13
14
|
def initialize(api_key = Mailgun.api_key,
|
14
15
|
api_host = Mailgun.api_host || 'api.mailgun.net',
|
@@ -50,6 +51,16 @@ module Mailgun
|
|
50
51
|
@http_client.options[:password] = api_key
|
51
52
|
end
|
52
53
|
|
54
|
+
# Add subaccount id to headers
|
55
|
+
def set_subaccount(subaccount_id)
|
56
|
+
@http_client.options[:headers] = { SUBACCOUNT_HEADER => subaccount_id }
|
57
|
+
end
|
58
|
+
|
59
|
+
# Reset subaccount for primary usage
|
60
|
+
def reset_subaccount
|
61
|
+
@http_client.options[:headers].delete(SUBACCOUNT_HEADER)
|
62
|
+
end
|
63
|
+
|
53
64
|
# Client is in test mode?
|
54
65
|
#
|
55
66
|
# @return [Boolean] Is the client set in test mode?
|
@@ -0,0 +1,84 @@
|
|
1
|
+
require 'mailgun/exceptions/exceptions'
|
2
|
+
|
3
|
+
module Mailgun
|
4
|
+
|
5
|
+
# A Mailgun::Subaccounts object is a simple CRUD interface to Mailgun Subaccounts.
|
6
|
+
# Uses Mailgun
|
7
|
+
class Subaccounts
|
8
|
+
attr_reader :client
|
9
|
+
|
10
|
+
# Public: creates a new Mailgun::Subaccounts instance.
|
11
|
+
# Defaults to Mailgun::Client
|
12
|
+
def initialize(client = Mailgun::Client.new(Mailgun.api_key, Mailgun.api_host || 'api.mailgun.net', 'v5'))
|
13
|
+
@client = client
|
14
|
+
end
|
15
|
+
|
16
|
+
# Public: Get subaccounts
|
17
|
+
# options - [Hash] of
|
18
|
+
# limit - [Integer] Maximum number of records to return. (10 by default)
|
19
|
+
# skip [Integer] Number of records to skip
|
20
|
+
# sort [Array] “asc” or “desc”
|
21
|
+
# enabled [boolean] (Optional) Returns all enabled/disabled subaccounts, defaults to all if omitted
|
22
|
+
# headers - [String] (Optional) Key Value json dictionary of headers to be stored with the subaccount.
|
23
|
+
# ex.('{"Subject": "{{subject}}"}')
|
24
|
+
#
|
25
|
+
# Returns [Array] A list of subaccounts (hash)
|
26
|
+
def list(options = {})
|
27
|
+
client.get("accounts/subaccounts", options).to_h!
|
28
|
+
end
|
29
|
+
alias_method :get_subaccounts, :list
|
30
|
+
|
31
|
+
# Public: Get subaccount information
|
32
|
+
#
|
33
|
+
# subaccount_id - [String] subaccount name to lookup for
|
34
|
+
# options - [Hash] of
|
35
|
+
# headers - [String] (Optional) Key Value json dictionary of headers to be stored with the subaccount.
|
36
|
+
# ex.('{"Subject": "{{subject}}"}')
|
37
|
+
#
|
38
|
+
# Returns [Hash] Information on the requested subaccount.
|
39
|
+
def info(subaccount_id, options = {})
|
40
|
+
fail(ParameterError, 'No Id of subaccount specified', caller) unless subaccount_id
|
41
|
+
client.get("accounts/subaccounts/#{subaccount_id}", options).to_h!
|
42
|
+
end
|
43
|
+
|
44
|
+
# Public: Add Subaccount
|
45
|
+
#
|
46
|
+
# name - [String] Name of the subaccount being created
|
47
|
+
# options - [Hash] of
|
48
|
+
# name - [String] Name of the subaccount being created.
|
49
|
+
# headers - [String] (Optional) Key Value json dictionary of headers to be stored with the subaccount.
|
50
|
+
# ex.('{"Subject": "{{subject}}"}')
|
51
|
+
#
|
52
|
+
# Returns [Hash] of created subaccount
|
53
|
+
def create(name, options = {})
|
54
|
+
fail(ParameterError, 'No name given to create subaccount', caller) unless name
|
55
|
+
client.post("accounts/subaccounts", options.merge!(name: name)).to_h!
|
56
|
+
end
|
57
|
+
|
58
|
+
# Public: Disable a subaccount
|
59
|
+
#
|
60
|
+
# subaccount_id - [String] subaccount name to disable
|
61
|
+
# options - [Hash] of
|
62
|
+
# headers - [String] (Optional) Key Value json dictionary of headers to be stored with the subaccount.
|
63
|
+
# ex.('{"Subject": "{{subject}}"}')
|
64
|
+
#
|
65
|
+
# Returns [Hash] Information on the requested subaccount.
|
66
|
+
def disable(subaccount_id, options = {})
|
67
|
+
fail(ParameterError, 'No Id of subaccount specified', caller) unless subaccount_id
|
68
|
+
client.post("accounts/subaccounts/#{subaccount_id}/disable", options).to_h!
|
69
|
+
end
|
70
|
+
|
71
|
+
# Public: Enable a subaccount
|
72
|
+
#
|
73
|
+
# subaccount_id - [String] subaccount name to enable
|
74
|
+
# options - [Hash] of
|
75
|
+
# headers - [String] (Optional) Key Value json dictionary of headers to be stored with the subaccount.
|
76
|
+
# ex.('{"Subject": "{{subject}}"}')
|
77
|
+
#
|
78
|
+
# Returns [Hash] Information on the requested subaccount.
|
79
|
+
def enable(subaccount_id, options = {})
|
80
|
+
fail(ParameterError, 'No Id of subaccount specified', caller) unless subaccount_id
|
81
|
+
client.post("accounts/subaccounts/#{subaccount_id}/enable", options).to_h!
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
data/lib/mailgun/version.rb
CHANGED
data/lib/mailgun.rb
CHANGED
@@ -16,6 +16,7 @@ require 'mailgun/exceptions/exceptions'
|
|
16
16
|
require 'mailgun/domains/domains'
|
17
17
|
require 'mailgun/webhooks/webhooks'
|
18
18
|
require 'mailgun/templates/templates'
|
19
|
+
require 'mailgun/subaccounts/subaccounts'
|
19
20
|
|
20
21
|
# Module for interacting with the sweet Mailgun API.
|
21
22
|
#
|
data/lib/railgun/mailer.rb
CHANGED
@@ -49,9 +49,11 @@ module Railgun
|
|
49
49
|
def deliver!(mail)
|
50
50
|
@mg_domain = set_mg_domain(mail)
|
51
51
|
@mg_client.set_api_key(mail[:api_key].value) if mail[:api_key].present?
|
52
|
+
@mg_client.set_subaccount(mail[:subaccount_id].value) if mail[:subaccount_id].present?
|
52
53
|
|
53
54
|
mail[:domain] = nil if mail[:domain].present?
|
54
55
|
mail[:api_key] = nil if mail[:api_key].present?
|
56
|
+
mail[:subaccount_id] = nil if mail[:subaccount_id].present?
|
55
57
|
|
56
58
|
mg_message = Railgun.transform_for_mailgun(mail)
|
57
59
|
response = @mg_client.send_message(@mg_domain, mg_message)
|
data/mailgun.gemspec
CHANGED
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.add_development_dependency 'bundler', '>= 1.16.2'
|
31
31
|
spec.add_development_dependency 'rspec', '~> 3.8.0'
|
32
32
|
spec.add_development_dependency 'rake', '~> 12.3.2'
|
33
|
-
spec.add_development_dependency 'webmock', '~> 3.
|
33
|
+
spec.add_development_dependency 'webmock', '~> 3.7'
|
34
34
|
spec.add_development_dependency 'pry', '~> 0.11.3'
|
35
35
|
spec.add_development_dependency 'vcr', '~> 3.0.3'
|
36
36
|
spec.add_development_dependency 'simplecov', '~> 0.16.1'
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'mailgun'
|
3
|
+
|
4
|
+
vcr_opts = { :cassette_name => "subaccounts" }
|
5
|
+
|
6
|
+
describe 'For the subaccounts endpoints', vcr: vcr_opts do
|
7
|
+
let(:name) { 'test.subaccount' }
|
8
|
+
let(:subaccount_id) { 'xxx' }
|
9
|
+
|
10
|
+
before(:all) do
|
11
|
+
mg_client = Mailgun::Client.new(APIKEY, APIHOST, 'v5')
|
12
|
+
@mg_obj = Mailgun::Subaccounts.new mg_client
|
13
|
+
end
|
14
|
+
|
15
|
+
describe '#list' do
|
16
|
+
it 'returns a list of templates' do
|
17
|
+
result = @mg_obj.list
|
18
|
+
|
19
|
+
expect(result).to eq({"subaccounts"=>[{"id"=>"xxx", "name"=>"test-ruby-lib", "status"=>"open"}], "total"=>1})
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe '#create' do
|
24
|
+
it 'creates the subaccount' do
|
25
|
+
result = @mg_obj.create(name)
|
26
|
+
|
27
|
+
expect(result).to eq({"subaccount"=>{"id"=>"xxx", "name"=>"test.subaccount", "status"=>"open"}})
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
describe '#info' do
|
33
|
+
it 'gets the templates info' do
|
34
|
+
result = @mg_obj.info(subaccount_id)
|
35
|
+
|
36
|
+
expect(result).to eq({"subaccount"=>{"id"=>"xxx", "name"=>"test-ruby-lib", "status"=>"open"}})
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
|
41
|
+
|
42
|
+
describe '#enable' do
|
43
|
+
it 'enables the subaccount' do
|
44
|
+
result = @mg_obj.enable(subaccount_id)
|
45
|
+
|
46
|
+
expect(result).to eq({"subaccount"=>{"id"=>"xxx", "name"=>"test-ruby-lib", "status"=>"open"}})
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
describe '#disable' do
|
51
|
+
it 'disables the subaccount' do
|
52
|
+
result = @mg_obj.disable(subaccount_id)
|
53
|
+
|
54
|
+
expect(result).to eq({"subaccount"=>{"id"=>"xxx", "name"=>"test-ruby-lib", "status"=>"disabled"}})
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
@@ -0,0 +1,270 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.mailgun.net/v5/accounts/subaccounts
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- "*/*"
|
12
|
+
User-Agent:
|
13
|
+
- rest-client/2.1.0 (darwin22 x86_64) ruby/2.7.4p191
|
14
|
+
Accept-Encoding:
|
15
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
16
|
+
Host:
|
17
|
+
- api.mailgun.net
|
18
|
+
Authorization:
|
19
|
+
- Basic xxx
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 200
|
23
|
+
message: OK
|
24
|
+
headers:
|
25
|
+
Access-Control-Allow-Credentials:
|
26
|
+
- 'true'
|
27
|
+
Access-Control-Allow-Origin:
|
28
|
+
- "*"
|
29
|
+
Cache-Control:
|
30
|
+
- no-store
|
31
|
+
Content-Disposition:
|
32
|
+
- inline
|
33
|
+
Content-Length:
|
34
|
+
- '706'
|
35
|
+
Content-Type:
|
36
|
+
- application/json
|
37
|
+
Date:
|
38
|
+
- Mon, 20 Nov 2023 15:30:55 GMT
|
39
|
+
Server:
|
40
|
+
- TwistedWeb/23.10.0
|
41
|
+
Strict-Transport-Security:
|
42
|
+
- max-age=63072000; includeSubDomains
|
43
|
+
X-Mailgun-Key-Id:
|
44
|
+
- 1c7e8847-e7fad6d2
|
45
|
+
X-Xss-Protection:
|
46
|
+
- 1; mode=block
|
47
|
+
body:
|
48
|
+
encoding: UTF-8
|
49
|
+
string: '{"subaccounts":[{"id":"xxx","name":"test-ruby-lib","status":"open"}],"total":1}
|
50
|
+
|
51
|
+
'
|
52
|
+
http_version:
|
53
|
+
recorded_at: Mon, 20 Nov 2023 15:30:55 GMT
|
54
|
+
- request:
|
55
|
+
method: post
|
56
|
+
uri: https://api.mailgun.net/v5/accounts/subaccounts
|
57
|
+
body:
|
58
|
+
encoding: UTF-8
|
59
|
+
string: name=test.subaccount
|
60
|
+
headers:
|
61
|
+
Accept:
|
62
|
+
- "*/*"
|
63
|
+
User-Agent:
|
64
|
+
- rest-client/2.1.0 (darwin22 x86_64) ruby/2.7.4p191
|
65
|
+
Content-Length:
|
66
|
+
- '20'
|
67
|
+
Content-Type:
|
68
|
+
- application/x-www-form-urlencoded
|
69
|
+
Accept-Encoding:
|
70
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
71
|
+
Host:
|
72
|
+
- api.mailgun.net
|
73
|
+
Authorization:
|
74
|
+
- Basic xxx
|
75
|
+
response:
|
76
|
+
status:
|
77
|
+
code: 200
|
78
|
+
message: OK
|
79
|
+
headers:
|
80
|
+
Access-Control-Allow-Credentials:
|
81
|
+
- 'true'
|
82
|
+
Access-Control-Allow-Origin:
|
83
|
+
- "*"
|
84
|
+
Cache-Control:
|
85
|
+
- no-store
|
86
|
+
Content-Disposition:
|
87
|
+
- inline
|
88
|
+
Content-Length:
|
89
|
+
- '90'
|
90
|
+
Content-Type:
|
91
|
+
- application/json
|
92
|
+
Date:
|
93
|
+
- Mon, 20 Nov 2023 15:33:05 GMT
|
94
|
+
Server:
|
95
|
+
- TwistedWeb/23.10.0
|
96
|
+
Strict-Transport-Security:
|
97
|
+
- max-age=63072000; includeSubDomains
|
98
|
+
X-Mailgun-Key-Id:
|
99
|
+
- 1c7e8847-e7fad6d2
|
100
|
+
X-Xss-Protection:
|
101
|
+
- 1; mode=block
|
102
|
+
body:
|
103
|
+
encoding: UTF-8
|
104
|
+
string: '{"subaccount":{"id":"xxx","name":"test.subaccount","status":"open"}}
|
105
|
+
|
106
|
+
'
|
107
|
+
http_version:
|
108
|
+
recorded_at: Mon, 20 Nov 2023 15:33:05 GMT
|
109
|
+
- request:
|
110
|
+
method: get
|
111
|
+
uri: https://api.mailgun.net/v5/accounts/subaccounts/xxx
|
112
|
+
body:
|
113
|
+
encoding: US-ASCII
|
114
|
+
string: ''
|
115
|
+
headers:
|
116
|
+
Accept:
|
117
|
+
- "*/*"
|
118
|
+
User-Agent:
|
119
|
+
- rest-client/2.1.0 (darwin22 x86_64) ruby/2.7.4p191
|
120
|
+
Accept-Encoding:
|
121
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
122
|
+
Host:
|
123
|
+
- api.mailgun.net
|
124
|
+
Authorization:
|
125
|
+
- Basic xxx
|
126
|
+
response:
|
127
|
+
status:
|
128
|
+
code: 200
|
129
|
+
message: OK
|
130
|
+
headers:
|
131
|
+
Access-Control-Allow-Credentials:
|
132
|
+
- 'true'
|
133
|
+
Access-Control-Allow-Origin:
|
134
|
+
- "*"
|
135
|
+
Cache-Control:
|
136
|
+
- no-store
|
137
|
+
Content-Disposition:
|
138
|
+
- inline
|
139
|
+
Content-Length:
|
140
|
+
- '88'
|
141
|
+
Content-Type:
|
142
|
+
- application/json
|
143
|
+
Date:
|
144
|
+
- Mon, 20 Nov 2023 15:33:06 GMT
|
145
|
+
Server:
|
146
|
+
- TwistedWeb/23.10.0
|
147
|
+
Strict-Transport-Security:
|
148
|
+
- max-age=63072000; includeSubDomains
|
149
|
+
X-Mailgun-Key-Id:
|
150
|
+
- 1c7e8847-e7fad6d2
|
151
|
+
X-Xss-Protection:
|
152
|
+
- 1; mode=block
|
153
|
+
body:
|
154
|
+
encoding: UTF-8
|
155
|
+
string: '{"subaccount":{"id":"xxx","name":"test-ruby-lib","status":"open"}}
|
156
|
+
|
157
|
+
'
|
158
|
+
http_version:
|
159
|
+
recorded_at: Mon, 20 Nov 2023 15:33:06 GMT
|
160
|
+
- request:
|
161
|
+
method: post
|
162
|
+
uri: https://api.mailgun.net/v5/accounts/subaccounts/xxx/enable
|
163
|
+
body:
|
164
|
+
encoding: US-ASCII
|
165
|
+
string: ''
|
166
|
+
headers:
|
167
|
+
Accept:
|
168
|
+
- "*/*"
|
169
|
+
User-Agent:
|
170
|
+
- rest-client/2.1.0 (darwin22 x86_64) ruby/2.7.4p191
|
171
|
+
Content-Length:
|
172
|
+
- '0'
|
173
|
+
Content-Type:
|
174
|
+
- application/x-www-form-urlencoded
|
175
|
+
Accept-Encoding:
|
176
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
177
|
+
Host:
|
178
|
+
- api.mailgun.net
|
179
|
+
Authorization:
|
180
|
+
- Basic xxx
|
181
|
+
response:
|
182
|
+
status:
|
183
|
+
code: 200
|
184
|
+
message: OK
|
185
|
+
headers:
|
186
|
+
Access-Control-Allow-Credentials:
|
187
|
+
- 'true'
|
188
|
+
Access-Control-Allow-Origin:
|
189
|
+
- "*"
|
190
|
+
Cache-Control:
|
191
|
+
- no-store
|
192
|
+
Content-Disposition:
|
193
|
+
- inline
|
194
|
+
Content-Length:
|
195
|
+
- '88'
|
196
|
+
Content-Type:
|
197
|
+
- application/json
|
198
|
+
Date:
|
199
|
+
- Mon, 20 Nov 2023 15:33:06 GMT
|
200
|
+
Server:
|
201
|
+
- TwistedWeb/23.10.0
|
202
|
+
Strict-Transport-Security:
|
203
|
+
- max-age=63072000; includeSubDomains
|
204
|
+
X-Mailgun-Key-Id:
|
205
|
+
- 1c7e8847-e7fad6d2
|
206
|
+
X-Xss-Protection:
|
207
|
+
- 1; mode=block
|
208
|
+
body:
|
209
|
+
encoding: UTF-8
|
210
|
+
string: '{"subaccount":{"id":"xxx","name":"test-ruby-lib","status":"open"}}
|
211
|
+
|
212
|
+
'
|
213
|
+
http_version:
|
214
|
+
recorded_at: Mon, 20 Nov 2023 15:33:06 GMT
|
215
|
+
- request:
|
216
|
+
method: post
|
217
|
+
uri: https://api.mailgun.net/v5/accounts/subaccounts/xxx/disable
|
218
|
+
body:
|
219
|
+
encoding: US-ASCII
|
220
|
+
string: ''
|
221
|
+
headers:
|
222
|
+
Accept:
|
223
|
+
- "*/*"
|
224
|
+
User-Agent:
|
225
|
+
- rest-client/2.1.0 (darwin22 x86_64) ruby/2.7.4p191
|
226
|
+
Content-Length:
|
227
|
+
- '0'
|
228
|
+
Content-Type:
|
229
|
+
- application/x-www-form-urlencoded
|
230
|
+
Accept-Encoding:
|
231
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
232
|
+
Host:
|
233
|
+
- api.mailgun.net
|
234
|
+
Authorization:
|
235
|
+
- Basic xxx
|
236
|
+
response:
|
237
|
+
status:
|
238
|
+
code: 200
|
239
|
+
message: OK
|
240
|
+
headers:
|
241
|
+
Access-Control-Allow-Credentials:
|
242
|
+
- 'true'
|
243
|
+
Access-Control-Allow-Origin:
|
244
|
+
- "*"
|
245
|
+
Cache-Control:
|
246
|
+
- no-store
|
247
|
+
Content-Disposition:
|
248
|
+
- inline
|
249
|
+
Content-Length:
|
250
|
+
- '92'
|
251
|
+
Content-Type:
|
252
|
+
- application/json
|
253
|
+
Date:
|
254
|
+
- Mon, 20 Nov 2023 15:33:07 GMT
|
255
|
+
Server:
|
256
|
+
- TwistedWeb/23.10.0
|
257
|
+
Strict-Transport-Security:
|
258
|
+
- max-age=63072000; includeSubDomains
|
259
|
+
X-Mailgun-Key-Id:
|
260
|
+
- 1c7e8847-e7fad6d2
|
261
|
+
X-Xss-Protection:
|
262
|
+
- 1; mode=block
|
263
|
+
body:
|
264
|
+
encoding: UTF-8
|
265
|
+
string: '{"subaccount":{"id":"xxx","name":"test-ruby-lib","status":"disabled"}}
|
266
|
+
|
267
|
+
'
|
268
|
+
http_version:
|
269
|
+
recorded_at: Mon, 20 Nov 2023 15:33:08 GMT
|
270
|
+
recorded_with: VCR 3.0.3
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mailgun-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mailgun
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-
|
12
|
+
date: 2023-12-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -59,14 +59,14 @@ dependencies:
|
|
59
59
|
requirements:
|
60
60
|
- - "~>"
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: 3.
|
62
|
+
version: '3.7'
|
63
63
|
type: :development
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
67
|
- - "~>"
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: 3.
|
69
|
+
version: '3.7'
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: pry
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
@@ -154,13 +154,16 @@ files:
|
|
154
154
|
- README.md
|
155
155
|
- Rakefile
|
156
156
|
- docs/Domains.md
|
157
|
+
- docs/EmailValidation.md
|
157
158
|
- docs/Events.md
|
158
159
|
- docs/MessageBuilder.md
|
159
160
|
- docs/Messages.md
|
160
161
|
- docs/OptInHandler.md
|
161
162
|
- docs/Snippets.md
|
163
|
+
- docs/Subaccounts.md
|
162
164
|
- docs/Suppressions.md
|
163
165
|
- docs/Webhooks.md
|
166
|
+
- docs/railgun/EmailValidation.md
|
164
167
|
- docs/railgun/Overview.md
|
165
168
|
- docs/railgun/Parameters.md
|
166
169
|
- docs/railgun/Templates.md
|
@@ -176,6 +179,7 @@ files:
|
|
176
179
|
- lib/mailgun/messages/batch_message.rb
|
177
180
|
- lib/mailgun/messages/message_builder.rb
|
178
181
|
- lib/mailgun/response.rb
|
182
|
+
- lib/mailgun/subaccounts/subaccounts.rb
|
179
183
|
- lib/mailgun/suppressions.rb
|
180
184
|
- lib/mailgun/templates/templates.rb
|
181
185
|
- lib/mailgun/version.rb
|
@@ -200,6 +204,7 @@ files:
|
|
200
204
|
- spec/integration/messages/sample_data/mime.txt
|
201
205
|
- spec/integration/routes_spec.rb
|
202
206
|
- spec/integration/stats_spec.rb
|
207
|
+
- spec/integration/subaccounts_spec.rb
|
203
208
|
- spec/integration/suppressions_spec.rb
|
204
209
|
- spec/integration/templates_spec.rb
|
205
210
|
- spec/integration/unsubscribes_spec.rb
|
@@ -235,6 +240,7 @@ files:
|
|
235
240
|
- vcr_cassettes/routes.yml
|
236
241
|
- vcr_cassettes/send_message.yml
|
237
242
|
- vcr_cassettes/stats.yml
|
243
|
+
- vcr_cassettes/subaccounts.yml
|
238
244
|
- vcr_cassettes/suppressions.yml
|
239
245
|
- vcr_cassettes/templates.yml
|
240
246
|
- vcr_cassettes/unsubscribes.yml
|
@@ -279,6 +285,7 @@ test_files:
|
|
279
285
|
- spec/integration/messages/sample_data/mime.txt
|
280
286
|
- spec/integration/routes_spec.rb
|
281
287
|
- spec/integration/stats_spec.rb
|
288
|
+
- spec/integration/subaccounts_spec.rb
|
282
289
|
- spec/integration/suppressions_spec.rb
|
283
290
|
- spec/integration/templates_spec.rb
|
284
291
|
- spec/integration/unsubscribes_spec.rb
|