expresspigeon-ruby 0.0.6 → 0.0.7

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: fe5c068844c9be4409e579ec341e7adb9e793330
4
- data.tar.gz: 25738ba898a979110728640539677250bd15ce80
3
+ metadata.gz: 2aaf2cb7ae311969900e94bea9466d740495805e
4
+ data.tar.gz: e1f4506783ec702b655f0200b0abbf2e99a6dd5e
5
5
  SHA512:
6
- metadata.gz: 9cce412e917134f9f04acb97e2a109992cdf767c65265df219892b23f73c0d19e6c5be77349c7d6ca9534c53853c3ebd7f0b1c7c3c38ab9b0fd5909e8d447f61
7
- data.tar.gz: da1dc1d7d89ab9bc1dbcedb07c2cee5394bd3d756db5fbf5dc5b4863f9780e153d4ed5e01c4afa724f593e388cb3d06366e6dc66cb6b351a246b308e24bbcde5
6
+ metadata.gz: 7a69e5d4cde9b3dab5f835eb5ff12228888aa0cf3b3837cf3f2a71360de7cc0e7e8ccbafcdb2f38dc52fe276f40d32621002ac5cd0966f585a6538c840346d69
7
+ data.tar.gz: 80c4ba1ef1dd860348e5d6db29e6897d1e6accf53b6a50f7b3f962d6d6ce364ef120e24b59c608b7a0deb0adaa83304fd21b159450d43ea204ebde0daaf3b896
@@ -17,13 +17,17 @@ module ExpressPigeon
17
17
  # * +merge fields+ - hash with dynamic values to merge into a template
18
18
  # * +view_online+ - generate "view online" link in the template
19
19
  # * +click_tracking+ - enable/disable click tracking (and URL rewriting)
20
+ # * +suppress_address+ - enable/disable display of physical address at the bottom of newsletter.
20
21
  # * +attachments+ - array of file paths to attach to email. Size limit: 1k per attachment, maximum 3 attachments.
21
- def send_message(template_id, to, reply_to, from_name, subject, merge_fields = nil, view_online = false, click_tracking = true, attachments = nil)
22
+ def send_message(template_id, to, reply_to, from_name, subject, merge_fields = nil, view_online = false,
23
+ click_tracking = true, suppress_address = false, attachments = nil)
22
24
  if attachments
23
- upload(template_id, to, reply_to, from_name, subject, merge_fields, view_online, click_tracking, attachments)
25
+ upload(template_id, to, reply_to, from_name, subject, merge_fields, view_online, click_tracking,
26
+ suppress_address, attachments)
24
27
  else
25
- post @endpoint, params = {template_id: template_id, :to => to, reply_to: reply_to, :from => from_name, :subject => subject,
26
- :merge_fields => merge_fields, :view_online => view_online, :click_tracking => click_tracking}
28
+ post @endpoint, params = {template_id: template_id, to: to, reply_to: reply_to, from: from_name,
29
+ subject: subject, merge_fields: merge_fields, view_online: view_online,
30
+ click_tracking: click_tracking, suppress_address: suppress_address}
27
31
  end
28
32
  end
29
33
 
@@ -78,15 +82,12 @@ module ExpressPigeon
78
82
  # * +merge fields+ - hash with dynamic values to merge into a template
79
83
  # * +view_online+ - generate "view online" link in the template
80
84
  # * +click_tracking+ - enable/disable click tracking (and URL rewriting)
85
+ # * +suppress_address+ - enable/disable display of physical address at the bottom of newsletter.
81
86
  # * +attachments+ - array of file paths to attach to email. Size limit: 1k per attachment, maximum 3 attachments.
82
- def upload(template_id, to, reply_to, from_name, subject, merge_fields, view_online, click_tracking, attachments)
83
-
87
+ def upload(template_id, to, reply_to, from_name, subject, merge_fields, view_online, click_tracking, suppress_address, attachments)
84
88
  path = "#{@root ? @root : ROOT}/#{@endpoint}"
85
-
86
- puts "sending to #{path}"
87
-
88
89
  begin
89
- payload = prepare_payload(template_id, to, reply_to, from_name, subject, merge_fields, view_online, click_tracking, attachments)
90
+ payload = prepare_payload(template_id, to, reply_to, from_name, subject, merge_fields, view_online, click_tracking, suppress_address, attachments)
90
91
  request = RestClient::Request.new(
91
92
  :method => :post,
92
93
  :headers => {:'X-auth-key' => get_auth_key},
@@ -107,7 +108,7 @@ module ExpressPigeon
107
108
  end
108
109
 
109
110
 
110
- def prepare_payload(template_id, to, reply_to, from, subject, merge_fields, view_online, click_tracking, attachments)
111
+ def prepare_payload(template_id, to, reply_to, from, subject, merge_fields, view_online, click_tracking, suppress_address, attachments)
111
112
  payload = { multipart: true }
112
113
  payload[:template_id] = template_id
113
114
  payload[:to] = to
@@ -117,6 +118,7 @@ module ExpressPigeon
117
118
  payload[:merge_fields] = merge_fields
118
119
  payload[:view_online] = view_online
119
120
  payload[:click_tracking] = click_tracking
121
+ payload[:suppress_address] = suppress_address
120
122
 
121
123
  attachments.each { |attachment|
122
124
  if File.file?(attachment)
@@ -1,5 +1,5 @@
1
1
  module Expresspigeon
2
2
  module API
3
- VERSION = "0.0.6"
3
+ VERSION = "0.0.7"
4
4
  end
5
5
  end
@@ -132,7 +132,7 @@ describe 'transactional messages integration test' do
132
132
  'Jane Doe',
133
133
  'Hello, Dolly!',
134
134
  {eye_color: 'blue', body_shape:'pear'},
135
- false, true,
135
+ false, true, false,
136
136
  %w(spec/resources/attachment1.txt spec/resources/attachment2.txt))
137
137
 
138
138
  payload[:multipart].should eq true
@@ -146,6 +146,7 @@ describe 'transactional messages integration test' do
146
146
  payload[:merge_fields][:body_shape].should eq 'pear'
147
147
  payload[:view_online].should eq false
148
148
  payload[:click_tracking].should eq true
149
+ payload[:suppress_address].should eq false
149
150
  payload['attachment1.txt'].class.should eq File
150
151
  File.basename(payload['attachment1.txt']).should eq 'attachment1.txt'
151
152
  File.basename(payload['attachment2.txt']).should eq 'attachment2.txt'
@@ -14,5 +14,6 @@ puts MESSAGES.send_message(
14
14
  {first_name: 'Igor', eye_color: 'blue'}, #merge_fields
15
15
  false, #view_online
16
16
  true, #click_tracking
17
+ true, #suppress_address
17
18
  attachments #file paths to upload as attachments
18
19
  )
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: expresspigeon-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - ipolevoy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-15 00:00:00.000000000 Z
11
+ date: 2016-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client