mandrill-rb 1.0.52 → 1.0.53
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +22 -0
- data/Gemfile +3 -0
- data/LICENSE +13 -0
- data/README.md +30 -0
- data/Rakefile +1 -0
- data/lib/mandrill/error.rb +62 -0
- data/lib/mandrill/exports.rb +89 -0
- data/lib/mandrill/inbound.rb +120 -0
- data/lib/mandrill/internal.rb +9 -0
- data/lib/mandrill/ips.rb +246 -0
- data/lib/mandrill/messages.rb +386 -0
- data/lib/mandrill/metadata.rb +55 -0
- data/lib/mandrill/rejects.rb +66 -0
- data/lib/mandrill/senders.rb +198 -0
- data/lib/mandrill/subaccounts.rb +157 -0
- data/lib/mandrill/tags.rb +162 -0
- data/lib/mandrill/templates.rb +219 -0
- data/lib/mandrill/urls.rb +96 -0
- data/lib/mandrill/users.rb +117 -0
- data/lib/mandrill/version.rb +3 -0
- data/lib/mandrill/webhooks.rb +112 -0
- data/lib/mandrill/whitelists.rb +43 -0
- data/mandrill-api.gemspec +22 -0
- metadata +25 -1
@@ -0,0 +1,198 @@
|
|
1
|
+
module Mandrill
|
2
|
+
class Senders
|
3
|
+
attr_accessor :master
|
4
|
+
|
5
|
+
def initialize(master)
|
6
|
+
@master = master
|
7
|
+
end
|
8
|
+
|
9
|
+
# Return the senders that have tried to use this account.
|
10
|
+
# @return [Array] an array of sender data, one for each sending addresses used by the account
|
11
|
+
# - [Hash] return[] the information on each sending address in the account
|
12
|
+
# - [String] address the sender's email address
|
13
|
+
# - [String] created_at the date and time that the sender was first seen by Mandrill as a UTC date string in YYYY-MM-DD HH:MM:SS format
|
14
|
+
# - [Integer] sent the total number of messages sent by this sender
|
15
|
+
# - [Integer] hard_bounces the total number of hard bounces by messages by this sender
|
16
|
+
# - [Integer] soft_bounces the total number of soft bounces by messages by this sender
|
17
|
+
# - [Integer] rejects the total number of rejected messages by this sender
|
18
|
+
# - [Integer] complaints the total number of spam complaints received for messages by this sender
|
19
|
+
# - [Integer] unsubs the total number of unsubscribe requests received for messages by this sender
|
20
|
+
# - [Integer] opens the total number of times messages by this sender have been opened
|
21
|
+
# - [Integer] clicks the total number of times tracked URLs in messages by this sender have been clicked
|
22
|
+
# - [Integer] unique_opens the number of unique opens for emails sent for this sender
|
23
|
+
# - [Integer] unique_clicks the number of unique clicks for emails sent for this sender
|
24
|
+
def list()
|
25
|
+
_params = {}
|
26
|
+
return @master.call 'senders/list', _params
|
27
|
+
end
|
28
|
+
|
29
|
+
# Returns the sender domains that have been added to this account.
|
30
|
+
# @return [Array] an array of sender domain data, one for each sending domain used by the account
|
31
|
+
# - [Hash] return[] the information on each sending domain for the account
|
32
|
+
# - [String] domain the sender domain name
|
33
|
+
# - [String] created_at the date and time that the sending domain was first seen as a UTC string in YYYY-MM-DD HH:MM:SS format
|
34
|
+
# - [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
|
35
|
+
# - [Hash] spf details about the domain's SPF record
|
36
|
+
# - [Boolean] valid whether the domain's SPF record is valid for use with Mandrill
|
37
|
+
# - [String] valid_after when the domain's SPF 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.
|
38
|
+
# - [String] error an error describing the spf record, or null if the record is correct
|
39
|
+
# - [Hash] dkim details about the domain's DKIM record
|
40
|
+
# - [Boolean] valid whether the domain's DKIM record is valid for use with Mandrill
|
41
|
+
# - [String] valid_after when the domain's DKIM 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.
|
42
|
+
# - [String] error an error describing the DKIM record, or null if the record is correct
|
43
|
+
# - [String] verified_at if the domain has been verified, this indicates when that verification occurred as a UTC string in YYYY-MM-DD HH:MM:SS format
|
44
|
+
# - [Boolean] valid_signing whether this domain can be used to authenticate mail, either for itself or as a custom signing domain. If this is false but spf and dkim are both valid, you will need to verify the domain before using it to authenticate mail
|
45
|
+
def domains()
|
46
|
+
_params = {}
|
47
|
+
return @master.call 'senders/domains', _params
|
48
|
+
end
|
49
|
+
|
50
|
+
# Adds a sender domain to your account. Sender domains are added automatically as you send, but you can use this call to add them ahead of time.
|
51
|
+
# @param [String] domain a domain name
|
52
|
+
# @return [Hash] information about the domain
|
53
|
+
# - [String] domain the sender domain name
|
54
|
+
# - [String] created_at the date and time that the sending domain was first seen as a UTC string in YYYY-MM-DD HH:MM:SS format
|
55
|
+
# - [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
|
56
|
+
# - [Hash] spf details about the domain's SPF record
|
57
|
+
# - [Boolean] valid whether the domain's SPF record is valid for use with Mandrill
|
58
|
+
# - [String] valid_after when the domain's SPF 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.
|
59
|
+
# - [String] error an error describing the spf record, or null if the record is correct
|
60
|
+
# - [Hash] dkim details about the domain's DKIM record
|
61
|
+
# - [Boolean] valid whether the domain's DKIM record is valid for use with Mandrill
|
62
|
+
# - [String] valid_after when the domain's DKIM 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.
|
63
|
+
# - [String] error an error describing the DKIM record, or null if the record is correct
|
64
|
+
# - [String] verified_at if the domain has been verified, this indicates when that verification occurred as a UTC string in YYYY-MM-DD HH:MM:SS format
|
65
|
+
# - [Boolean] valid_signing whether this domain can be used to authenticate mail, either for itself or as a custom signing domain. If this is false but spf and dkim are both valid, you will need to verify the domain before using it to authenticate mail
|
66
|
+
def add_domain(domain)
|
67
|
+
_params = {:domain => domain}
|
68
|
+
return @master.call 'senders/add-domain', _params
|
69
|
+
end
|
70
|
+
|
71
|
+
# Checks the SPF and DKIM settings for a domain. If you haven't already added this domain to your account, it will be added automatically.
|
72
|
+
# @param [String] domain a domain name
|
73
|
+
# @return [Hash] information about the sender domain
|
74
|
+
# - [String] domain the sender domain name
|
75
|
+
# - [String] created_at the date and time that the sending domain was first seen as a UTC string in YYYY-MM-DD HH:MM:SS format
|
76
|
+
# - [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
|
77
|
+
# - [Hash] spf details about the domain's SPF record
|
78
|
+
# - [Boolean] valid whether the domain's SPF record is valid for use with Mandrill
|
79
|
+
# - [String] valid_after when the domain's SPF 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.
|
80
|
+
# - [String] error an error describing the spf record, or null if the record is correct
|
81
|
+
# - [Hash] dkim details about the domain's DKIM record
|
82
|
+
# - [Boolean] valid whether the domain's DKIM record is valid for use with Mandrill
|
83
|
+
# - [String] valid_after when the domain's DKIM 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.
|
84
|
+
# - [String] error an error describing the DKIM record, or null if the record is correct
|
85
|
+
# - [String] verified_at if the domain has been verified, this indicates when that verification occurred as a UTC string in YYYY-MM-DD HH:MM:SS format
|
86
|
+
# - [Boolean] valid_signing whether this domain can be used to authenticate mail, either for itself or as a custom signing domain. If this is false but spf and dkim are both valid, you will need to verify the domain before using it to authenticate mail
|
87
|
+
def check_domain(domain)
|
88
|
+
_params = {:domain => domain}
|
89
|
+
return @master.call 'senders/check-domain', _params
|
90
|
+
end
|
91
|
+
|
92
|
+
# Sends a verification email in order to verify ownership of a domain. Domain verification is an optional step to confirm ownership of a domain. Once a domain has been verified in a Mandrill account, other accounts may not have their messages signed by that domain unless they also verify the domain. This prevents other Mandrill accounts from sending mail signed by your domain.
|
93
|
+
# @param [String] domain a domain name at which you can receive email
|
94
|
+
# @param [String] mailbox a mailbox at the domain where the verification email should be sent
|
95
|
+
# @return [Hash] information about the verification that was sent
|
96
|
+
# - [String] status "sent" indicates that the verification has been sent, "already_verified" indicates that the domain has already been verified with your account
|
97
|
+
# - [String] domain the domain name you provided
|
98
|
+
# - [String] email the email address the verification email was sent to
|
99
|
+
def verify_domain(domain, mailbox)
|
100
|
+
_params = {:domain => domain, :mailbox => mailbox}
|
101
|
+
return @master.call 'senders/verify-domain', _params
|
102
|
+
end
|
103
|
+
|
104
|
+
# Return more detailed information about a single sender, including aggregates of recent stats
|
105
|
+
# @param [String] address the email address of the sender
|
106
|
+
# @return [Hash] the detailed information on the sender
|
107
|
+
# - [String] address the sender's email address
|
108
|
+
# - [String] created_at the date and time that the sender was first seen by Mandrill as a UTC date string in YYYY-MM-DD HH:MM:SS format
|
109
|
+
# - [Integer] sent the total number of messages sent by this sender
|
110
|
+
# - [Integer] hard_bounces the total number of hard bounces by messages by this sender
|
111
|
+
# - [Integer] soft_bounces the total number of soft bounces by messages by this sender
|
112
|
+
# - [Integer] rejects the total number of rejected messages by this sender
|
113
|
+
# - [Integer] complaints the total number of spam complaints received for messages by this sender
|
114
|
+
# - [Integer] unsubs the total number of unsubscribe requests received for messages by this sender
|
115
|
+
# - [Integer] opens the total number of times messages by this sender have been opened
|
116
|
+
# - [Integer] clicks the total number of times tracked URLs in messages by this sender have been clicked
|
117
|
+
# - [Hash] stats an aggregate summary of the sender's sending stats
|
118
|
+
# - [Hash] today stats for this sender so far today
|
119
|
+
# - [Integer] sent the number of emails sent for this sender so far today
|
120
|
+
# - [Integer] hard_bounces the number of emails hard bounced for this sender so far today
|
121
|
+
# - [Integer] soft_bounces the number of emails soft bounced for this sender so far today
|
122
|
+
# - [Integer] rejects the number of emails rejected for sending this sender so far today
|
123
|
+
# - [Integer] complaints the number of spam complaints for this sender so far today
|
124
|
+
# - [Integer] unsubs the number of unsubscribes for this sender so far today
|
125
|
+
# - [Integer] opens the number of times emails have been opened for this sender so far today
|
126
|
+
# - [Integer] unique_opens the number of unique opens for emails sent for this sender so far today
|
127
|
+
# - [Integer] clicks the number of URLs that have been clicked for this sender so far today
|
128
|
+
# - [Integer] unique_clicks the number of unique clicks for emails sent for this sender so far today
|
129
|
+
# - [Hash] last_7_days stats for this sender in the last 7 days
|
130
|
+
# - [Integer] sent the number of emails sent for this sender in the last 7 days
|
131
|
+
# - [Integer] hard_bounces the number of emails hard bounced for this sender in the last 7 days
|
132
|
+
# - [Integer] soft_bounces the number of emails soft bounced for this sender in the last 7 days
|
133
|
+
# - [Integer] rejects the number of emails rejected for sending this sender in the last 7 days
|
134
|
+
# - [Integer] complaints the number of spam complaints for this sender in the last 7 days
|
135
|
+
# - [Integer] unsubs the number of unsubscribes for this sender in the last 7 days
|
136
|
+
# - [Integer] opens the number of times emails have been opened for this sender in the last 7 days
|
137
|
+
# - [Integer] unique_opens the number of unique opens for emails sent for this sender in the last 7 days
|
138
|
+
# - [Integer] clicks the number of URLs that have been clicked for this sender in the last 7 days
|
139
|
+
# - [Integer] unique_clicks the number of unique clicks for emails sent for this sender in the last 7 days
|
140
|
+
# - [Hash] last_30_days stats for this sender in the last 30 days
|
141
|
+
# - [Integer] sent the number of emails sent for this sender in the last 30 days
|
142
|
+
# - [Integer] hard_bounces the number of emails hard bounced for this sender in the last 30 days
|
143
|
+
# - [Integer] soft_bounces the number of emails soft bounced for this sender in the last 30 days
|
144
|
+
# - [Integer] rejects the number of emails rejected for sending this sender in the last 30 days
|
145
|
+
# - [Integer] complaints the number of spam complaints for this sender in the last 30 days
|
146
|
+
# - [Integer] unsubs the number of unsubscribes for this sender in the last 30 days
|
147
|
+
# - [Integer] opens the number of times emails have been opened for this sender in the last 30 days
|
148
|
+
# - [Integer] unique_opens the number of unique opens for emails sent for this sender in the last 30 days
|
149
|
+
# - [Integer] clicks the number of URLs that have been clicked for this sender in the last 30 days
|
150
|
+
# - [Integer] unique_clicks the number of unique clicks for emails sent for this sender in the last 30 days
|
151
|
+
# - [Hash] last_60_days stats for this sender in the last 60 days
|
152
|
+
# - [Integer] sent the number of emails sent for this sender in the last 60 days
|
153
|
+
# - [Integer] hard_bounces the number of emails hard bounced for this sender in the last 60 days
|
154
|
+
# - [Integer] soft_bounces the number of emails soft bounced for this sender in the last 60 days
|
155
|
+
# - [Integer] rejects the number of emails rejected for sending this sender in the last 60 days
|
156
|
+
# - [Integer] complaints the number of spam complaints for this sender in the last 60 days
|
157
|
+
# - [Integer] unsubs the number of unsubscribes for this sender in the last 60 days
|
158
|
+
# - [Integer] opens the number of times emails have been opened for this sender in the last 60 days
|
159
|
+
# - [Integer] unique_opens the number of unique opens for emails sent for this sender in the last 60 days
|
160
|
+
# - [Integer] clicks the number of URLs that have been clicked for this sender in the last 60 days
|
161
|
+
# - [Integer] unique_clicks the number of unique clicks for emails sent for this sender in the last 60 days
|
162
|
+
# - [Hash] last_90_days stats for this sender in the last 90 days
|
163
|
+
# - [Integer] sent the number of emails sent for this sender in the last 90 days
|
164
|
+
# - [Integer] hard_bounces the number of emails hard bounced for this sender in the last 90 days
|
165
|
+
# - [Integer] soft_bounces the number of emails soft bounced for this sender in the last 90 days
|
166
|
+
# - [Integer] rejects the number of emails rejected for sending this sender in the last 90 days
|
167
|
+
# - [Integer] complaints the number of spam complaints for this sender in the last 90 days
|
168
|
+
# - [Integer] unsubs the number of unsubscribes for this sender in the last 90 days
|
169
|
+
# - [Integer] opens the number of times emails have been opened for this sender in the last 90 days
|
170
|
+
# - [Integer] unique_opens the number of unique opens for emails sent for this sender in the last 90 days
|
171
|
+
# - [Integer] clicks the number of URLs that have been clicked for this sender in the last 90 days
|
172
|
+
# - [Integer] unique_clicks the number of unique clicks for emails sent for this sender in the last 90 days
|
173
|
+
def info(address)
|
174
|
+
_params = {:address => address}
|
175
|
+
return @master.call 'senders/info', _params
|
176
|
+
end
|
177
|
+
|
178
|
+
# Return the recent history (hourly stats for the last 30 days) for a sender
|
179
|
+
# @param [String] address the email address of the sender
|
180
|
+
# @return [Array] the array of history information
|
181
|
+
# - [Hash] return[] the stats for a single hour
|
182
|
+
# - [String] time the hour as a UTC date string in YYYY-MM-DD HH:MM:SS format
|
183
|
+
# - [Integer] sent the number of emails that were sent during the hour
|
184
|
+
# - [Integer] hard_bounces the number of emails that hard bounced during the hour
|
185
|
+
# - [Integer] soft_bounces the number of emails that soft bounced during the hour
|
186
|
+
# - [Integer] rejects the number of emails that were rejected during the hour
|
187
|
+
# - [Integer] complaints the number of spam complaints received during the hour
|
188
|
+
# - [Integer] opens the number of emails opened during the hour
|
189
|
+
# - [Integer] unique_opens the number of unique opens generated by messages sent during the hour
|
190
|
+
# - [Integer] clicks the number of tracked URLs clicked during the hour
|
191
|
+
# - [Integer] unique_clicks the number of unique clicks generated by messages sent during the hour
|
192
|
+
def time_series(address)
|
193
|
+
_params = {:address => address}
|
194
|
+
return @master.call 'senders/time-series', _params
|
195
|
+
end
|
196
|
+
|
197
|
+
end
|
198
|
+
end
|
@@ -0,0 +1,157 @@
|
|
1
|
+
module Mandrill
|
2
|
+
class Subaccounts
|
3
|
+
attr_accessor :master
|
4
|
+
|
5
|
+
def initialize(master)
|
6
|
+
@master = master
|
7
|
+
end
|
8
|
+
|
9
|
+
# Get the list of subaccounts defined for the account, optionally filtered by a prefix
|
10
|
+
# @param [String] q an optional prefix to filter the subaccounts' ids and names
|
11
|
+
# @return [Array] the subaccounts for the account, up to a maximum of 1,000
|
12
|
+
# - [Hash] return[] the individual subaccount info
|
13
|
+
# - [String] id a unique indentifier for the subaccount
|
14
|
+
# - [String] name an optional display name for the subaccount
|
15
|
+
# - [Integer] custom_quota an optional manual hourly quota for the subaccount. If not specified, the hourly quota will be managed based on reputation
|
16
|
+
# - [String] status the current sending status of the subaccount, one of "active" or "paused"
|
17
|
+
# - [Integer] reputation the subaccount's current reputation on a scale from 0 to 100
|
18
|
+
# - [String] created_at the date and time that the subaccount was created as a UTC string in YYYY-MM-DD HH:MM:SS format
|
19
|
+
# - [String] first_sent_at the date and time that the subaccount first sent as a UTC string in YYYY-MM-DD HH:MM:SS format
|
20
|
+
# - [Integer] sent_weekly the number of emails the subaccount has sent so far this week (weeks start on midnight Monday, UTC)
|
21
|
+
# - [Integer] sent_monthly the number of emails the subaccount has sent so far this month (months start on midnight of the 1st, UTC)
|
22
|
+
# - [Integer] sent_total the number of emails the subaccount has sent since it was created
|
23
|
+
def list(q=nil)
|
24
|
+
_params = {:q => q}
|
25
|
+
return @master.call 'subaccounts/list', _params
|
26
|
+
end
|
27
|
+
|
28
|
+
# Add a new subaccount
|
29
|
+
# @param [String] id a unique identifier for the subaccount to be used in sending calls
|
30
|
+
# @param [String] name an optional display name to further identify the subaccount
|
31
|
+
# @param [String] notes optional extra text to associate with the subaccount
|
32
|
+
# @param [Integer] custom_quota an optional manual hourly quota for the subaccount. If not specified, Mandrill will manage this based on reputation
|
33
|
+
# @return [Hash] the information saved about the new subaccount
|
34
|
+
# - [String] id a unique indentifier for the subaccount
|
35
|
+
# - [String] name an optional display name for the subaccount
|
36
|
+
# - [Integer] custom_quota an optional manual hourly quota for the subaccount. If not specified, the hourly quota will be managed based on reputation
|
37
|
+
# - [String] status the current sending status of the subaccount, one of "active" or "paused"
|
38
|
+
# - [Integer] reputation the subaccount's current reputation on a scale from 0 to 100
|
39
|
+
# - [String] created_at the date and time that the subaccount was created as a UTC string in YYYY-MM-DD HH:MM:SS format
|
40
|
+
# - [String] first_sent_at the date and time that the subaccount first sent as a UTC string in YYYY-MM-DD HH:MM:SS format
|
41
|
+
# - [Integer] sent_weekly the number of emails the subaccount has sent so far this week (weeks start on midnight Monday, UTC)
|
42
|
+
# - [Integer] sent_monthly the number of emails the subaccount has sent so far this month (months start on midnight of the 1st, UTC)
|
43
|
+
# - [Integer] sent_total the number of emails the subaccount has sent since it was created
|
44
|
+
def add(id, name=nil, notes=nil, custom_quota=nil)
|
45
|
+
_params = {:id => id, :name => name, :notes => notes, :custom_quota => custom_quota}
|
46
|
+
return @master.call 'subaccounts/add', _params
|
47
|
+
end
|
48
|
+
|
49
|
+
# Given the ID of an existing subaccount, return the data about it
|
50
|
+
# @param [String] id the unique identifier of the subaccount to query
|
51
|
+
# @return [Hash] the information about the subaccount
|
52
|
+
# - [String] id a unique indentifier for the subaccount
|
53
|
+
# - [String] name an optional display name for the subaccount
|
54
|
+
# - [String] notes optional extra text to associate with the subaccount
|
55
|
+
# - [Integer] custom_quota an optional manual hourly quota for the subaccount. If not specified, the hourly quota will be managed based on reputation
|
56
|
+
# - [String] status the current sending status of the subaccount, one of "active" or "paused"
|
57
|
+
# - [Integer] reputation the subaccount's current reputation on a scale from 0 to 100
|
58
|
+
# - [String] created_at the date and time that the subaccount was created as a UTC string in YYYY-MM-DD HH:MM:SS format
|
59
|
+
# - [String] first_sent_at the date and time that the subaccount first sent as a UTC string in YYYY-MM-DD HH:MM:SS format
|
60
|
+
# - [Integer] sent_weekly the number of emails the subaccount has sent so far this week (weeks start on midnight Monday, UTC)
|
61
|
+
# - [Integer] sent_monthly the number of emails the subaccount has sent so far this month (months start on midnight of the 1st, UTC)
|
62
|
+
# - [Integer] sent_total the number of emails the subaccount has sent since it was created
|
63
|
+
# - [Integer] sent_hourly the number of emails the subaccount has sent in the last hour
|
64
|
+
# - [Integer] hourly_quota the current hourly quota for the subaccount, either manual or reputation-based
|
65
|
+
# - [Hash] last_30_days stats for this subaccount in the last 30 days
|
66
|
+
# - [Integer] sent the number of emails sent for this subaccount in the last 30 days
|
67
|
+
# - [Integer] hard_bounces the number of emails hard bounced for this subaccount in the last 30 days
|
68
|
+
# - [Integer] soft_bounces the number of emails soft bounced for this subaccount in the last 30 days
|
69
|
+
# - [Integer] rejects the number of emails rejected for sending this subaccount in the last 30 days
|
70
|
+
# - [Integer] complaints the number of spam complaints for this subaccount in the last 30 days
|
71
|
+
# - [Integer] unsubs the number of unsbuscribes for this subaccount in the last 30 days
|
72
|
+
# - [Integer] opens the number of times emails have been opened for this subaccount in the last 30 days
|
73
|
+
# - [Integer] unique_opens the number of unique opens for emails sent for this subaccount in the last 30 days
|
74
|
+
# - [Integer] clicks the number of URLs that have been clicked for this subaccount in the last 30 days
|
75
|
+
# - [Integer] unique_clicks the number of unique clicks for emails sent for this subaccount in the last 30 days
|
76
|
+
def info(id)
|
77
|
+
_params = {:id => id}
|
78
|
+
return @master.call 'subaccounts/info', _params
|
79
|
+
end
|
80
|
+
|
81
|
+
# Update an existing subaccount
|
82
|
+
# @param [String] id the unique identifier of the subaccount to update
|
83
|
+
# @param [String] name an optional display name to further identify the subaccount
|
84
|
+
# @param [String] notes optional extra text to associate with the subaccount
|
85
|
+
# @param [Integer] custom_quota an optional manual hourly quota for the subaccount. If not specified, Mandrill will manage this based on reputation
|
86
|
+
# @return [Hash] the information for the updated subaccount
|
87
|
+
# - [String] id a unique indentifier for the subaccount
|
88
|
+
# - [String] name an optional display name for the subaccount
|
89
|
+
# - [Integer] custom_quota an optional manual hourly quota for the subaccount. If not specified, the hourly quota will be managed based on reputation
|
90
|
+
# - [String] status the current sending status of the subaccount, one of "active" or "paused"
|
91
|
+
# - [Integer] reputation the subaccount's current reputation on a scale from 0 to 100
|
92
|
+
# - [String] created_at the date and time that the subaccount was created as a UTC string in YYYY-MM-DD HH:MM:SS format
|
93
|
+
# - [String] first_sent_at the date and time that the subaccount first sent as a UTC string in YYYY-MM-DD HH:MM:SS format
|
94
|
+
# - [Integer] sent_weekly the number of emails the subaccount has sent so far this week (weeks start on midnight Monday, UTC)
|
95
|
+
# - [Integer] sent_monthly the number of emails the subaccount has sent so far this month (months start on midnight of the 1st, UTC)
|
96
|
+
# - [Integer] sent_total the number of emails the subaccount has sent since it was created
|
97
|
+
def update(id, name=nil, notes=nil, custom_quota=nil)
|
98
|
+
_params = {:id => id, :name => name, :notes => notes, :custom_quota => custom_quota}
|
99
|
+
return @master.call 'subaccounts/update', _params
|
100
|
+
end
|
101
|
+
|
102
|
+
# Delete an existing subaccount. Any email related to the subaccount will be saved, but stats will be removed and any future sending calls to this subaccount will fail.
|
103
|
+
# @param [String] id the unique identifier of the subaccount to delete
|
104
|
+
# @return [Hash] the information for the deleted subaccount
|
105
|
+
# - [String] id a unique indentifier for the subaccount
|
106
|
+
# - [String] name an optional display name for the subaccount
|
107
|
+
# - [Integer] custom_quota an optional manual hourly quota for the subaccount. If not specified, the hourly quota will be managed based on reputation
|
108
|
+
# - [String] status the current sending status of the subaccount, one of "active" or "paused"
|
109
|
+
# - [Integer] reputation the subaccount's current reputation on a scale from 0 to 100
|
110
|
+
# - [String] created_at the date and time that the subaccount was created as a UTC string in YYYY-MM-DD HH:MM:SS format
|
111
|
+
# - [String] first_sent_at the date and time that the subaccount first sent as a UTC string in YYYY-MM-DD HH:MM:SS format
|
112
|
+
# - [Integer] sent_weekly the number of emails the subaccount has sent so far this week (weeks start on midnight Monday, UTC)
|
113
|
+
# - [Integer] sent_monthly the number of emails the subaccount has sent so far this month (months start on midnight of the 1st, UTC)
|
114
|
+
# - [Integer] sent_total the number of emails the subaccount has sent since it was created
|
115
|
+
def delete(id)
|
116
|
+
_params = {:id => id}
|
117
|
+
return @master.call 'subaccounts/delete', _params
|
118
|
+
end
|
119
|
+
|
120
|
+
# Pause a subaccount's sending. Any future emails delivered to this subaccount will be queued for a maximum of 3 days until the subaccount is resumed.
|
121
|
+
# @param [String] id the unique identifier of the subaccount to pause
|
122
|
+
# @return [Hash] the information for the paused subaccount
|
123
|
+
# - [String] id a unique indentifier for the subaccount
|
124
|
+
# - [String] name an optional display name for the subaccount
|
125
|
+
# - [Integer] custom_quota an optional manual hourly quota for the subaccount. If not specified, the hourly quota will be managed based on reputation
|
126
|
+
# - [String] status the current sending status of the subaccount, one of "active" or "paused"
|
127
|
+
# - [Integer] reputation the subaccount's current reputation on a scale from 0 to 100
|
128
|
+
# - [String] created_at the date and time that the subaccount was created as a UTC string in YYYY-MM-DD HH:MM:SS format
|
129
|
+
# - [String] first_sent_at the date and time that the subaccount first sent as a UTC string in YYYY-MM-DD HH:MM:SS format
|
130
|
+
# - [Integer] sent_weekly the number of emails the subaccount has sent so far this week (weeks start on midnight Monday, UTC)
|
131
|
+
# - [Integer] sent_monthly the number of emails the subaccount has sent so far this month (months start on midnight of the 1st, UTC)
|
132
|
+
# - [Integer] sent_total the number of emails the subaccount has sent since it was created
|
133
|
+
def pause(id)
|
134
|
+
_params = {:id => id}
|
135
|
+
return @master.call 'subaccounts/pause', _params
|
136
|
+
end
|
137
|
+
|
138
|
+
# Resume a paused subaccount's sending
|
139
|
+
# @param [String] id the unique identifier of the subaccount to resume
|
140
|
+
# @return [Hash] the information for the resumed subaccount
|
141
|
+
# - [String] id a unique indentifier for the subaccount
|
142
|
+
# - [String] name an optional display name for the subaccount
|
143
|
+
# - [Integer] custom_quota an optional manual hourly quota for the subaccount. If not specified, the hourly quota will be managed based on reputation
|
144
|
+
# - [String] status the current sending status of the subaccount, one of "active" or "paused"
|
145
|
+
# - [Integer] reputation the subaccount's current reputation on a scale from 0 to 100
|
146
|
+
# - [String] created_at the date and time that the subaccount was created as a UTC string in YYYY-MM-DD HH:MM:SS format
|
147
|
+
# - [String] first_sent_at the date and time that the subaccount first sent as a UTC string in YYYY-MM-DD HH:MM:SS format
|
148
|
+
# - [Integer] sent_weekly the number of emails the subaccount has sent so far this week (weeks start on midnight Monday, UTC)
|
149
|
+
# - [Integer] sent_monthly the number of emails the subaccount has sent so far this month (months start on midnight of the 1st, UTC)
|
150
|
+
# - [Integer] sent_total the number of emails the subaccount has sent since it was created
|
151
|
+
def resume(id)
|
152
|
+
_params = {:id => id}
|
153
|
+
return @master.call 'subaccounts/resume', _params
|
154
|
+
end
|
155
|
+
|
156
|
+
end
|
157
|
+
end
|
@@ -0,0 +1,162 @@
|
|
1
|
+
module Mandrill
|
2
|
+
class Tags
|
3
|
+
attr_accessor :master
|
4
|
+
|
5
|
+
def initialize(master)
|
6
|
+
@master = master
|
7
|
+
end
|
8
|
+
|
9
|
+
# Return all of the user-defined tag information
|
10
|
+
# @return [Array] a list of user-defined tags
|
11
|
+
# - [Hash] return[] a user-defined tag
|
12
|
+
# - [String] tag the actual tag as a string
|
13
|
+
# - [Integer] reputation the tag's current reputation on a scale from 0 to 100.
|
14
|
+
# - [Integer] sent the total number of messages sent with this tag
|
15
|
+
# - [Integer] hard_bounces the total number of hard bounces by messages with this tag
|
16
|
+
# - [Integer] soft_bounces the total number of soft bounces by messages with this tag
|
17
|
+
# - [Integer] rejects the total number of rejected messages with this tag
|
18
|
+
# - [Integer] complaints the total number of spam complaints received for messages with this tag
|
19
|
+
# - [Integer] unsubs the total number of unsubscribe requests received for messages with this tag
|
20
|
+
# - [Integer] opens the total number of times messages with this tag have been opened
|
21
|
+
# - [Integer] clicks the total number of times tracked URLs in messages with this tag have been clicked
|
22
|
+
# - [Integer] unique_opens the number of unique opens for emails sent with this tag
|
23
|
+
# - [Integer] unique_clicks the number of unique clicks for emails sent with this tag
|
24
|
+
def list()
|
25
|
+
_params = {}
|
26
|
+
return @master.call 'tags/list', _params
|
27
|
+
end
|
28
|
+
|
29
|
+
# Deletes a tag permanently. Deleting a tag removes the tag from any messages that have been sent, and also deletes the tag's stats. There is no way to undo this operation, so use it carefully.
|
30
|
+
# @param [String] tag a tag name
|
31
|
+
# @return [Hash] the tag that was deleted
|
32
|
+
# - [String] tag the actual tag as a string
|
33
|
+
# - [Integer] reputation the tag's current reputation on a scale from 0 to 100.
|
34
|
+
# - [Integer] sent the total number of messages sent with this tag
|
35
|
+
# - [Integer] hard_bounces the total number of hard bounces by messages with this tag
|
36
|
+
# - [Integer] soft_bounces the total number of soft bounces by messages with this tag
|
37
|
+
# - [Integer] rejects the total number of rejected messages with this tag
|
38
|
+
# - [Integer] complaints the total number of spam complaints received for messages with this tag
|
39
|
+
# - [Integer] unsubs the total number of unsubscribe requests received for messages with this tag
|
40
|
+
# - [Integer] opens the total number of times messages with this tag have been opened
|
41
|
+
# - [Integer] clicks the total number of times tracked URLs in messages with this tag have been clicked
|
42
|
+
# - [Integer] unique_opens the number of unique opens for emails sent with this tag
|
43
|
+
# - [Integer] unique_clicks the number of unique clicks for emails sent with this tag
|
44
|
+
def delete(tag)
|
45
|
+
_params = {:tag => tag}
|
46
|
+
return @master.call 'tags/delete', _params
|
47
|
+
end
|
48
|
+
|
49
|
+
# Return more detailed information about a single tag, including aggregates of recent stats
|
50
|
+
# @param [String] tag an existing tag name
|
51
|
+
# @return [Hash] the detailed information on the tag
|
52
|
+
# - [String] tag the actual tag as a string
|
53
|
+
# - [Integer] sent the total number of messages sent with this tag
|
54
|
+
# - [Integer] hard_bounces the total number of hard bounces by messages with this tag
|
55
|
+
# - [Integer] soft_bounces the total number of soft bounces by messages with this tag
|
56
|
+
# - [Integer] rejects the total number of rejected messages with this tag
|
57
|
+
# - [Integer] complaints the total number of spam complaints received for messages with this tag
|
58
|
+
# - [Integer] unsubs the total number of unsubscribe requests received for messages with this tag
|
59
|
+
# - [Integer] opens the total number of times messages with this tag have been opened
|
60
|
+
# - [Integer] clicks the total number of times tracked URLs in messages with this tag have been clicked
|
61
|
+
# - [Hash] stats an aggregate summary of the tag's sending stats
|
62
|
+
# - [Hash] today stats with this tag so far today
|
63
|
+
# - [Integer] sent the number of emails sent with this tag so far today
|
64
|
+
# - [Integer] hard_bounces the number of emails hard bounced with this tag so far today
|
65
|
+
# - [Integer] soft_bounces the number of emails soft bounced with this tag so far today
|
66
|
+
# - [Integer] rejects the number of emails rejected for sending this tag so far today
|
67
|
+
# - [Integer] complaints the number of spam complaints with this tag so far today
|
68
|
+
# - [Integer] unsubs the number of unsubscribes with this tag so far today
|
69
|
+
# - [Integer] opens the number of times emails have been opened with this tag so far today
|
70
|
+
# - [Integer] unique_opens the number of unique opens for emails sent with this tag so far today
|
71
|
+
# - [Integer] clicks the number of URLs that have been clicked with this tag so far today
|
72
|
+
# - [Integer] unique_clicks the number of unique clicks for emails sent with this tag so far today
|
73
|
+
# - [Hash] last_7_days stats with this tag in the last 7 days
|
74
|
+
# - [Integer] sent the number of emails sent with this tag in the last 7 days
|
75
|
+
# - [Integer] hard_bounces the number of emails hard bounced with this tag in the last 7 days
|
76
|
+
# - [Integer] soft_bounces the number of emails soft bounced with this tag in the last 7 days
|
77
|
+
# - [Integer] rejects the number of emails rejected for sending this tag in the last 7 days
|
78
|
+
# - [Integer] complaints the number of spam complaints with this tag in the last 7 days
|
79
|
+
# - [Integer] unsubs the number of unsubscribes with this tag in the last 7 days
|
80
|
+
# - [Integer] opens the number of times emails have been opened with this tag in the last 7 days
|
81
|
+
# - [Integer] unique_opens the number of unique opens for emails sent with this tag in the last 7 days
|
82
|
+
# - [Integer] clicks the number of URLs that have been clicked with this tag in the last 7 days
|
83
|
+
# - [Integer] unique_clicks the number of unique clicks for emails sent with this tag in the last 7 days
|
84
|
+
# - [Hash] last_30_days stats with this tag in the last 30 days
|
85
|
+
# - [Integer] sent the number of emails sent with this tag in the last 30 days
|
86
|
+
# - [Integer] hard_bounces the number of emails hard bounced with this tag in the last 30 days
|
87
|
+
# - [Integer] soft_bounces the number of emails soft bounced with this tag in the last 30 days
|
88
|
+
# - [Integer] rejects the number of emails rejected for sending this tag in the last 30 days
|
89
|
+
# - [Integer] complaints the number of spam complaints with this tag in the last 30 days
|
90
|
+
# - [Integer] unsubs the number of unsubscribes with this tag in the last 30 days
|
91
|
+
# - [Integer] opens the number of times emails have been opened with this tag in the last 30 days
|
92
|
+
# - [Integer] unique_opens the number of unique opens for emails sent with this tag in the last 30 days
|
93
|
+
# - [Integer] clicks the number of URLs that have been clicked with this tag in the last 30 days
|
94
|
+
# - [Integer] unique_clicks the number of unique clicks for emails sent with this tag in the last 30 days
|
95
|
+
# - [Hash] last_60_days stats with this tag in the last 60 days
|
96
|
+
# - [Integer] sent the number of emails sent with this tag in the last 60 days
|
97
|
+
# - [Integer] hard_bounces the number of emails hard bounced with this tag in the last 60 days
|
98
|
+
# - [Integer] soft_bounces the number of emails soft bounced with this tag in the last 60 days
|
99
|
+
# - [Integer] rejects the number of emails rejected for sending this tag in the last 60 days
|
100
|
+
# - [Integer] complaints the number of spam complaints with this tag in the last 60 days
|
101
|
+
# - [Integer] unsubs the number of unsubscribes with this tag in the last 60 days
|
102
|
+
# - [Integer] opens the number of times emails have been opened with this tag in the last 60 days
|
103
|
+
# - [Integer] unique_opens the number of unique opens for emails sent with this tag in the last 60 days
|
104
|
+
# - [Integer] clicks the number of URLs that have been clicked with this tag in the last 60 days
|
105
|
+
# - [Integer] unique_clicks the number of unique clicks for emails sent with this tag in the last 60 days
|
106
|
+
# - [Hash] last_90_days stats with this tag in the last 90 days
|
107
|
+
# - [Integer] sent the number of emails sent with this tag in the last 90 days
|
108
|
+
# - [Integer] hard_bounces the number of emails hard bounced with this tag in the last 90 days
|
109
|
+
# - [Integer] soft_bounces the number of emails soft bounced with this tag in the last 90 days
|
110
|
+
# - [Integer] rejects the number of emails rejected for sending this tag in the last 90 days
|
111
|
+
# - [Integer] complaints the number of spam complaints with this tag in the last 90 days
|
112
|
+
# - [Integer] unsubs the number of unsubscribes with this tag in the last 90 days
|
113
|
+
# - [Integer] opens the number of times emails have been opened with this tag in the last 90 days
|
114
|
+
# - [Integer] unique_opens the number of unique opens for emails sent with this tag in the last 90 days
|
115
|
+
# - [Integer] clicks the number of URLs that have been clicked with this tag in the last 90 days
|
116
|
+
# - [Integer] unique_clicks the number of unique clicks for emails sent with this tag in the last 90 days
|
117
|
+
def info(tag)
|
118
|
+
_params = {:tag => tag}
|
119
|
+
return @master.call 'tags/info', _params
|
120
|
+
end
|
121
|
+
|
122
|
+
# Return the recent history (hourly stats for the last 30 days) for a tag
|
123
|
+
# @param [String] tag an existing tag name
|
124
|
+
# @return [Array] the array of history information
|
125
|
+
# - [Hash] return[] the stats for a single hour
|
126
|
+
# - [String] time the hour as a UTC date string in YYYY-MM-DD HH:MM:SS format
|
127
|
+
# - [Integer] sent the number of emails that were sent during the hour
|
128
|
+
# - [Integer] hard_bounces the number of emails that hard bounced during the hour
|
129
|
+
# - [Integer] soft_bounces the number of emails that soft bounced during the hour
|
130
|
+
# - [Integer] rejects the number of emails that were rejected during the hour
|
131
|
+
# - [Integer] complaints the number of spam complaints received during the hour
|
132
|
+
# - [Integer] unsubs the number of unsubscribes received during the hour
|
133
|
+
# - [Integer] opens the number of emails opened during the hour
|
134
|
+
# - [Integer] unique_opens the number of unique opens generated by messages sent during the hour
|
135
|
+
# - [Integer] clicks the number of tracked URLs clicked during the hour
|
136
|
+
# - [Integer] unique_clicks the number of unique clicks generated by messages sent during the hour
|
137
|
+
def time_series(tag)
|
138
|
+
_params = {:tag => tag}
|
139
|
+
return @master.call 'tags/time-series', _params
|
140
|
+
end
|
141
|
+
|
142
|
+
# Return the recent history (hourly stats for the last 30 days) for all tags
|
143
|
+
# @return [Array] the array of history information
|
144
|
+
# - [Hash] return[] the stats for a single hour
|
145
|
+
# - [String] time the hour as a UTC date string in YYYY-MM-DD HH:MM:SS format
|
146
|
+
# - [Integer] sent the number of emails that were sent during the hour
|
147
|
+
# - [Integer] hard_bounces the number of emails that hard bounced during the hour
|
148
|
+
# - [Integer] soft_bounces the number of emails that soft bounced during the hour
|
149
|
+
# - [Integer] rejects the number of emails that were rejected during the hour
|
150
|
+
# - [Integer] complaints the number of spam complaints received during the hour
|
151
|
+
# - [Integer] unsubs the number of unsubscribes received during the hour
|
152
|
+
# - [Integer] opens the number of emails opened during the hour
|
153
|
+
# - [Integer] unique_opens the number of unique opens generated by messages sent during the hour
|
154
|
+
# - [Integer] clicks the number of tracked URLs clicked during the hour
|
155
|
+
# - [Integer] unique_clicks the number of unique clicks generated by messages sent during the hour
|
156
|
+
def all_time_series()
|
157
|
+
_params = {}
|
158
|
+
return @master.call 'tags/all-time-series', _params
|
159
|
+
end
|
160
|
+
|
161
|
+
end
|
162
|
+
end
|