send_with_us 4.2.1 → 4.3.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
  SHA256:
3
- metadata.gz: b4f011c520b1ac7dad2bdcdcec37d6ff1f2f28ed9fa37f769fe2a007f018bb8b
4
- data.tar.gz: 6b4dcaa033c8d5664266295611b6d9f806a246cb8a9effeda0d9b017ca3ecc68
3
+ metadata.gz: b6a246f1dd54a758295eb1b9ac7fd0d98daa6d0e5f7ffd7f6fa9a0216025ea79
4
+ data.tar.gz: 8cd25be4990e4c71b1670c9f6e643df17bf959503f51856c158b94e050d26ed6
5
5
  SHA512:
6
- metadata.gz: c6b3e38cdbdf61aca2c9a67eccdc3702dfcd506ed913215bf5f239165bd7f223dd2d521debf9fbfabdf88392a830f1ef4422e38e8521dd3d9ab61df73aa33a51
7
- data.tar.gz: 9a116f73ce870f583a9999175fce0b054bb8c4ca102f1954ac3d5e2cc8e0bd745631119330745901dee84deb881e86475c3aade6afc0337eb9717fcdbe985ef6
6
+ metadata.gz: 91d8aee785590e548f116dad433c0e04319eaa3fa293ae6c589f1d39e4b436630d6b14eed1c8dbe7d96c62cee379e93dd0bc0730ff4e28b1a813465a2e9ae3cd
7
+ data.tar.gz: dccfdd92058ab69d73856c885e3df260829ba326d5333c8842201fb8f149e8b71a32db80106b5b43112ff7fbd65829f7f769d868bd06315280a750b70c943773
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
+ ## 4.3.0
2
+ - Add optional `preheader` and `amp_html` fields to template calls
3
+
1
4
  ## 4.2.1
2
- - Bump `rake` version due to vulnerability
5
+ - Bump `rake` version due to vulnerability
3
6
 
4
7
  ## 4.2.0
5
8
  - add a `log_events` method to get the events list on a Sendwithus log
@@ -160,12 +160,14 @@ module SendWithUs
160
160
  SendWithUs::ApiRequest.new(@configuration).post(:'render', payload)
161
161
  end
162
162
 
163
- def create_template(name, subject, html, text)
163
+ def create_template(name, subject, html, text, preheader='', amp_html='')
164
164
  payload = {
165
165
  name: name,
166
166
  subject: subject,
167
167
  html: html,
168
- text: text
168
+ text: text,
169
+ preheader: preheader,
170
+ amp_html: amp_html
169
171
  }
170
172
 
171
173
  payload = payload.to_json
@@ -254,7 +256,7 @@ module SendWithUs
254
256
 
255
257
  SendWithUs::ApiRequest.new(@configuration).get(endpoint)
256
258
  end
257
-
259
+
258
260
  def delete_template(template_id)
259
261
  endpoint = "templates/#{template_id}"
260
262
  SendWithUs::ApiRequest.new(@configuration).delete(endpoint)
@@ -270,24 +272,28 @@ module SendWithUs
270
272
  SendWithUs::ApiRequest.new(@configuration).get(endpoint)
271
273
  end
272
274
 
273
- def update_template_version(template_id, version_id, name, subject, html, text)
275
+ def update_template_version(template_id, version_id, name, subject, html, text, preheader='', amp_html='')
274
276
  payload = {
275
277
  name: name,
276
278
  subject: subject,
277
279
  html: html,
278
- text: text
280
+ text: text,
281
+ preheader: preheader,
282
+ amp_html: amp_html
279
283
  }
280
284
 
281
285
  endpoint = "templates/#{template_id}/versions/#{version_id}"
282
286
  SendWithUs::ApiRequest.new(@configuration).put(endpoint, payload.to_json)
283
287
  end
284
288
 
