wco_models 3.1.0.190 → 3.1.0.191

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d49f77b6a2706b11084a327dcfedb56bf887ba04bf71e23f66ecff2749abc069
4
- data.tar.gz: 15bf5266b05ad0116ff87266d7f242dc840b9b773c668d37dcda649e13528a0b
3
+ metadata.gz: 9bff74466afd78d598eeb38f3b23283337a17e0b5a8b92b0e26f845f0bb8911a
4
+ data.tar.gz: e4f9e670080defcc68b180349aff8fd16b5de911bfc2951a97032f57a5a3400e
5
5
  SHA512:
6
- metadata.gz: daf54c6e2d1b5c220eaadc56aa00a8b185b2f635fdb5960de233d7b8c39d788abc7b15c10eea0d7b174a0219608e64a606f1d2a44e71e79828264f093fd371d0
7
- data.tar.gz: 96ab243124e389910b3d19a0e007d711d8300fcb80960411f3141b436af760a7c6d5e8c2fa3715c8b91caa0ee47ea8aace500582012f849b6b988c433ab58bd7
6
+ metadata.gz: 2aa5e46bf8e08e735d816278ecc948d47e99cd70e7c85e8d17bf7a7f196310c6096f12a14fd9d03158f426025580cec2648995c4325ff21bfe0940193f35ce73
7
+ data.tar.gz: d59c6bd87089bbb5a3ac0092a365696cf0d0fde26c2eb2573f00a1b6bc304ba53b2ef96a45ffa8212ef43b17ac7a0c13fa8d9d4c0c464454ccc42c18f2bc2cc4
@@ -23,6 +23,12 @@ class WcoEmail::EmailFilter
23
23
 
24
24
  has_many :actions, class_name: '::WcoEmail::EmailFilterAction', inverse_of: :email_filter
25
25
  accepts_nested_attributes_for :actions, allow_destroy: true
26
+ validate :validate_actions
27
+ def validate_actions
28
+ if actions.length == 0
29
+ errors.add(:actions, 'must be present')
30
+ end
31
+ end
26
32
 
27
33
  ## 'and' - all conditions must match, for filter to match
28
34
  has_many :conditions, class_name: '::WcoEmail::EmailFilterCondition', inverse_of: :email_filter
@@ -31,7 +37,12 @@ class WcoEmail::EmailFilter
31
37
  ## 'and' - all conditions must match, for filter to match
32
38
  has_many :skip_conditions, class_name: '::WcoEmail::EmailFilterCondition', inverse_of: :email_skip_filter
33
39
  accepts_nested_attributes_for :skip_conditions, allow_destroy: true
34
-
40
+ validate :validate_conditions
41
+ def validate_conditions
42
+ if conditions.length + skip_conditions.length == 0
43
+ errors.add(:conditions, 'Either conditions or skip conditions must be present.')
44
+ end
45
+ end
35
46
 
36
47
  has_and_belongs_to_many :action_tmpls, class_name: '::Wco::OfficeActionTemplate'
37
48
  has_and_belongs_to_many :leadsets, class_name: '::Wco::Leadset'
@@ -13,6 +13,7 @@ class WcoEmail::EmailFilterAction
13
13
  KIND_SCHEDULE_EMAIL_ACTION = 'autorespond-email-action'
14
14
  KIND_REMOVE_EMAIL_ACTION = 'remove-email-action'
15
15
  field :kind
16
+ validates :kind, inclusion: ::WcoEmail::ACTIONS
16
17
 
17
18
  field :value # the id of a tag, or email template, or email action
18
19
 
@@ -12,11 +12,8 @@ class WcoEmail::EmailFilterCondition
12
12
  field :field
13
13
  validates :field, presence: true
14
14
 
15
- OPERATOR_EQUALS = WcoEmail::OPERATOR_EQUALS
16
- OPERATOR_HAS_TAG = WcoEmail::OPERATOR_HAS_TAG
17
- OPERATOR_NOT_HAS_TAG = WcoEmail::OPERATOR_NOT_HAS_TAG
18
15
  field :operator, type: String
19
- validates :operator, presence: true
16
+ validates :operator, presence: true, inclusion: ::WcoEmail::OPERATORS
20
17
 
21
18
  field :value
22
19
  validates :value, presence: true
@@ -33,11 +30,3 @@ class WcoEmail::EmailFilterCondition
33
30
  end
34
31
  end
35
32
 
36
- =begin
37
-
38
- ## not whitelisted
39
- tag = Wco::Tag.find_by({ slug: 'known-leadsets' })
40
- out = @company.tags.include?( tag )
41
- !out
42
-
43
- =end
@@ -210,6 +210,10 @@ class WcoEmail::MessageStub
210
210
  reason = "condition leadset not-has-tag #{this_tag} NOT met"
211
211
  end
212
212
  end
213
+ when WcoEmail::FIELD_TO
214
+ if @message.to == cond.value
215
+ reason = "condition to = #{cond.value}"
216
+ end
213
217
  end
214
218
  end
215
219
 
data/lib/wco_models.rb CHANGED
@@ -33,9 +33,13 @@ STATUSES = [ nil, ACTIVE, INACTIVE ]
33
33
  module Wco; end
34
34
 
35
35
  module WcoEmail
36
- ACTION_ADD_TAG = 'add-tag'
37
- ACTION_AUTORESPOND = 'autorespond-template'
38
- ACTION_REMOVE_TAG = 'remove-tag'
36
+ ACTION_ADD_TAG = 'add-tag'
37
+ ACTION_AUTORESPOND = 'autorespond-template'
38
+ ACTION_EXE = 'exe'
39
+ ACTION_SCHEDULE_EMAIL_ACTION = 'autorespond-email-action'
40
+ ACTION_REMOVE_EMAIL_ACTION = 'remove-email-action'
41
+ ACTION_REMOVE_TAG = 'remove-tag'
42
+ ACTIONS = [ 'add-tag', 'autorespond-email-action', 'autorespond-template', 'exe', 'remove-email-action', 'remove-tag' ]
39
43
 
40
44
  FIELD_BODY = 'body'
41
45
  FIELD_EXE = 'exe'
@@ -47,6 +51,8 @@ module WcoEmail
47
51
  OPERATOR_EQUALS = 'equals'
48
52
  OPERATOR_HAS_TAG = 'has-tag'
49
53
  OPERATOR_NOT_HAS_TAG = 'not-has-tag'
54
+ OPERATOR_TEXT_INPUT = 'text-input'
55
+ OPERATORS = [ 'equals', 'has-tag', 'not-has-tag', 'text-input' ]
50
56
  end
51
57
 
52
58
  module WcoHosting; end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wco_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0.190
4
+ version: 3.1.0.191
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Pudeyev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-01-20 00:00:00.000000000 Z
11
+ date: 2025-01-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ahoy_matey