send_with_us 4.2.1 → 4.3.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 +4 -4
- data/CHANGELOG.md +4 -1
- data/lib/send_with_us/api.rb +13 -7
- data/lib/send_with_us/version.rb +1 -1
- data/test/lib/send_with_us/api_request_test.rb +38 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6a246f1dd54a758295eb1b9ac7fd0d98daa6d0e5f7ffd7f6fa9a0216025ea79
|
4
|
+
data.tar.gz: 8cd25be4990e4c71b1670c9f6e643df17bf959503f51856c158b94e050d26ed6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/send_with_us/api.rb
CHANGED
@@ -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"
|
data/lib/send_with_us/version.rb
CHANGED
@@ -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.
|
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:
|
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.
|
112
|
+
rubygems_version: 3.0.3.1
|
113
113
|
signing_key:
|
114
114
|
specification_version: 4
|
115
115
|
summary: SendWithUs.com Ruby Client
|