heya 0.4.0 → 0.5.3

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: 1df7378738941dc37dce872a4365c3b97f03e0f53ee9e89854367e73fad24efb
4
- data.tar.gz: cae2fde9c57c5a6a1aacf22d9b2f9256fb5a49a1eb0aaed0ac5a6647b6f60249
3
+ metadata.gz: 971ee7f9d958554bbed7093180fd8af86e12f24c00a526be4e0361ab07657fe3
4
+ data.tar.gz: f0d0f2e54f9bea9f93f095a14f19844213347989f19b881e30fa3f46cc76825c
5
5
  SHA512:
6
- metadata.gz: 74e3bd2771b93945877b05af5a09cde7a7ea7ccd2f0d51f90c141d85387a3e093c63f6a72baa1e2c8038a49a3a9b5cdfb9ed4c9326d2e684ca2333804f43ec4c
7
- data.tar.gz: a04b7890247085d044d56af4774f7d208d169fce32a61921c8162d2dde7a244a7235c828234fec04a44dcb599e9a2bc33332beec909617f3395dec6606ff4507
6
+ metadata.gz: b8da212577467f530326619471c1deb418bb71ed7109a105c47005a409ce008e1c211baa5e2e6b718dbda009efae940d282ddfb0b151d9ddb951c4dc732728a8
7
+ data.tar.gz: a6d53345cde9565b492dd7a99621db3e5762c1fd2ae8af8e565c3b69b19d887561dbb7fba32fafb74c7500c29e249e3e9f96ceb664e69cb8e5521f6693a5ae79
data/CHANGELOG.md CHANGED
@@ -5,6 +5,20 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
7
  ## [Unreleased]
8
+ ### Added
9
+ - Create `bcc:` optional parameter for steps; use case is quality control
10
+
11
+ ## [0.5.2] - 2021-08-11
12
+ ### Fixed
13
+ - Fix typo in initializer (#139, @800a7b32)
14
+
15
+ ## [0.5.1] - 2021-07-13
16
+ ### Fixed
17
+ - 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)
18
+
19
+ ## [0.5.0] - 2021-06-17
20
+ ### Added
21
+ - Create `@campaign_name` instance var accessible in email templates (#135)
8
22
 
9
23
  ## [0.4.0] - 2021-02-04
10
24
  ### Changed
data/README.md CHANGED
@@ -266,6 +266,28 @@ class OnboardingCampaign < ApplicationCampaign
266
266
  end
267
267
  ```
268
268
 
269
+ #### Quality control option
270
+
271
+ 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
272
+ 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:
273
+
274
+ ```ruby
275
+ class OnboardingCampaign < ApplicationCampaign
276
+ default wait: 1.day,
277
+ queue: "onboarding",
278
+ from: "support@example.com"
279
+
280
+ # Will still be sent after one day from the
281
+ # email address support@example.com
282
+ step :welcome,
283
+ subject: "Welcome to my app!"
284
+
285
+ step :added_two_months_later,
286
+ subject: "We now have something new to say!",
287
+ bcc: 'quality_control@example.com'
288
+ end
289
+ ```
290
+
269
291
  #### Customizing email subjects for each user
270
292
 
271
293
  The subject can be customized for each user by using a `lambda` instead of a `String`:
@@ -10,6 +10,7 @@ module Heya
10
10
  step_name = step.name.underscore
11
11
 
12
12
  from = step.params.fetch("from")
13
+ bcc = step.params.fetch("bcc", nil)
13
14
  reply_to = step.params.fetch("reply_to", nil)
14
15
 
15
16
  subject = step.params.fetch("subject") {
@@ -18,9 +19,11 @@ module Heya
18
19
  subject = subject.call(user) if subject.respond_to?(:call)
19
20
 
20
21
  instance_variable_set(:"@#{user.model_name.element}", user)
22
+ instance_variable_set(:@campaign_name, campaign_name)
21
23
 
22
24
  mail(
23
25
  from: from,
26
+ bcc: bcc,
24
27
  reply_to: reply_to,
25
28
  to: user.email,
26
29
  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]
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.4.0"
4
+ VERSION = "0.5.3"
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.4.0
4
+ version: 0.5.3
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-02-05 00:00:00.000000000 Z
11
+ date: 2021-08-18 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.1.2
134
+ rubygems_version: 3.2.3
135
135
  signing_key:
136
136
  specification_version: 4
137
137
  summary: "Heya \U0001F44B"