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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9bff74466afd78d598eeb38f3b23283337a17e0b5a8b92b0e26f845f0bb8911a
|
4
|
+
data.tar.gz: e4f9e670080defcc68b180349aff8fd16b5de911bfc2951a97032f57a5a3400e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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
|
37
|
-
ACTION_AUTORESPOND
|
38
|
-
|
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.
|
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-
|
11
|
+
date: 2025-01-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ahoy_matey
|