launch_control 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/launch_control.rb +28 -3
- data/lib/launch_control/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee687630f13a9d0b6b0f3baa0300f5d91240cfef
|
4
|
+
data.tar.gz: bc485064ffaec5ac0562a0c76fc5397f6a0c8d8f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b962cf8888dee834f9282604cddaca3f03a055140c28040502ddbd76e84d72a2724a4fe29c1860ed51898247fc271c513bfef9dafd57f9c858930047a7585f3
|
7
|
+
data.tar.gz: c02d214871a6630cd49e709483edc8fb44d6c76380bb145de7884cf346dcd0c63cfd6ce70077872e856287c056b96d1095391a6b713ba09f45a4d479c3e966f6
|
data/lib/launch_control.rb
CHANGED
@@ -56,6 +56,7 @@ module LaunchControl
|
|
56
56
|
@from_email = options.delete(:from_email)
|
57
57
|
@reply_to = options.delete(:reply_to)
|
58
58
|
@subject = options.delete(:subject)
|
59
|
+
@attachments = options.delete(:attachments) || []
|
59
60
|
@merge_vars = options
|
60
61
|
end
|
61
62
|
|
@@ -86,7 +87,8 @@ module LaunchControl
|
|
86
87
|
"subject" => @subject,
|
87
88
|
"from_name" => @from_name,
|
88
89
|
"from_email" => @from_email,
|
89
|
-
"global_merge_vars" => build_merge_vars
|
90
|
+
"global_merge_vars" => build_merge_vars,
|
91
|
+
"attachments" => build_attachments
|
90
92
|
}
|
91
93
|
end
|
92
94
|
|
@@ -124,10 +126,33 @@ module LaunchControl
|
|
124
126
|
|
125
127
|
|
126
128
|
def build_merge_vars
|
127
|
-
|
128
|
-
|
129
|
+
if @merge_vars.empty?
|
130
|
+
[]
|
129
131
|
else
|
132
|
+
@merge_vars.collect { |key, value| { 'name' => key.to_s, 'content' => value } }
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
#
|
137
|
+
# Expects an array of hashes containing the
|
138
|
+
# attachment details.
|
139
|
+
#
|
140
|
+
# i.e.
|
141
|
+
#
|
142
|
+
# [{ type: 'text/plain', 'name': 'test.txt', content: '1234' }]
|
143
|
+
#
|
144
|
+
def build_attachments
|
145
|
+
if @attachments.empty?
|
130
146
|
[]
|
147
|
+
else
|
148
|
+
@attachments.collect do |attachment|
|
149
|
+
next unless attachment.class == Hash
|
150
|
+
{
|
151
|
+
'type' => attachment[:type],
|
152
|
+
'name' => attachment[:name],
|
153
|
+
'content' => attachment[:content]
|
154
|
+
}
|
155
|
+
end
|
131
156
|
end
|
132
157
|
end
|
133
158
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: launch_control
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Teague
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mandrill-api
|