You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lib/mandrill/api.rb
+142-6Lines changed: 142 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -16,9 +16,13 @@ def initialize(master)
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 @@ def initialize(master)
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
# @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 @@ def info(name)
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 @@ def info(name)
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
# - [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 @@ def publish(name)
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 @@ def delete(name)
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 @@ def delete(name)
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
-
deflist()
163
-
_params={}
179
+
deflist(label=nil)
180
+
_params={:label=>label}
164
181
return@master.call'templates/list',_params
165
182
end
166
183
@@ -486,17 +503,88 @@ def domains()
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
+
defadd_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
+
defcheck_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
+
defdelete_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
defroutes(domain)
496
547
_params={:domain=>domain}
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
# 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
+
defupdate_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
+
defdelete_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 @@ def time_series(url)
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
+
deftracking_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.
# 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.
0 commit comments