txbr 2.6.1 → 2.7.0.beta1

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: '0568f2b13442d1b261faf8bb8b617b43eec292b21bacb209d0d0089dec986856'
4
- data.tar.gz: fc0d22c2387afd76d9901ff1d3543ff7781b3eb63486634ef57b606ce24b706f
3
+ metadata.gz: 8c63183e62bd2aaa9a8434e72b5854edec9e29c812e131ab9e336a2a09a4ea6f
4
+ data.tar.gz: 1acfb773d480779de720ced8dbce69875078a0c0819552f4050e72cbc7ee63e7
5
5
  SHA512:
6
- metadata.gz: ba0fe6310e773239d610e3ddc7053210108947318f787c2e4b37b97b144844b6b9c1d0edba846a1c763d0125afecf79436911cd93e8ebc20e82c0db0d714a2f0
7
- data.tar.gz: c0bcdedf0d9175df3a143a741db768c568c13f78696731d1646a1fa9d3bfefcf5c606e17313803c282d217775ae5b8d1257c9c4b125c344f4e950b634186e96c
6
+ metadata.gz: 11d69ec4a43e927b5950f1845b3d4ad933a81874de4fabd58d8675b947a364e8b2d5c195e0c3f9922e8a64ac4f83958cbe9ad3e2ae26786c2b0b43eda6e20954
7
+ data.tar.gz: ce30749079710297838a4c9f6477acad93ee4465034c70abbdb8b9d69d0f6d558590f26e6c9198de0e195102aa801313961c4bb4087231691b932c30b44d5e5b
data/lib/txbr/campaign.rb CHANGED
@@ -7,9 +7,10 @@ module Txbr
7
7
 
8
8
  attr_reader :project, :campaign_id
9
9
 
10
- def initialize(project, campaign_id)
10
+ def initialize(project, campaign_data)
11
11
  @project = project
12
- @campaign_id = campaign_id
12
+ @campaign_data = campaign_data
13
+ @campaign_id = campaign_data['id']
13
14
  end
14
15
 
15
16
  def each_resource(&block)
@@ -21,7 +22,8 @@ module Txbr
21
22
  @metadata ||= {
22
23
  item_type: ITEM_TYPE,
23
24
  campaign_name: campaign_name,
24
- campaign_id: campaign_id
25
+ campaign_id: campaign_id,
26
+ last_edited: last_edited
25
27
  }
26
28
  rescue => e
27
29
  {}
@@ -35,6 +37,12 @@ module Txbr
35
37
 
36
38
  private
37
39
 
40
+ attr_reader :campaign_data
41
+
42
+ def last_edited
43
+ campaign_data['last_edited']
44
+ end
45
+
38
46
  def template_group
39
47
  @template_group ||= TemplateGroup.new(campaign_name, templates, project)
40
48
  end
@@ -14,8 +14,8 @@ module Txbr
14
14
  def each_campaign
15
15
  return to_enum(__method__) unless block_given?
16
16
 
17
- project.braze_api.campaigns.each do |campaign|
18
- yield Campaign.new(project, campaign['id'])
17
+ project.braze_api.campaigns.each do |campaign_data|
18
+ yield Campaign.new(project, campaign_data)
19
19
  end
20
20
  end
21
21
 
@@ -8,9 +8,10 @@ module Txbr
8
8
 
9
9
  attr_reader :project, :email_template_id
10
10
 
11
- def initialize(project, email_template_id)
11
+ def initialize(project, tmpl_data)
12
12
  @project = project
13
- @email_template_id = email_template_id
13
+ @tmpl_data = tmpl_data
14
+ @email_template_id = tmpl_data['email_template_id']
14
15
  end
15
16
 
16
17
  def each_resource(&block)
@@ -22,7 +23,8 @@ module Txbr
22
23
  @metadata ||= {
23
24
  item_type: ITEM_TYPE,
24
25
  template_name: template_name,
25
- template_id: email_template_id
26
+ template_id: email_template_id,
27
+ last_edited: last_edited
26
28
  }
27
29
  rescue => e
28
30
  {}
@@ -30,6 +32,12 @@ module Txbr
30
32
 
31
33
  private
32
34
 
35
+ attr_reader :tmpl_data
36
+
37
+ def last_edited
38
+ tmpl_data['updated_at']
39
+ end
40
+
33
41
  def template_group
34
42
  @template_group ||= TemplateGroup.new(template_name, templates, project)
35
43
  end
@@ -17,8 +17,8 @@ module Txbr
17
17
  def each_template
18
18
  return to_enum(__method__) unless block_given?
19
19
 
20
- project.braze_api.email_templates.each do |tmpl|
21
- yield EmailTemplate.new(project, tmpl['email_template_id'])
20
+ project.braze_api.email_templates.each do |tmpl_data|
21
+ yield EmailTemplate.new(project, tmpl_data)
22
22
  end
23
23
  end
24
24
 
data/lib/txbr/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Txbr
2
- VERSION = '2.6.1'
2
+ VERSION = '2.7.0.beta1'
3
3
  end
@@ -6,7 +6,9 @@ describe Txbr::Campaign do
6
6
  include_context 'standard setup'
7
7
 
8
8
  let(:campaign_id) { 'abc123' }
9
- let(:campaign) { described_class.new(project, campaign_id) }
9
+ let(:last_edited) { '2021-03-18T16:20:57+00:00' }
10
+ let(:campaign_data) { Hash['id', campaign_id, 'last_edited', last_edited] }
11
+ let(:campaign) { described_class.new(project, campaign_data) }
10
12
 
11
13
  let(:first_message) do
12
14
  <<~MESSAGE
@@ -154,7 +156,8 @@ describe Txbr::Campaign do
154
156
  expect(campaign.metadata).to eq(
155
157
  item_type: 'campaign',
156
158
  campaign_name: 'World Domination',
157
- campaign_id: campaign_id
159
+ campaign_id: campaign_id,
160
+ last_edited: last_edited
158
161
  )
159
162
  end
160
163
  end
@@ -6,7 +6,9 @@ describe Txbr::EmailTemplate do
6
6
  include_context 'standard setup'
7
7
 
8
8
  let(:email_template_id) { 'abc123' }
9
- let(:email_template) { described_class.new(project, email_template_id) }
9
+ let(:last_edited) { '2021-03-18T16:20:57+00:00' }
10
+ let(:tmpl_data) { Hash['email_template_id', email_template_id, 'updated_at', last_edited] }
11
+ let(:email_template) { described_class.new(project, tmpl_data) }
10
12
 
11
13
  let(:body_html) do
12
14
  <<~HTML
@@ -182,7 +184,8 @@ describe Txbr::EmailTemplate do
182
184
  expect(email_template.metadata).to eq(
183
185
  item_type: 'email_template',
184
186
  template_name: 'Super Slick Awesome',
185
- template_id: email_template_id
187
+ template_id: email_template_id,
188
+ last_edited: last_edited
186
189
  )
187
190
  end
188
191
  end
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.6.1
4
+ version: 2.7.0.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cameron Dutro
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-02 00:00:00.000000000 Z
11
+ date: 2021-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: abroad
@@ -173,9 +173,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
173
173
  version: '0'
174
174
  required_rubygems_version: !ruby/object:Gem::Requirement
175
175
  requirements:
176
- - - ">="
176
+ - - ">"
177
177
  - !ruby/object:Gem::Version
178
- version: '0'
178
+ version: 1.3.1
179
179
  requirements: []
180
180
  rubygems_version: 3.2.7
181
181
  signing_key: