mandrill-api 1.0.42 → 1.0.43
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/mandrill.rb +4 -0
- data/lib/mandrill/api.rb +157 -0
- data/lib/mandrill/errors.rb +2 -0
- metadata +6 -5
data/lib/mandrill.rb
CHANGED
@@ -55,6 +55,7 @@ module Mandrill
|
|
55
55
|
'ValidationError' => ValidationError,
|
56
56
|
'Invalid_Key' => InvalidKeyError,
|
57
57
|
'PaymentRequired' => PaymentRequiredError,
|
58
|
+
'Unknown_Subaccount' => UnknownSubaccountError,
|
58
59
|
'Unknown_Template' => UnknownTemplateError,
|
59
60
|
'ServiceUnavailable' => ServiceUnavailableError,
|
60
61
|
'Unknown_Message' => UnknownMessageError,
|
@@ -110,6 +111,9 @@ module Mandrill
|
|
110
111
|
def internal()
|
111
112
|
Internal.new self
|
112
113
|
end
|
114
|
+
def subaccounts()
|
115
|
+
Subaccounts.new self
|
116
|
+
end
|
113
117
|
def urls()
|
114
118
|
Urls.new self
|
115
119
|
end
|
data/lib/mandrill/api.rb
CHANGED
@@ -712,6 +712,7 @@ module Mandrill
|
|
712
712
|
# - [String] content the merge variable's content
|
713
713
|
# - [Array] tags an array of string to tag the message with. Stats are accumulated using tags, though we only store the first 100 we see, so this should not be unique or change frequently. Tags should be 50 characters or less. Any tags starting with an underscore are reserved for internal use and will cause errors.
|
714
714
|
# - [String] tags[] a single tag - must not start with an underscore
|
715
|
+
# - [String] subaccount the unique id of a subaccount for this message - must already exist or will fail with an error
|
715
716
|
# - [Array] google_analytics_domains an array of strings indicating for which any matching URLs will automatically have Google Analytics parameters appended to their query string automatically.
|
716
717
|
# - [Array, String] google_analytics_campaign optional string indicating the value to set for the utm_campaign tracking parameter. If this isn't provided the email's from address will be used instead.
|
717
718
|
# - [Array] metadata metadata an associative array of user metadata. Mandrill will store this metadata and make it available for retrieval. In addition, you can select up to 10 metadata fields to index and make searchable using the Mandrill search api.
|
@@ -786,6 +787,7 @@ module Mandrill
|
|
786
787
|
# - [String] content the merge variable's content
|
787
788
|
# - [Array] tags an array of string to tag the message with. Stats are accumulated using tags, though we only store the first 100 we see, so this should not be unique or change frequently. Tags should be 50 characters or less. Any tags starting with an underscore are reserved for internal use and will cause errors.
|
788
789
|
# - [String] tags[] a single tag - must not start with an underscore
|
790
|
+
# - [String] subaccount the unique id of a subaccount for this message - must already exist or will fail with an error
|
789
791
|
# - [Array] google_analytics_domains an array of strings indicating for which any matching URLs will automatically have Google Analytics parameters appended to their query string automatically.
|
790
792
|
# - [Array, String] google_analytics_campaign optional string indicating the value to set for the utm_campaign tracking parameter. If this isn't provided the email's from address will be used instead.
|
791
793
|
# - [Array] metadata metadata an associative array of user metadata. Mandrill will store this metadata and make it available for retrieval. In addition, you can select up to 10 metadata fields to index and make searchable using the Mandrill search api.
|
@@ -1065,6 +1067,161 @@ module Mandrill
|
|
1065
1067
|
@master = master
|
1066
1068
|
end
|
1067
1069
|
|
1070
|
+
end
|
1071
|
+
class Subaccounts
|
1072
|
+
attr_accessor :master
|
1073
|
+
|
1074
|
+
def initialize(master)
|
1075
|
+
@master = master
|
1076
|
+
end
|
1077
|
+
|
1078
|
+
# Get the list of subaccounts defined for the account, optionally filtered by a prefix
|
1079
|
+
# @param [String] q an optional prefix to filter the subaccounts' ids and names
|
1080
|
+
# @return [Array] the subaccounts for the account, up to a maximum of 1,000
|
1081
|
+
# - [Hash] return[] the individual subaccount info
|
1082
|
+
# - [String] id a unique indentifier for the subaccount
|
1083
|
+
# - [String] name an optional display name for the subaccount
|
1084
|
+
# - [Integer] custom_quota an optional manual hourly quota for the subaccount. If not specified, the hourly quota will be managed based on reputation
|
1085
|
+
# - [String] status the current sending status of the subaccount, one of "active" or "paused"
|
1086
|
+
# - [Integer] reputation the subaccount's current reputation on a scale from 0 to 100
|
1087
|
+
# - [String] created_at the date and time that the subaccount was created as a UTC string in YYYY-MM-DD HH:MM:SS format
|
1088
|
+
# - [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
|
1089
|
+
# - [Integer] sent_weekly the number of emails the subaccount has sent so far this week (weeks start on midnight Monday, UTC)
|
1090
|
+
# - [Integer] sent_monthly the number of emails the subaccount has sent so far this month (months start on midnight of the 1st, UTC)
|
1091
|
+
# - [Integer] sent_total the number of emails the subaccount has sent since it was created
|
1092
|
+
def list(q=nil)
|
1093
|
+
_params = {:q => q}
|
1094
|
+
return @master.call 'subaccounts/list', _params
|
1095
|
+
end
|
1096
|
+
|
1097
|
+
# Add a new subaccount
|
1098
|
+
# @param [String] id a unique identifier for the subaccount to be used in sending calls
|
1099
|
+
# @param [String] name an optional display name to further identify the subaccount
|
1100
|
+
# @param [String] notes optional extra text to associate with the subaccount
|
1101
|
+
# @param [Integer] custom_quota an optional manual hourly quota for the subaccount. If not specified, Mandrill will manage this based on reputation
|
1102
|
+
# @return [Hash] the information saved about the new subaccount
|
1103
|
+
# - [String] id a unique indentifier for the subaccount
|
1104
|
+
# - [String] name an optional display name for the subaccount
|
1105
|
+
# - [Integer] custom_quota an optional manual hourly quota for the subaccount. If not specified, the hourly quota will be managed based on reputation
|
1106
|
+
# - [String] status the current sending status of the subaccount, one of "active" or "paused"
|
1107
|
+
# - [Integer] reputation the subaccount's current reputation on a scale from 0 to 100
|
1108
|
+
# - [String] created_at the date and time that the subaccount was created as a UTC string in YYYY-MM-DD HH:MM:SS format
|
1109
|
+
# - [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
|
1110
|
+
# - [Integer] sent_weekly the number of emails the subaccount has sent so far this week (weeks start on midnight Monday, UTC)
|
1111
|
+
# - [Integer] sent_monthly the number of emails the subaccount has sent so far this month (months start on midnight of the 1st, UTC)
|
1112
|
+
# - [Integer] sent_total the number of emails the subaccount has sent since it was created
|
1113
|
+
def add(id, name=nil, notes=nil, custom_quota=nil)
|
1114
|
+
_params = {:id => id, :name => name, :notes => notes, :custom_quota => custom_quota}
|
1115
|
+
return @master.call 'subaccounts/add', _params
|
1116
|
+
end
|
1117
|
+
|
1118
|
+
# Given the ID of an existing subaccount, return the data about it
|
1119
|
+
# @param [String] id the unique identifier of the subaccount to query
|
1120
|
+
# @return [Hash] the information about the subaccount
|
1121
|
+
# - [String] id a unique indentifier for the subaccount
|
1122
|
+
# - [String] name an optional display name for the subaccount
|
1123
|
+
# - [String] notes optional extra text to associate with the subaccount
|
1124
|
+
# - [Integer] custom_quota an optional manual hourly quota for the subaccount. If not specified, the hourly quota will be managed based on reputation
|
1125
|
+
# - [String] status the current sending status of the subaccount, one of "active" or "paused"
|
1126
|
+
# - [Integer] reputation the subaccount's current reputation on a scale from 0 to 100
|
1127
|
+
# - [String] created_at the date and time that the subaccount was created as a UTC string in YYYY-MM-DD HH:MM:SS format
|
1128
|
+
# - [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
|
1129
|
+
# - [Integer] sent_weekly the number of emails the subaccount has sent so far this week (weeks start on midnight Monday, UTC)
|
1130
|
+
# - [Integer] sent_monthly the number of emails the subaccount has sent so far this month (months start on midnight of the 1st, UTC)
|
1131
|
+
# - [Integer] sent_total the number of emails the subaccount has sent since it was created
|
1132
|
+
# - [Integer] sent_hourly the number of emails the subaccount has sent in the last hour
|
1133
|
+
# - [Integer] hourly_quota the current hourly quota for the subaccount, either manual or reputation-based
|
1134
|
+
# - [Hash] last_30_days stats for this subaccount in the last 30 days
|
1135
|
+
# - [Integer] sent the number of emails sent for this subaccount in the last 30 days
|
1136
|
+
# - [Integer] hard_bounces the number of emails hard bounced for this subaccount in the last 30 days
|
1137
|
+
# - [Integer] soft_bounces the number of emails soft bounced for this subaccount in the last 30 days
|
1138
|
+
# - [Integer] rejects the number of emails rejected for sending this subaccount in the last 30 days
|
1139
|
+
# - [Integer] complaints the number of spam complaints for this subaccount in the last 30 days
|
1140
|
+
# - [Integer] unsubs the number of unsbuscribes for this subaccount in the last 30 days
|
1141
|
+
# - [Integer] opens the number of times emails have been opened for this subaccount in the last 30 days
|
1142
|
+
# - [Integer] unique_opens the number of unique opens for emails sent for this subaccount in the last 30 days
|
1143
|
+
# - [Integer] clicks the number of URLs that have been clicked for this subaccount in the last 30 days
|
1144
|
+
# - [Integer] unique_clicks the number of unique clicks for emails sent for this subaccount in the last 30 days
|
1145
|
+
def info(id)
|
1146
|
+
_params = {:id => id}
|
1147
|
+
return @master.call 'subaccounts/info', _params
|
1148
|
+
end
|
1149
|
+
|
1150
|
+
# Update an existing subaccount
|
1151
|
+
# @param [String] id the unique identifier of the subaccount to update
|
1152
|
+
# @param [String] name an optional display name to further identify the subaccount
|
1153
|
+
# @param [String] notes optional extra text to associate with the subaccount
|
1154
|
+
# @param [Integer] custom_quota an optional manual hourly quota for the subaccount. If not specified, Mandrill will manage this based on reputation
|
1155
|
+
# @return [Hash] the information for the updated subaccount
|
1156
|
+
# - [String] id a unique indentifier for the subaccount
|
1157
|
+
# - [String] name an optional display name for the subaccount
|
1158
|
+
# - [Integer] custom_quota an optional manual hourly quota for the subaccount. If not specified, the hourly quota will be managed based on reputation
|
1159
|
+
# - [String] status the current sending status of the subaccount, one of "active" or "paused"
|
1160
|
+
# - [Integer] reputation the subaccount's current reputation on a scale from 0 to 100
|
1161
|
+
# - [String] created_at the date and time that the subaccount was created as a UTC string in YYYY-MM-DD HH:MM:SS format
|
1162
|
+
# - [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
|
1163
|
+
# - [Integer] sent_weekly the number of emails the subaccount has sent so far this week (weeks start on midnight Monday, UTC)
|
1164
|
+
# - [Integer] sent_monthly the number of emails the subaccount has sent so far this month (months start on midnight of the 1st, UTC)
|
1165
|
+
# - [Integer] sent_total the number of emails the subaccount has sent since it was created
|
1166
|
+
def update(id, name=nil, notes=nil, custom_quota=nil)
|
1167
|
+
_params = {:id => id, :name => name, :notes => notes, :custom_quota => custom_quota}
|
1168
|
+
return @master.call 'subaccounts/update', _params
|
1169
|
+
end
|
1170
|
+
|
1171
|
+
# 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.
|
1172
|
+
# @param [String] id the unique identifier of the subaccount to delete
|
1173
|
+
# @return [Hash] the information for the deleted subaccount
|
1174
|
+
# - [String] id a unique indentifier for the subaccount
|
1175
|
+
# - [String] name an optional display name for the subaccount
|
1176
|
+
# - [Integer] custom_quota an optional manual hourly quota for the subaccount. If not specified, the hourly quota will be managed based on reputation
|
1177
|
+
# - [String] status the current sending status of the subaccount, one of "active" or "paused"
|
1178
|
+
# - [Integer] reputation the subaccount's current reputation on a scale from 0 to 100
|
1179
|
+
# - [String] created_at the date and time that the subaccount was created as a UTC string in YYYY-MM-DD HH:MM:SS format
|
1180
|
+
# - [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
|
1181
|
+
# - [Integer] sent_weekly the number of emails the subaccount has sent so far this week (weeks start on midnight Monday, UTC)
|
1182
|
+
# - [Integer] sent_monthly the number of emails the subaccount has sent so far this month (months start on midnight of the 1st, UTC)
|
1183
|
+
# - [Integer] sent_total the number of emails the subaccount has sent since it was created
|
1184
|
+
def delete(id)
|
1185
|
+
_params = {:id => id}
|
1186
|
+
return @master.call 'subaccounts/delete', _params
|
1187
|
+
end
|
1188
|
+
|
1189
|
+
# 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.
|
1190
|
+
# @param [String] id the unique identifier of the subaccount to pause
|
1191
|
+
# @return [Hash] the information for the paused subaccount
|
1192
|
+
# - [String] id a unique indentifier for the subaccount
|
1193
|
+
# - [String] name an optional display name for the subaccount
|
1194
|
+
# - [Integer] custom_quota an optional manual hourly quota for the subaccount. If not specified, the hourly quota will be managed based on reputation
|
1195
|
+
# - [String] status the current sending status of the subaccount, one of "active" or "paused"
|
1196
|
+
# - [Integer] reputation the subaccount's current reputation on a scale from 0 to 100
|
1197
|
+
# - [String] created_at the date and time that the subaccount was created as a UTC string in YYYY-MM-DD HH:MM:SS format
|
1198
|
+
# - [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
|
1199
|
+
# - [Integer] sent_weekly the number of emails the subaccount has sent so far this week (weeks start on midnight Monday, UTC)
|
1200
|
+
# - [Integer] sent_monthly the number of emails the subaccount has sent so far this month (months start on midnight of the 1st, UTC)
|
1201
|
+
# - [Integer] sent_total the number of emails the subaccount has sent since it was created
|
1202
|
+
def pause(id)
|
1203
|
+
_params = {:id => id}
|
1204
|
+
return @master.call 'subaccounts/pause', _params
|
1205
|
+
end
|
1206
|
+
|
1207
|
+
# Resume a paused subaccount's sending
|
1208
|
+
# @param [String] id the unique identifier of the subaccount to resume
|
1209
|
+
# @return [Hash] the information for the resumed subaccount
|
1210
|
+
# - [String] id a unique indentifier for the subaccount
|
1211
|
+
# - [String] name an optional display name for the subaccount
|
1212
|
+
# - [Integer] custom_quota an optional manual hourly quota for the subaccount. If not specified, the hourly quota will be managed based on reputation
|
1213
|
+
# - [String] status the current sending status of the subaccount, one of "active" or "paused"
|
1214
|
+
# - [Integer] reputation the subaccount's current reputation on a scale from 0 to 100
|
1215
|
+
# - [String] created_at the date and time that the subaccount was created as a UTC string in YYYY-MM-DD HH:MM:SS format
|
1216
|
+
# - [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
|
1217
|
+
# - [Integer] sent_weekly the number of emails the subaccount has sent so far this week (weeks start on midnight Monday, UTC)
|
1218
|
+
# - [Integer] sent_monthly the number of emails the subaccount has sent so far this month (months start on midnight of the 1st, UTC)
|
1219
|
+
# - [Integer] sent_total the number of emails the subaccount has sent since it was created
|
1220
|
+
def resume(id)
|
1221
|
+
_params = {:id => id}
|
1222
|
+
return @master.call 'subaccounts/resume', _params
|
1223
|
+
end
|
1224
|
+
|
1068
1225
|
end
|
1069
1226
|
class Urls
|
1070
1227
|
attr_accessor :master
|
data/lib/mandrill/errors.rb
CHANGED
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: 65
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 43
|
10
|
+
version: 1.0.43
|
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-08-
|
18
|
+
date: 2013-08-23 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:
|