mandrill-api 1.0.47 → 1.0.48
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/mandrill.rb +2 -0
- data/lib/mandrill/api.rb +142 -6
- data/lib/mandrill/errors.rb +4 -0
- metadata +6 -5
data/lib/mandrill.rb
CHANGED
@@ -63,9 +63,11 @@ module Mandrill
|
|
63
63
|
'Invalid_Reject' => InvalidRejectError,
|
64
64
|
'Unknown_Sender' => UnknownSenderError,
|
65
65
|
'Unknown_Url' => UnknownUrlError,
|
66
|
+
'Unknown_TrackingDomain' => UnknownTrackingDomainError,
|
66
67
|
'Invalid_Template' => InvalidTemplateError,
|
67
68
|
'Unknown_Webhook' => UnknownWebhookError,
|
68
69
|
'Unknown_InboundDomain' => UnknownInboundDomainError,
|
70
|
+
'Unknown_InboundRoute' => UnknownInboundRouteError,
|
69
71
|
'Unknown_Export' => UnknownExportError,
|
70
72
|
'IP_ProvisionLimit' => IPProvisionLimitError,
|
71
73
|
'Unknown_Pool' => UnknownPoolError,
|
data/lib/mandrill/api.rb
CHANGED
@@ -16,9 +16,13 @@ module Mandrill
|
|
16
16
|
# @param [String] code the HTML code for the template with mc:edit attributes for the editable elements
|
17
17
|
# @param [String] text a default text part to be used when sending with this template
|
18
18
|
# @param [Boolean] publish set to false to add a draft template without publishing
|
19
|
+
# @param [Array] labels an optional array of up to 10 labels to use for filtering templates
|
20
|
+
# - [String] labels[] a single label
|
19
21
|
# @return [Hash] the information saved about the new template
|
20
22
|
# - [String] slug the immutable unique code name of the template
|
21
23
|
# - [String] name the name of the template
|
24
|
+
# - [Array] labels the list of labels applied to the template
|
25
|
+
# - [String] labels[] a single label
|
22
26
|
# - [String] code the full HTML code of the template, with mc:edit attributes marking the editable elements - draft version
|
23
27
|
# - [String] subject the subject line of the template, if provided - draft version
|
24
28
|
# - [String] from_email the default sender address for the template, if provided - draft version
|
@@ -33,8 +37,8 @@ module Mandrill
|
|
33
37
|
# - [String] published_at the date and time the template was last published as a UTC string in YYYY-MM-DD HH:MM:SS format, or null if it has not been published
|
34
38
|
# - [String] created_at the date and time the template was first created as a UTC string in YYYY-MM-DD HH:MM:SS format
|
35
39
|
# - [String] updated_at the date and time the template was last modified as a UTC string in YYYY-MM-DD HH:MM:SS format
|
36
|
-
def add(name, from_email=nil, from_name=nil, subject=nil, code=nil, text=nil, publish=true)
|
37
|
-
_params = {:name => name, :from_email => from_email, :from_name => from_name, :subject => subject, :code => code, :text => text, :publish => publish}
|
40
|
+
def add(name, from_email=nil, from_name=nil, subject=nil, code=nil, text=nil, publish=true, labels=[])
|
41
|
+
_params = {:name => name, :from_email => from_email, :from_name => from_name, :subject => subject, :code => code, :text => text, :publish => publish, :labels => labels}
|
38
42
|
return @master.call 'templates/add', _params
|
39
43
|
end
|
40
44
|
|
@@ -43,6 +47,8 @@ module Mandrill
|
|
43
47
|
# @return [Hash] the requested template information
|
44
48
|
# - [String] slug the immutable unique code name of the template
|
45
49
|
# - [String] name the name of the template
|
50
|
+
# - [Array] labels the list of labels applied to the template
|
51
|
+
# - [String] labels[] a single label
|
46
52
|
# - [String] code the full HTML code of the template, with mc:edit attributes marking the editable elements - draft version
|
47
53
|
# - [String] subject the subject line of the template, if provided - draft version
|
48
54
|
# - [String] from_email the default sender address for the template, if provided - draft version
|
@@ -70,9 +76,13 @@ module Mandrill
|
|
70
76
|
# @param [String] code the new code for the template
|
71
77
|
# @param [String] text the new default text part to be used
|
72
78
|
# @param [Boolean] publish set to false to update the draft version of the template without publishing
|
79
|
+
# @param [Array] labels an optional array of up to 10 labels to use for filtering templates
|
80
|
+
# - [String] labels[] a single label
|
73
81
|
# @return [Hash] the template that was updated
|
74
82
|
# - [String] slug the immutable unique code name of the template
|
75
83
|
# - [String] name the name of the template
|
84
|
+
# - [Array] labels the list of labels applied to the template
|
85
|
+
# - [String] labels[] a single label
|
76
86
|
# - [String] code the full HTML code of the template, with mc:edit attributes marking the editable elements - draft version
|
77
87
|
# - [String] subject the subject line of the template, if provided - draft version
|
78
88
|
# - [String] from_email the default sender address for the template, if provided - draft version
|
@@ -87,8 +97,8 @@ module Mandrill
|
|
87
97
|
# - [String] published_at the date and time the template was last published as a UTC string in YYYY-MM-DD HH:MM:SS format, or null if it has not been published
|
88
98
|
# - [String] created_at the date and time the template was first created as a UTC string in YYYY-MM-DD HH:MM:SS format
|
89
99
|
# - [String] updated_at the date and time the template was last modified as a UTC string in YYYY-MM-DD HH:MM:SS format
|
90
|
-
def update(name, from_email=nil, from_name=nil, subject=nil, code=nil, text=nil, publish=true)
|
91
|
-
_params = {:name => name, :from_email => from_email, :from_name => from_name, :subject => subject, :code => code, :text => text, :publish => publish}
|
100
|
+
def update(name, from_email=nil, from_name=nil, subject=nil, code=nil, text=nil, publish=true, labels=nil)
|
101
|
+
_params = {:name => name, :from_email => from_email, :from_name => from_name, :subject => subject, :code => code, :text => text, :publish => publish, :labels => labels}
|
92
102
|
return @master.call 'templates/update', _params
|
93
103
|
end
|
94
104
|
|
@@ -97,6 +107,8 @@ module Mandrill
|
|
97
107
|
# @return [Hash] the template that was published
|
98
108
|
# - [String] slug the immutable unique code name of the template
|
99
109
|
# - [String] name the name of the template
|
110
|
+
# - [Array] labels the list of labels applied to the template
|
111
|
+
# - [String] labels[] a single label
|
100
112
|
# - [String] code the full HTML code of the template, with mc:edit attributes marking the editable elements - draft version
|
101
113
|
# - [String] subject the subject line of the template, if provided - draft version
|
102
114
|
# - [String] from_email the default sender address for the template, if provided - draft version
|
@@ -121,6 +133,8 @@ module Mandrill
|
|
121
133
|
# @return [Hash] the template that was deleted
|
122
134
|
# - [String] slug the immutable unique code name of the template
|
123
135
|
# - [String] name the name of the template
|
136
|
+
# - [Array] labels the list of labels applied to the template
|
137
|
+
# - [String] labels[] a single label
|
124
138
|
# - [String] code the full HTML code of the template, with mc:edit attributes marking the editable elements - draft version
|
125
139
|
# - [String] subject the subject line of the template, if provided - draft version
|
126
140
|
# - [String] from_email the default sender address for the template, if provided - draft version
|
@@ -141,10 +155,13 @@ module Mandrill
|
|
141
155
|
end
|
142
156
|
|
143
157
|
# Return a list of all the templates available to this user
|
158
|
+
# @param [String] label an optional label to filter the templates
|
144
159
|
# @return [Array] an array of structs with information about each template
|
145
160
|
# - [Hash] return[] the information on each template in the account
|
146
161
|
# - [String] slug the immutable unique code name of the template
|
147
162
|
# - [String] name the name of the template
|
163
|
+
# - [Array] labels the list of labels applied to the template
|
164
|
+
# - [String] labels[] a single label
|
148
165
|
# - [String] code the full HTML code of the template, with mc:edit attributes marking the editable elements - draft version
|
149
166
|
# - [String] subject the subject line of the template, if provided - draft version
|
150
167
|
# - [String] from_email the default sender address for the template, if provided - draft version
|
@@ -159,8 +176,8 @@ module Mandrill
|
|
159
176
|
# - [String] published_at the date and time the template was last published as a UTC string in YYYY-MM-DD HH:MM:SS format, or null if it has not been published
|
160
177
|
# - [String] created_at the date and time the template was first created as a UTC string in YYYY-MM-DD HH:MM:SS format
|
161
178
|
# - [String] updated_at the date and time the template was last modified as a UTC string in YYYY-MM-DD HH:MM:SS format
|
162
|
-
def list()
|
163
|
-
_params = {}
|
179
|
+
def list(label=nil)
|
180
|
+
_params = {:label => label}
|
164
181
|
return @master.call 'templates/list', _params
|
165
182
|
end
|
166
183
|
|
@@ -486,10 +503,44 @@ module Mandrill
|
|
486
503
|
return @master.call 'inbound/domains', _params
|
487
504
|
end
|
488
505
|
|
506
|
+
# Add an inbound domain to your account
|
507
|
+
# @param [String] domain a domain name
|
508
|
+
# @return [Hash] information about the domain
|
509
|
+
# - [String] domain the domain name that is accepting mail
|
510
|
+
# - [String] created_at the date and time that the inbound domain was added as a UTC string in YYYY-MM-DD HH:MM:SS format
|
511
|
+
# - [Boolean] valid_mx true if this inbound domain has successfully set up an MX record to deliver mail to the Mandrill servers
|
512
|
+
def add_domain(domain)
|
513
|
+
_params = {:domain => domain}
|
514
|
+
return @master.call 'inbound/add-domain', _params
|
515
|
+
end
|
516
|
+
|
517
|
+
# Check the MX settings for an inbound domain. The domain must have already been added with the add-domain call
|
518
|
+
# @param [String] domain an existing inbound domain
|
519
|
+
# @return [Hash] information about the inbound domain
|
520
|
+
# - [String] domain the domain name that is accepting mail
|
521
|
+
# - [String] created_at the date and time that the inbound domain was added as a UTC string in YYYY-MM-DD HH:MM:SS format
|
522
|
+
# - [Boolean] valid_mx true if this inbound domain has successfully set up an MX record to deliver mail to the Mandrill servers
|
523
|
+
def check_domain(domain)
|
524
|
+
_params = {:domain => domain}
|
525
|
+
return @master.call 'inbound/check-domain', _params
|
526
|
+
end
|
527
|
+
|
528
|
+
# Delete an inbound domain from the account. All mail will stop routing for this domain immediately.
|
529
|
+
# @param [String] domain an existing inbound domain
|
530
|
+
# @return [Hash] information about the deleted domain
|
531
|
+
# - [String] domain the domain name that is accepting mail
|
532
|
+
# - [String] created_at the date and time that the inbound domain was added as a UTC string in YYYY-MM-DD HH:MM:SS format
|
533
|
+
# - [Boolean] valid_mx true if this inbound domain has successfully set up an MX record to deliver mail to the Mandrill servers
|
534
|
+
def delete_domain(domain)
|
535
|
+
_params = {:domain => domain}
|
536
|
+
return @master.call 'inbound/delete-domain', _params
|
537
|
+
end
|
538
|
+
|
489
539
|
# List the mailbox routes defined for an inbound domain
|
490
540
|
# @param [String] domain the domain to check
|
491
541
|
# @return [Array] the routes associated with the domain
|
492
542
|
# - [Hash] return[] the individual mailbox route
|
543
|
+
# - [String] id the unique identifier of the route
|
493
544
|
# - [String] pattern the search pattern that the mailbox name should match
|
494
545
|
# - [String] url the webhook URL where inbound messages will be published
|
495
546
|
def routes(domain)
|
@@ -497,6 +548,43 @@ module Mandrill
|
|
497
548
|
return @master.call 'inbound/routes', _params
|
498
549
|
end
|
499
550
|
|
551
|
+
# Add a new mailbox route to an inbound domain
|
552
|
+
# @param [String] domain an existing inbound domain
|
553
|
+
# @param [String] pattern the search pattern that the mailbox name should match
|
554
|
+
# @param [String] url the webhook URL where the inbound messages will be published
|
555
|
+
# @return [Hash] the added mailbox route information
|
556
|
+
# - [String] id the unique identifier of the route
|
557
|
+
# - [String] pattern the search pattern that the mailbox name should match
|
558
|
+
# - [String] url the webhook URL where inbound messages will be published
|
559
|
+
def add_route(domain, pattern, url)
|
560
|
+
_params = {:domain => domain, :pattern => pattern, :url => url}
|
561
|
+
return @master.call 'inbound/add-route', _params
|
562
|
+
end
|
563
|
+
|
564
|
+
# Update the pattern or webhook of an existing inbound mailbox route. If null is provided for any fields, the values will remain unchanged.
|
565
|
+
# @param [String] id the unique identifier of an existing mailbox route
|
566
|
+
# @param [String] pattern the search pattern that the mailbox name should match
|
567
|
+
# @param [String] url the webhook URL where the inbound messages will be published
|
568
|
+
# @return [Hash] the updated mailbox route information
|
569
|
+
# - [String] id the unique identifier of the route
|
570
|
+
# - [String] pattern the search pattern that the mailbox name should match
|
571
|
+
# - [String] url the webhook URL where inbound messages will be published
|
572
|
+
def update_route(id, pattern=nil, url=nil)
|
573
|
+
_params = {:id => id, :pattern => pattern, :url => url}
|
574
|
+
return @master.call 'inbound/update-route', _params
|
575
|
+
end
|
576
|
+
|
577
|
+
# Delete an existing inbound mailbox route
|
578
|
+
# @param [String] id the unique identifier of an existing route
|
579
|
+
# @return [Hash] the deleted mailbox route information
|
580
|
+
# - [String] id the unique identifier of the route
|
581
|
+
# - [String] pattern the search pattern that the mailbox name should match
|
582
|
+
# - [String] url the webhook URL where inbound messages will be published
|
583
|
+
def delete_route(id)
|
584
|
+
_params = {:id => id}
|
585
|
+
return @master.call 'inbound/delete-route', _params
|
586
|
+
end
|
587
|
+
|
500
588
|
# Take a raw MIME document destined for a domain with inbound domains set up, and send it to the inbound hook exactly as if it had been sent over SMTP
|
501
589
|
# @param [String] raw_message the full MIME document of an email message
|
502
590
|
# @param [Array, nil] to optionally define the recipients to receive the message - otherwise we'll use the To, Cc, and Bcc headers provided in the document
|
@@ -1523,6 +1611,54 @@ module Mandrill
|
|
1523
1611
|
return @master.call 'urls/time-series', _params
|
1524
1612
|
end
|
1525
1613
|
|
1614
|
+
# Get the list of tracking domains set up for this account
|
1615
|
+
# @return [Array] the tracking domains and their status
|
1616
|
+
# - [Hash] return[] the individual tracking domain
|
1617
|
+
# - [String] domain the tracking domain name
|
1618
|
+
# - [String] created_at the date and time that the tracking domain was added as a UTC string in YYYY-MM-DD HH:MM:SS format
|
1619
|
+
# - [String] last_tested_at when the domain's DNS settings were last tested as a UTC string in YYYY-MM-DD HH:MM:SS format
|
1620
|
+
# - [Hash] cname details about the domain's CNAME record
|
1621
|
+
# - [Boolean] valid whether the domain's CNAME record is valid for use with Mandrill
|
1622
|
+
# - [String] valid_after when the domain's CNAME record will be considered valid for use with Mandrill as a UTC string in YYYY-MM-DD HH:MM:SS format. If set, this indicates that the record is valid now, but was previously invalid, and Mandrill will wait until the record's TTL elapses to start using it.
|
1623
|
+
# - [String] error an error describing the CNAME record, or null if the record is correct
|
1624
|
+
# - [Boolean] valid_tracking whether this domain can be used as a tracking domain for email.
|
1625
|
+
def tracking_domains()
|
1626
|
+
_params = {}
|
1627
|
+
return @master.call 'urls/tracking-domains', _params
|
1628
|
+
end
|
1629
|
+
|
1630
|
+
# Add a tracking domain to your account
|
1631
|
+
# @param [String] domain a domain name
|
1632
|
+
# @return [Hash] information about the domain
|
1633
|
+
# - [String] domain the tracking domain name
|
1634
|
+
# - [String] created_at the date and time that the tracking domain was added as a UTC string in YYYY-MM-DD HH:MM:SS format
|
1635
|
+
# - [String] last_tested_at when the domain's DNS settings were last tested as a UTC string in YYYY-MM-DD HH:MM:SS format
|
1636
|
+
# - [Hash] cname details about the domain's CNAME record
|
1637
|
+
# - [Boolean] valid whether the domain's CNAME record is valid for use with Mandrill
|
1638
|
+
# - [String] valid_after when the domain's CNAME record will be considered valid for use with Mandrill as a UTC string in YYYY-MM-DD HH:MM:SS format. If set, this indicates that the record is valid now, but was previously invalid, and Mandrill will wait until the record's TTL elapses to start using it.
|
1639
|
+
# - [String] error an error describing the CNAME record, or null if the record is correct
|
1640
|
+
# - [Boolean] valid_tracking whether this domain can be used as a tracking domain for email.
|
1641
|
+
def add_tracking_domain(domain)
|
1642
|
+
_params = {:domain => domain}
|
1643
|
+
return @master.call 'urls/add-tracking-domain', _params
|
1644
|
+
end
|
1645
|
+
|
1646
|
+
# Checks the CNAME settings for a tracking domain. The domain must have been added already with the add-tracking-domain call
|
1647
|
+
# @param [String] domain an existing tracking domain name
|
1648
|
+
# @return [Hash] information about the tracking domain
|
1649
|
+
# - [String] domain the tracking domain name
|
1650
|
+
# - [String] created_at the date and time that the tracking domain was added as a UTC string in YYYY-MM-DD HH:MM:SS format
|
1651
|
+
# - [String] last_tested_at when the domain's DNS settings were last tested as a UTC string in YYYY-MM-DD HH:MM:SS format
|
1652
|
+
# - [Hash] cname details about the domain's CNAME record
|
1653
|
+
# - [Boolean] valid whether the domain's CNAME record is valid for use with Mandrill
|
1654
|
+
# - [String] valid_after when the domain's CNAME record will be considered valid for use with Mandrill as a UTC string in YYYY-MM-DD HH:MM:SS format. If set, this indicates that the record is valid now, but was previously invalid, and Mandrill will wait until the record's TTL elapses to start using it.
|
1655
|
+
# - [String] error an error describing the CNAME record, or null if the record is correct
|
1656
|
+
# - [Boolean] valid_tracking whether this domain can be used as a tracking domain for email.
|
1657
|
+
def check_tracking_domain(domain)
|
1658
|
+
_params = {:domain => domain}
|
1659
|
+
return @master.call 'urls/check-tracking-domain', _params
|
1660
|
+
end
|
1661
|
+
|
1526
1662
|
end
|
1527
1663
|
class Webhooks
|
1528
1664
|
attr_accessor :master
|
data/lib/mandrill/errors.rb
CHANGED
@@ -23,12 +23,16 @@ module Mandrill
|
|
23
23
|
end
|
24
24
|
class UnknownUrlError < Error
|
25
25
|
end
|
26
|
+
class UnknownTrackingDomainError < Error
|
27
|
+
end
|
26
28
|
class InvalidTemplateError < Error
|
27
29
|
end
|
28
30
|
class UnknownWebhookError < Error
|
29
31
|
end
|
30
32
|
class UnknownInboundDomainError < Error
|
31
33
|
end
|
34
|
+
class UnknownInboundRouteError < Error
|
35
|
+
end
|
32
36
|
class UnknownExportError < Error
|
33
37
|
end
|
34
38
|
class IPProvisionLimitError < Error
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mandrill-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 119
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 48
|
10
|
+
version: 1.0.48
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Mandrill Devs
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2013-
|
18
|
+
date: 2013-10-11 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: json
|
@@ -104,9 +104,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
104
104
|
requirements: []
|
105
105
|
|
106
106
|
rubyforge_project:
|
107
|
-
rubygems_version: 1.8.
|
107
|
+
rubygems_version: 1.8.24
|
108
108
|
signing_key:
|
109
109
|
specification_version: 3
|
110
110
|
summary: A Ruby API library for the Mandrill email as a service platform.
|
111
111
|
test_files: []
|
112
112
|
|
113
|
+
has_rdoc:
|