txbr 2.1.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/txbr/campaign.rb +12 -3
- data/lib/txbr/email_template.rb +3 -1
- data/lib/txbr/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54bd17f12c9d7f51fd795daeaee77e5b52788eb2df7a12a67f820c92b7087ff1
|
4
|
+
data.tar.gz: c6fdf92e84a6cf7819ed9867734ea864e9218fe3b740e611467383b6a4e84d6f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c28f62cf64f3787a2b4a595eb161061c1935363503932f3783d5bc08f738ea5df5cbf25aa58a0230b361f6b95906fd705d71a45ccc5e481c150c25f0cd41c6ae
|
7
|
+
data.tar.gz: 6c02c0871a2575b8c2263b822691f784ce6d623c9dd11c79340960a16b60fe3a8bb21799dbfc39844b2ca93cb7fa466365deaa2a842b1dbd37aee158998e01aa
|
data/lib/txbr/campaign.rb
CHANGED
@@ -2,6 +2,8 @@ require 'liquid'
|
|
2
2
|
|
3
3
|
module Txbr
|
4
4
|
class Campaign
|
5
|
+
TEMPLATE_KEYS = %w(body subject preheader message alert).freeze
|
6
|
+
|
5
7
|
attr_reader :project, :campaign_id
|
6
8
|
|
7
9
|
def initialize(project, campaign_id)
|
@@ -21,9 +23,16 @@ module Txbr
|
|
21
23
|
end
|
22
24
|
|
23
25
|
def templates
|
24
|
-
details['messages'].
|
25
|
-
|
26
|
-
|
26
|
+
details['messages'].flat_map do |message_id, props|
|
27
|
+
TEMPLATE_KEYS.each_with_object([]) do |key, ret|
|
28
|
+
begin
|
29
|
+
if message = props[key]
|
30
|
+
ret << Txbr::Template.new(message_id, ::Liquid::Template.parse(message))
|
31
|
+
end
|
32
|
+
rescue ::Liquid::SyntaxError => e
|
33
|
+
Txgh.events.publish_error!(e)
|
34
|
+
end
|
35
|
+
end
|
27
36
|
end
|
28
37
|
end
|
29
38
|
|
data/lib/txbr/email_template.rb
CHANGED
@@ -3,6 +3,8 @@ require 'txgh'
|
|
3
3
|
|
4
4
|
module Txbr
|
5
5
|
class EmailTemplate
|
6
|
+
TEMPLATE_KEYS = %w(body subject preheader).freeze
|
7
|
+
|
6
8
|
attr_reader :project, :email_template_id
|
7
9
|
|
8
10
|
def initialize(project, email_template_id)
|
@@ -22,7 +24,7 @@ module Txbr
|
|
22
24
|
end
|
23
25
|
|
24
26
|
def templates
|
25
|
-
|
27
|
+
TEMPLATE_KEYS.each_with_object([]) do |name, ret|
|
26
28
|
begin
|
27
29
|
liquid_tmpl = ::Liquid::Template.parse(details[name])
|
28
30
|
ret << Txbr::Template.new(email_template_id, liquid_tmpl)
|
data/lib/txbr/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: txbr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cameron Dutro
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: abroad
|
@@ -175,8 +175,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
175
175
|
- !ruby/object:Gem::Version
|
176
176
|
version: '0'
|
177
177
|
requirements: []
|
178
|
-
|
179
|
-
rubygems_version: 2.7.6
|
178
|
+
rubygems_version: 3.0.4
|
180
179
|
signing_key:
|
181
180
|
specification_version: 4
|
182
181
|
summary: A library for syncing translation resources between Braze and Transifex.
|