mandrill-api 1.0.10 → 1.0.11
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/mandrill.rb +8 -1
- data/lib/mandrill/api.rb +71 -17
- data/lib/mandrill/errors.rb +2 -0
- metadata +25 -5
data/lib/mandrill.rb
CHANGED
@@ -60,7 +60,8 @@ module Mandrill
|
|
60
60
|
'Unknown_Sender' => UnknownSenderError,
|
61
61
|
'Unknown_Url' => UnknownUrlError,
|
62
62
|
'Invalid_Template' => InvalidTemplateError,
|
63
|
-
'Unknown_Webhook' => UnknownWebhookError
|
63
|
+
'Unknown_Webhook' => UnknownWebhookError,
|
64
|
+
'Unknown_InboundDomain' => UnknownInboundDomainError
|
64
65
|
}
|
65
66
|
|
66
67
|
begin
|
@@ -87,12 +88,18 @@ module Mandrill
|
|
87
88
|
def rejects()
|
88
89
|
Rejects.new self
|
89
90
|
end
|
91
|
+
def inbound()
|
92
|
+
Inbound.new self
|
93
|
+
end
|
90
94
|
def tags()
|
91
95
|
Tags.new self
|
92
96
|
end
|
93
97
|
def messages()
|
94
98
|
Messages.new self
|
95
99
|
end
|
100
|
+
def internal()
|
101
|
+
Internal.new self
|
102
|
+
end
|
96
103
|
def urls()
|
97
104
|
Urls.new self
|
98
105
|
end
|
data/lib/mandrill/api.rb
CHANGED
@@ -13,9 +13,10 @@ module Mandrill
|
|
13
13
|
# @param [String] code the HTML code for the template with mc:edit attributes for the editable elements
|
14
14
|
# @param [Boolean] publish set to false to add a draft template without publishing
|
15
15
|
# @return [Hash] the information saved about the new template
|
16
|
-
# - [String]
|
16
|
+
# - [String] slug the immutable unique code name of the template
|
17
|
+
# - [String] name the name of the template
|
17
18
|
# - [String] code the full HTML code of the template, with mc:edit attributes marking the editable elements - draft version
|
18
|
-
# - [String] publish_name the
|
19
|
+
# - [String] publish_name the same as the template name - kept as a separate field for backwards compatibility
|
19
20
|
# - [String] publish_code the full HTML code of the template, with mc:edit attributes marking the editable elements that are available as published, if it has been published
|
20
21
|
# - [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
|
21
22
|
# - [String] created_at the date and time the template was first created as a UTC string in YYYY-MM-DD HH:MM:SS format
|
@@ -26,11 +27,12 @@ module Mandrill
|
|
26
27
|
end
|
27
28
|
|
28
29
|
# Get the information for an existing template
|
29
|
-
# @param [String] name the name of an existing template
|
30
|
+
# @param [String] name the immutable name of an existing template
|
30
31
|
# @return [Hash] the requested template information
|
31
|
-
# - [String]
|
32
|
+
# - [String] slug the immutable unique code name of the template
|
33
|
+
# - [String] name the name of the template
|
32
34
|
# - [String] code the full HTML code of the template, with mc:edit attributes marking the editable elements - draft version
|
33
|
-
# - [String] publish_name the
|
35
|
+
# - [String] publish_name the same as the template name - kept as a separate field for backwards compatibility
|
34
36
|
# - [String] publish_code the full HTML code of the template, with mc:edit attributes marking the editable elements that are available as published, if it has been published
|
35
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
|
36
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
|
@@ -41,13 +43,14 @@ module Mandrill
|
|
41
43
|
end
|
42
44
|
|
43
45
|
# Update the code for an existing template
|
44
|
-
# @param [String] name the name of an existing template
|
46
|
+
# @param [String] name the immutable name of an existing template
|
45
47
|
# @param [String] code the new code for the template
|
46
48
|
# @param [Boolean] publish set to false to update the draft version of the template without publishing
|
47
49
|
# @return [Hash] the template that was updated
|
48
|
-
# - [String]
|
50
|
+
# - [String] slug the immutable unique code name of the template
|
51
|
+
# - [String] name the name of the template
|
49
52
|
# - [String] code the full HTML code of the template, with mc:edit attributes marking the editable elements - draft version
|
50
|
-
# - [String] publish_name the
|
53
|
+
# - [String] publish_name the same as the template name - kept as a separate field for backwards compatibility
|
51
54
|
# - [String] publish_code the full HTML code of the template, with mc:edit attributes marking the editable elements that are available as published, if it has been published
|
52
55
|
# - [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
|
53
56
|
# - [String] created_at the date and time the template was first created as a UTC string in YYYY-MM-DD HH:MM:SS format
|
@@ -58,11 +61,12 @@ module Mandrill
|
|
58
61
|
end
|
59
62
|
|
60
63
|
# Publish the content for the template. Any new messages sent using this template will start using the content that was previously in draft.
|
61
|
-
# @param [String] name the name of an existing template
|
64
|
+
# @param [String] name the immutable name of an existing template
|
62
65
|
# @return [Hash] the template that was published
|
63
|
-
# - [String]
|
66
|
+
# - [String] slug the immutable unique code name of the template
|
67
|
+
# - [String] name the name of the template
|
64
68
|
# - [String] code the full HTML code of the template, with mc:edit attributes marking the editable elements - draft version
|
65
|
-
# - [String] publish_name the
|
69
|
+
# - [String] publish_name the same as the template name - kept as a separate field for backwards compatibility
|
66
70
|
# - [String] publish_code the full HTML code of the template, with mc:edit attributes marking the editable elements that are available as published, if it has been published
|
67
71
|
# - [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
|
68
72
|
# - [String] created_at the date and time the template was first created as a UTC string in YYYY-MM-DD HH:MM:SS format
|
@@ -73,11 +77,12 @@ module Mandrill
|
|
73
77
|
end
|
74
78
|
|
75
79
|
# Delete a template
|
76
|
-
# @param [String] name the name of an existing template
|
80
|
+
# @param [String] name the immutable name of an existing template
|
77
81
|
# @return [Hash] the template that was deleted
|
78
|
-
# - [String]
|
82
|
+
# - [String] slug the immutable unique code name of the template
|
83
|
+
# - [String] name the name of the template
|
79
84
|
# - [String] code the full HTML code of the template, with mc:edit attributes marking the editable elements - draft version
|
80
|
-
# - [String] publish_name the
|
85
|
+
# - [String] publish_name the same as the template name - kept as a separate field for backwards compatibility
|
81
86
|
# - [String] publish_code the full HTML code of the template, with mc:edit attributes marking the editable elements that are available as published, if it has been published
|
82
87
|
# - [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
|
83
88
|
# - [String] created_at the date and time the template was first created as a UTC string in YYYY-MM-DD HH:MM:SS format
|
@@ -90,9 +95,10 @@ module Mandrill
|
|
90
95
|
# Return a list of all the templates available to this user
|
91
96
|
# @return [Array] an array of structs with information about each template
|
92
97
|
# - [Hash] return[] the information on each template in the account
|
93
|
-
# - [String]
|
98
|
+
# - [String] slug the immutable unique code name of the template
|
99
|
+
# - [String] name the name of the template
|
94
100
|
# - [String] code the full HTML code of the template, with mc:edit attributes marking the editable elements - draft version
|
95
|
-
# - [String] publish_name the
|
101
|
+
# - [String] publish_name the same as the template name - kept as a separate field for backwards compatibility
|
96
102
|
# - [String] publish_code the full HTML code of the template, with mc:edit attributes marking the editable elements that are available as published, if it has been published
|
97
103
|
# - [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
|
98
104
|
# - [String] created_at the date and time the template was first created as a UTC string in YYYY-MM-DD HH:MM:SS format
|
@@ -122,7 +128,7 @@ module Mandrill
|
|
122
128
|
end
|
123
129
|
|
124
130
|
# Inject content and optionally merge fields into a template, returning the HTML that results
|
125
|
-
# @param [String] template_name the name of a template that exists in the user's account
|
131
|
+
# @param [String] template_name the immutable name of a template that exists in the user's account
|
126
132
|
# @param [Array] template_content an array of template content to render. Each item in the array should be a struct with two keys - name: the name of the content block to set the content for, and content: the actual content to put into the block
|
127
133
|
# - [Hash] template_content[] the injection of a single piece of content into a single editable region
|
128
134
|
# - [String] name the name of the mc:edit editable region to inject into
|
@@ -285,6 +291,46 @@ module Mandrill
|
|
285
291
|
return @master.call 'rejects/delete', _params
|
286
292
|
end
|
287
293
|
|
294
|
+
end
|
295
|
+
class Inbound
|
296
|
+
attr_accessor :master
|
297
|
+
|
298
|
+
def initialize(master)
|
299
|
+
@master = master
|
300
|
+
end
|
301
|
+
|
302
|
+
# List the domains that have been configured for inbound delivery
|
303
|
+
# @return [Array] the inbound domains associated with the account
|
304
|
+
# - [Array] return[] the individual domain info
|
305
|
+
def domains()
|
306
|
+
_params = {}
|
307
|
+
return @master.call 'inbound/domains', _params
|
308
|
+
end
|
309
|
+
|
310
|
+
# List the mailbox routes defined for an inbound domain
|
311
|
+
# @param [String] domain the domain to check
|
312
|
+
# @return [Array] the routes associated with the domain
|
313
|
+
# - [Hash] return[] the individual mailbox route
|
314
|
+
# - [String] pattern the search pattern that the mailbox name should match
|
315
|
+
# - [String] url the webhook URL where inbound messages will be published
|
316
|
+
def routes(domain)
|
317
|
+
_params = {:domain => domain}
|
318
|
+
return @master.call 'inbound/routes', _params
|
319
|
+
end
|
320
|
+
|
321
|
+
# 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 $sparam string $to[] the email address of the recipient @validate trim
|
322
|
+
# @param [String] raw_message the full MIME document of an email message
|
323
|
+
# @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
|
324
|
+
# @return [Array] an array of the information for each recipient in the message (usually one) that matched an inbound route
|
325
|
+
# - [Hash] return[] the individual recipient information
|
326
|
+
# - [Hash] email the email address of the matching recipient
|
327
|
+
# - [Hash] pattern the mailbox route pattern that the recipient matched
|
328
|
+
# - [Hash] url the webhook URL that the message was posted to
|
329
|
+
def send_raw(raw_message, to=nil)
|
330
|
+
_params = {:raw_message => raw_message, :to => to}
|
331
|
+
return @master.call 'inbound/send-raw', _params
|
332
|
+
end
|
333
|
+
|
288
334
|
end
|
289
335
|
class Tags
|
290
336
|
attr_accessor :master
|
@@ -621,6 +667,14 @@ module Mandrill
|
|
621
667
|
return @master.call 'messages/send-raw', _params
|
622
668
|
end
|
623
669
|
|
670
|
+
end
|
671
|
+
class Internal
|
672
|
+
attr_accessor :master
|
673
|
+
|
674
|
+
def initialize(master)
|
675
|
+
@master = master
|
676
|
+
end
|
677
|
+
|
624
678
|
end
|
625
679
|
class Urls
|
626
680
|
attr_accessor :master
|
data/lib/mandrill/errors.rb
CHANGED
metadata
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mandrill-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 1
|
4
5
|
prerelease:
|
5
|
-
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
- 11
|
10
|
+
version: 1.0.11
|
6
11
|
platform: ruby
|
7
12
|
authors:
|
8
13
|
- Mandrill Devs
|
@@ -10,8 +15,7 @@ autorequire:
|
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
17
|
|
13
|
-
date: 2012-12-
|
14
|
-
default_executable:
|
18
|
+
date: 2012-12-17 00:00:00 Z
|
15
19
|
dependencies:
|
16
20
|
- !ruby/object:Gem::Dependency
|
17
21
|
name: json
|
@@ -21,6 +25,11 @@ dependencies:
|
|
21
25
|
requirements:
|
22
26
|
- - ~>
|
23
27
|
- !ruby/object:Gem::Version
|
28
|
+
hash: 3
|
29
|
+
segments:
|
30
|
+
- 1
|
31
|
+
- 7
|
32
|
+
- 4
|
24
33
|
version: 1.7.4
|
25
34
|
type: :runtime
|
26
35
|
version_requirements: *id001
|
@@ -32,6 +41,11 @@ dependencies:
|
|
32
41
|
requirements:
|
33
42
|
- - ~>
|
34
43
|
- !ruby/object:Gem::Version
|
44
|
+
hash: 43
|
45
|
+
segments:
|
46
|
+
- 0
|
47
|
+
- 15
|
48
|
+
- 4
|
35
49
|
version: 0.15.4
|
36
50
|
type: :runtime
|
37
51
|
version_requirements: *id002
|
@@ -47,7 +61,6 @@ files:
|
|
47
61
|
- lib/mandrill.rb
|
48
62
|
- lib/mandrill/api.rb
|
49
63
|
- lib/mandrill/errors.rb
|
50
|
-
has_rdoc: true
|
51
64
|
homepage: https://bitbucket.org/mailchimp/mandrill-api-ruby/
|
52
65
|
licenses: []
|
53
66
|
|
@@ -61,19 +74,26 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
61
74
|
requirements:
|
62
75
|
- - ">="
|
63
76
|
- !ruby/object:Gem::Version
|
77
|
+
hash: 3
|
78
|
+
segments:
|
79
|
+
- 0
|
64
80
|
version: "0"
|
65
81
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
66
82
|
none: false
|
67
83
|
requirements:
|
68
84
|
- - ">="
|
69
85
|
- !ruby/object:Gem::Version
|
86
|
+
hash: 3
|
87
|
+
segments:
|
88
|
+
- 0
|
70
89
|
version: "0"
|
71
90
|
requirements: []
|
72
91
|
|
73
92
|
rubyforge_project:
|
74
|
-
rubygems_version: 1.
|
93
|
+
rubygems_version: 1.8.24
|
75
94
|
signing_key:
|
76
95
|
specification_version: 3
|
77
96
|
summary: A Ruby API library for the Mandrill email as a service platform.
|
78
97
|
test_files: []
|
79
98
|
|
99
|
+
has_rdoc:
|