send_with_us 4.4.0 → 4.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f67c0ceffafb13f25e0f582159853931f7ad80cb021c49839d42f3fe950057f9
4
- data.tar.gz: fc33de35c98767fef56a58837cd00d80c8a9490e37fb90c7a7ad241854377585
3
+ metadata.gz: 2efa88c6d66849b570afab41c19bca7aa13099c84a38ef9a24a3dfc2f0129de7
4
+ data.tar.gz: a879b26e74f4b57424660bd781d120ed69c59e6da63b20cb7d1b3e6fb9a62028
5
5
  SHA512:
6
- metadata.gz: 247e986c2ed5785fd6c5a719448a57da298056a00ac6a41eb4f44813931456c749856e1ff0b026ad12225483ba4c3a70a8bfb20f7e9cd8209a1bba340919e60f
7
- data.tar.gz: 1ea7ae022f32cae2ceb89da6828d3978540218f9a9a02fce7faa7fe5752ac54fa6c0ff8e6cd5977c65cb2408a9a700b319b09cd7ef7684150712fe10d6fa204c
6
+ metadata.gz: df2241902f8d3a830e460ff00a63bfdfd5e017dd37beec40b4db341c6f297bce6f0e63a88e03acf08f4cfcac26638b35550d48a155a1d312d577f4e1e8ea8a44
7
+ data.tar.gz: b90c377b6cdcec73eefb344af32270ef77afc81afba310ff73423bc61208d7d78f1ee68748adc4b3330c5379fb3888b041eb5a25a18dbb12817b79c22efb5be5
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 4.5.0
2
+ - Add optional `template_data` fields to template calls
3
+
1
4
  ## 4.4.0
2
5
  - **[#88](https://github.com/sendwithus/sendwithus_ruby/pull/88) Fix problematic `render` implementation.** `template_data` serves two purposes, defining template data and specifying the optional API parameter for `locale`. Previously, `locale` would be stripped out of `template_data` in the API request, preventing users from specifying variables named `locale` in their own template data.
3
6
 
@@ -160,14 +160,15 @@ module SendWithUs
160
160
  SendWithUs::ApiRequest.new(@configuration).post(:'render', payload)
161
161
  end
162
162
 
163
- def create_template(name, subject, html, text, preheader='', amp_html='')
163
+ def create_template(name, subject, html, text, preheader='', amp_html='', template_data={})
164
164
  payload = {
165
165
  name: name,
166
166
  subject: subject,
167
167
  html: html,
168
168
  text: text,
169
169
  preheader: preheader,
170
- amp_html: amp_html
170
+ amp_html: amp_html,
171
+ template_data: template_data
171
172
  }
172
173
 
173
174
  payload = payload.to_json
@@ -272,28 +273,30 @@ module SendWithUs
272
273
  SendWithUs::ApiRequest.new(@configuration).get(endpoint)
273
274
  end
274
275
 
275
- def update_template_version(template_id, version_id, name, subject, html, text, preheader='', amp_html='')
276
+ def update_template_version(template_id, version_id, name, subject, html, text, preheader='', amp_html='', template_data={})
276
277
  payload = {
277
278
  name: name,
278
279
  subject: subject,
279
280
  html: html,
280
281
  text: text,
281
282
  preheader: preheader,
282
- amp_html: amp_html
283
+ amp_html: amp_html,
284
+ template_data: template_data
283
285
  }
284
286
 
285
287
  endpoint = "templates/#{template_id}/versions/#{version_id}"
286
288
  SendWithUs::ApiRequest.new(@configuration).put(endpoint, payload.to_json)
287
289
  end
288
290
 
289
- def create_template_version(template_id, name, subject, html, text, preheader='', amp_html='')
291
+ def create_template_version(template_id, name, subject, html, text, preheader='', amp_html='', template_data={})
290
292
  payload = {
291
293
  name: name,
292
294
  subject: subject,
293
295
  html: html,
294
296
  text: text,
295
297
  preheader: preheader,
296
- amp_html: amp_html
298
+ amp_html: amp_html,
299
+ template_data: template_data
297
300
  }
298
301
 
299
302
  endpoint = "templates/#{template_id}/versions"
@@ -1,3 +1,3 @@
1
1
  module SendWithUs
2
- VERSION = '4.4.0'
2
+ VERSION = '4.5.0'
3
3
  end
@@ -21,7 +21,8 @@ class TestApiRequest < Minitest::Test
21
21
  :name => 'Test Template '.concat(Random.new.rand(100000).to_s),
22
22
  :id => 'test_fixture_1',
23
23
  :preheader => 'Test preheader',
24
- :amp_html => '<html><head></head><body>AMP HTML</body></html>'
24
+ :amp_html => '<html><head></head><body>AMP HTML</body></html>',
25
+ :template_data => {data: 'I AM DATA'}
25
26
  }
26
27
  end
27
28
 
@@ -261,7 +262,8 @@ class TestApiRequest < Minitest::Test
261
262
  @template[:html],
262
263
  'sample text payload',
263
264
  preheader=@template[:preheader],
264
- amp_html=@template[:amp_html]
265
+ amp_html=@template[:amp_html],
266
+ template_data=@template[:template_data]
265
267
  )
266
268
 
267
269
  assert_instance_of( Net::HTTPOK, result )
@@ -289,7 +291,8 @@ class TestApiRequest < Minitest::Test
289
291
  @template[:html],
290
292
  'sample text payload',
291
293
  preheader=@template[:preheader],
292
- amp_html=@template[:amp_html]
294
+ amp_html=@template[:amp_html],
295
+ template_data=@template[:template_data]
293
296
  )
294
297
 
295
298
  assert_instance_of( Net::HTTPOK, result )
data/test/test_helper.rb CHANGED
@@ -5,6 +5,7 @@ require File.expand_path('../../lib/send_with_us.rb', __FILE__)
5
5
 
6
6
  require 'rubygems'
7
7
  require 'bundler'
8
+ MiniTest = Minitest unless defined?(MiniTest)
8
9
  require "mocha/minitest"
9
10
 
10
11
  begin
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.4.0
4
+ version: 4.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Harris
@@ -9,10 +9,10 @@ authors:
9
9
  - Nicholas Rempel
10
10
  - Gregory Schier
11
11
  - Brad Van Vugt
12
- autorequire:
12
+ autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 1980-01-01 00:00:00.000000000 Z
15
+ date: 2025-06-05 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rake
@@ -94,7 +94,7 @@ homepage: https://github.com/sendwithus/sendwithus_ruby
94
94
  licenses:
95
95
  - Apache-2.0
96
96
  metadata: {}
97
- post_install_message:
97
+ post_install_message:
98
98
  rdoc_options: []
99
99
  require_paths:
100
100
  - lib
@@ -109,8 +109,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  requirements: []
112
- rubygems_version: 3.2.26
113
- signing_key:
112
+ rubygems_version: 3.3.5
113
+ signing_key:
114
114
  specification_version: 4
115
115
  summary: SendWithUs.com Ruby Client
116
116
  test_files: