heya 0.5.0 → 0.6.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: 8aca23a8fecadfe7dbaef4abe9b38e8e1ec3d12f1caeff8d87fcf6d088b53f1b
4
- data.tar.gz: a0dbebd018ae387f35658a8a87d31a358de7f98a0f66229d32d392fac81cacb7
3
+ metadata.gz: 6fd230aff6fc53ebfb1af3093b01c96b7c0480e0d67d6a3dee3ebb970009726d
4
+ data.tar.gz: 06aa85033434dfc827a6b341002c7da4e9f172340da0a2ff713e75085c1bffeb
5
5
  SHA512:
6
- metadata.gz: 8f834ac3755b014a0535598b9059ea84bfadf40e0f0c3d3ceb86876d46b78389984ba508ef07a91e84c9f6a8ddbe27074dab4fa7462f5d52c8b76577f0fa7302
7
- data.tar.gz: d468061ee32fe90aab855e8231314100cea6cf17aa31ab68d608c8f28e98c7c95fce72a4a1924ba87ce1fed2f6e4e0c3079df9ffdb701ec9eb3df6303fa24a85
6
+ metadata.gz: a044d5ade5c1cc36367a486982afa4e522f3c83407d86df71058176c5406d8e3901aaf420a70866b3146f71edf4af8dd4ac204bf5446b47d613ec5aa3163bc93
7
+ data.tar.gz: 2820502a0d9a141df3ac428d71aba1768576e90e56cd1e5b58fe7cfe970a5413409bf9e95a9c0decfbd73066a8d13ebfe12c6b6ee759b172c35ae460bf46afdc
data/CHANGELOG.md CHANGED
@@ -6,6 +6,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
  ### Added
9
+ - Optional `layout` parameter for steps; allowing override from default `heya/campaign_mailer`
10
+
11
+ ## [0.5.3] - 2021-08-18
12
+ ### Added
13
+ - Create `bcc:` optional parameter for steps; use case is quality control
14
+
15
+ ## [0.5.2] - 2021-08-11
16
+ ### Fixed
17
+ - Fix typo in initializer (#139, @800a7b32)
18
+
19
+ ## [0.5.1] - 2021-07-13
20
+ ### Fixed
21
+ - Fix compatibility with Rails 6.1.4 (introduced by [this change](https://github.com/rails/rails/commit/99049262d37fedcd25af91231423103b0d218694#diff-79b53b2602bf702bdd8ce677e096be6a6923a54236e17237c16068a510078683) to `build_arel`) (#137, @retsef)
22
+
23
+ ## [0.5.0] - 2021-06-17
24
+ ### Added
9
25
  - Create `@campaign_name` instance var accessible in email templates (#135)
10
26
 
11
27
  ## [0.4.0] - 2021-02-04
data/README.md CHANGED
@@ -250,9 +250,29 @@ Heya uses the following additional options to build the message itself:
250
250
  | :---------- | :----------- | :------------------------- |
251
251
  | `subject` | **required** | The email's subject |
252
252
  | `from` | Heya default | The sender's email address |
253
+ | `layout` | Heya default | The email's layout file |
253
254
 
254
255
  You can change the default options using the `default` method at the top of the campaign. Heya applies default options to each step which doesn't supply its own:
255
256
 
257
+ ```ruby
258
+ class OnboardingCampaign < ApplicationCampaign
259
+ default wait: 1.day,
260
+ queue: "onboarding",
261
+ from: "support@example.com",
262
+ layout: "onboarding"
263
+
264
+ # Will still be sent after one day from the
265
+ # email address support@example.com
266
+ step :welcome,
267
+ subject: "Welcome to my app!"
268
+ end
269
+ ```
270
+
271
+ #### Quality control option
272
+
273
+ You may wish to apply quality control to individual steps of a campaign. For example, when adding a new step to an existing campaign it is
274
+ a good idea to inspect real-time results in production. You can do this by using the `bcc:` step option, which would look like this:
275
+
256
276
  ```ruby
257
277
  class OnboardingCampaign < ApplicationCampaign
258
278
  default wait: 1.day,
@@ -263,6 +283,10 @@ class OnboardingCampaign < ApplicationCampaign
263
283
  # email address support@example.com
264
284
  step :welcome,
265
285
  subject: "Welcome to my app!"
286
+
287
+ step :added_two_months_later,
288
+ subject: "We now have something new to say!",
289
+ bcc: 'quality_control@example.com'
266
290
  end
267
291
  ```
268
292
 
@@ -1,6 +1,7 @@
1
1
  module Heya
2
2
  class CampaignMailer < ApplicationMailer
3
- layout "heya/campaign_mailer"
3
+ DEFAULT_LAYOUT = "heya/campaign_mailer"
4
+ layout -> { params.fetch(:step).params.fetch("layout", DEFAULT_LAYOUT) }
4
5
 
5
6
  def build
6
7
  user = params.fetch(:user)
@@ -10,6 +11,7 @@ module Heya
10
11
  step_name = step.name.underscore
11
12
 
12
13
  from = step.params.fetch("from")
14
+ bcc = step.params.fetch("bcc", nil)
13
15
  reply_to = step.params.fetch("reply_to", nil)
14
16
 
15
17
  subject = step.params.fetch("subject") {
@@ -22,6 +24,7 @@ module Heya
22
24
 
23
25
  mail(
24
26
  from: from,
27
+ bcc: bcc,
25
28
  reply_to: reply_to,
26
29
  to: user.email,
27
30
  subject: subject,
@@ -8,7 +8,7 @@ Heya.configure do |config|
8
8
  # Campaign priority. When a user is added to multiple campaigns, they are
9
9
  # sent in this order. Campaigns are sent in the order that the users were
10
10
  # added if no priority is configured.
11
- # config.campaings.priority = [
11
+ # config.campaigns.priority = [
12
12
  # "FirstCampaign",
13
13
  # "SecondCampaign",
14
14
  # "ThirdCampaign"
@@ -6,7 +6,7 @@ module Heya
6
6
  module ActiveRecordRelationExtension
7
7
  TABLE_REGEXP = /heya_steps/
8
8
 
9
- def build_arel(aliases)
9
+ def build_arel(aliases = nil)
10
10
  arel = super(aliases)
11
11
 
12
12
  if table_name == "heya_campaign_memberships" && arel.to_sql =~ TABLE_REGEXP
@@ -4,7 +4,7 @@ module Heya
4
4
  module Campaigns
5
5
  module Actions
6
6
  class Email < Action
7
- VALID_PARAMS = %w[subject from reply_to]
7
+ VALID_PARAMS = %w[subject from reply_to bcc layout]
8
8
 
9
9
  def self.validate_step(step)
10
10
  step.params.assert_valid_keys(VALID_PARAMS)
data/lib/heya/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Heya
4
- VERSION = "0.5.0"
4
+ VERSION = "0.6.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heya
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Wood
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-17 00:00:00.000000000 Z
11
+ date: 2021-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -131,7 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
131
  - !ruby/object:Gem::Version
132
132
  version: '0'
133
133
  requirements: []
134
- rubygems_version: 3.2.3
134
+ rubygems_version: 3.2.22
135
135
  signing_key:
136
136
  specification_version: 4
137
137
  summary: "Heya \U0001F44B"