285
- def create_template_version(template_id, name, subject, html, text)
289
+ def create_template_version(template_id, name, subject, html, text, preheader='', amp_html='')
286
290
  payload = {
287
291
  name: name,
288
292
  subject: subject,
289
293
  html: html,
290
- text: text
294
+ text: text,
295
+ preheader: preheader,
296
+ amp_html: amp_html
291
297
  }
292
298
 
293
299
  endpoint = "templates/#{template_id}/versions"
@@ -1,3 +1,3 @@
1
1
  module SendWithUs
2
- VERSION = '4.2.1'
2
+ VERSION = '4.3.0'
3
3
  end
@@ -19,7 +19,9 @@ class TestApiRequest < Minitest::Test
19
19
  :html => '<html><head></head><body>TEST</body></html>',
20
20
  :subject => 'A test template',
21
21
  :name => 'Test Template '.concat(Random.new.rand(100000).to_s),
22
- :id => 'test_fixture_1'
22
+ :id => 'test_fixture_1',
23
+ :preheader => 'Test preheader',
24
+ :amp_html => '<html><head></head><body>AMP HTML</body></html>'
23
25
  }
24
26
  end
25
27
 
@@ -78,7 +80,7 @@ class TestApiRequest < Minitest::Test
78
80
  invalid_payload = {
79
81
  template_id: @template[:id],
80
82
  recipient: {name: 'Ruby Unit Test', address: 'stéve@sendwithus.com'}
81
- }.to_json
83
+ }.to_json
82
84
  assert_raises( SendWithUs::ApiBadRequest) { @request.post(:send, invalid_payload) }
83
85
  end
84
86
 
@@ -93,7 +95,7 @@ class TestApiRequest < Minitest::Test
93
95
  bcc: [],
94
96
  files: ['README.md']
95
97
  )
96
- assert_instance_of( Net::HTTPOK, result )
98
+ assert_instance_of( Net::HTTPOK, result )
97
99
  end
98
100
 
99
101
  def test_send_email_with_file
@@ -247,6 +249,24 @@ class TestApiRequest < Minitest::Test
247
249
  assert_instance_of( Net::HTTPOK, result )
248
250
  end
249
251
 
252
+ def test_update_template_version_with_optional_fields
253
+ build_objects
254
+ version_id = get_first_template_version_id(@template[:id])
255
+
256
+ result = @api.update_template_version(
257
+ @template[:id],
258
+ version_id,
259
+ @template[:name],
260
+ @template[:subject],
261
+ @template[:html],
262
+ 'sample text payload',
263
+ preheader=@template[:preheader],
264
+ amp_html=@template[:amp_html]
265
+ )
266
+
267
+ assert_instance_of( Net::HTTPOK, result )
268
+ end
269
+
250
270
  def test_create_template_version
251
271
  build_objects
252
272
  result = @api.create_template_version(
@@ -260,6 +280,21 @@ class TestApiRequest < Minitest::Test
260
280
  assert_instance_of( Net::HTTPOK, result )
261
281
  end
262
282
 
283
+ def test_create_template_version_with_optional_fields
284
+ build_objects
285
+ result = @api.create_template_version(
286
+ @template[:id],
287
+ @template[:name],
288
+ @template[:subject],
289
+ @template[:html],
290
+ 'sample text payload',
291
+ preheader=@template[:preheader],
292
+ amp_html=@template[:amp_html]
293
+ )
294
+
295
+ assert_instance_of( Net::HTTPOK, result )
296
+ end
297
+
263
298
  def test_delete_template
264
299
  build_objects
265
300
  template = JSON.parse @api.create_template(
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: send_with_us
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.1
4
+ version: 4.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Harris
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2020-03-26 00:00:00.000000000 Z
15
+ date: 2022-07-19 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rake
@@ -109,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  requirements: []
112
- rubygems_version: 3.0.6
112
+ rubygems_version: 3.0.3.1
113
113
  signing_key:
114
114
  specification_version: 4
115
115
  summary: SendWithUs.com Ruby Client