marketingcloud-mailer 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: 13889f6bd857910ef405ec97b49dcd48770e26ce
4
- data.tar.gz: 25e88a3a9686c7e8e795175d52a21a52556ae03b
3
+ metadata.gz: c43df6df704ba5d094a67bbdac8f951864556015
4
+ data.tar.gz: 6ce53d834407e6252a53521c73a0b22d719a70f9
5
5
  SHA512:
6
- metadata.gz: b75f1bf09abbaec708756b7733ab6fa9d2ed567d27f74ddda97252fea99894485ce23efc0bf164d81d788c7d82c4333b193a1eeedbd1f11380d6efcee66c3b2d
7
- data.tar.gz: a618b3ef49716b5b7cd6c256a3cb18e4009b34c7d26709ea9cb72bad169a2cfa77f2f9798a45ec29e7198a877ef70348286f5883030cec93c32444d2fc9a9033
6
+ metadata.gz: c4e809e212a75a7eb053546380f15ba42ccf313b382c4f3faeb3660140274a5615a7f3fa1d14135564fa408a56fe2bd02660a03b3f46d01c4624f5a941a0a05f
7
+ data.tar.gz: 26116f746340f35c3e3885c8e10628fa3227abe2a839fc249bdbb742dd32c9bec2d5ca28ff8081a15f9586b84aa2190dd6dd87735ee7380bfc5bcea5167f3d5c
@@ -17,12 +17,16 @@ module Marketingcloud
17
17
  end
18
18
 
19
19
  def deliver!(mail)
20
- # key = mail['external_key'] || external_key
21
20
  ts = ::ExactTargetRest::TriggeredSend.new(@session, external_key)
22
21
  if mail.to.length != 1
23
22
  raise ArgumentError.new('Marketingcloud::Mailer only accepts a single recipient')
24
23
  end
25
- ts.send_one(email_address: mail.to.first, subscriber_attributes: { 'HTML' => mail.body.raw_source, 'Subject' => mail.subject, 'Preheader' => ''})
24
+ html = if mail.body.raw_source.blank? && mail.body.parts.length >= 1
25
+ mail.body.parts.last.to_s
26
+ else
27
+ mail.body.raw_source
28
+ end
29
+ ts.send_one(email_address: mail.to.first, subscriber_attributes: { 'HTML' => html, 'Subject' => mail.subject, 'Preheader' => ''})
26
30
  end
27
31
 
28
32
  private
@@ -1,5 +1,5 @@
1
1
  module Marketingcloud
2
2
  class Mailer
3
- VERSION = "0.1.0"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: marketingcloud-mailer
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
  - Justin Smestad
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-18 00:00:00.000000000 Z
11
+ date: 2017-04-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mail