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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 21eb9c590a1ca3178bd2aaf43dd87ae47d72d04c
4
- data.tar.gz: 89e70a81ac91e1987f59fb39b397d7fba2ea4bab
3
+ metadata.gz: ee687630f13a9d0b6b0f3baa0300f5d91240cfef
4
+ data.tar.gz: bc485064ffaec5ac0562a0c76fc5397f6a0c8d8f
5
5
  SHA512:
6
- metadata.gz: d6bb6fd748e01b0b88f3919eaedbbdf0a5a303a80e7010c9344c598cd5e18d4e9a7db9ca1a613deea0d463e8c8e12ba3be694a5fd65dafd249beeeb4ebe2b8ac
7
- data.tar.gz: 96d3b5e7c730749a5c3da5e2b3d18ba3b4aaf7376902ec2e4191adde50f6bb4b9c558c80efc6f8659b533c9c277d85d86b4ad86c91386acb9fcc2bcef958ea9b
6
+ metadata.gz: 3b962cf8888dee834f9282604cddaca3f03a055140c28040502ddbd76e84d72a2724a4fe29c1860ed51898247fc271c513bfef9dafd57f9c858930047a7585f3
7
+ data.tar.gz: c02d214871a6630cd49e709483edc8fb44d6c76380bb145de7884cf346dcd0c63cfd6ce70077872e856287c056b96d1095391a6b713ba09f45a4d479c3e966f6
@@ -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
- unless @merge_vars.empty?
128
- @merge_vars.collect { |key, value| { 'name' => key.to_s, 'content' => value } }
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
 
@@ -1,3 +1,3 @@
1
1
  module LaunchControl
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
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.1.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-24 00:00:00.000000000 Z
11
+ date: 2015-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mandrill-api