wco_models 3.1.0.190 → 3.1.0.192
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dbba6285ae64aa8c8bd1dbebcf4316b2ecb2e7d81f2143220d6e2d00e2b8833b
|
4
|
+
data.tar.gz: 7fe94b7db4a4f1147c0634bfdbb772cb07295870a1bdec024c855eca46e7996f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 194d52d31e7fc74009341a9d64008515b4510d0f804542308cb28d11617c41765ee536d683149a9dc412d26770ba17a805ca5feb89b509a59053565e617c599e
|
7
|
+
data.tar.gz: 12e385987d60859fc429da32d697d7bd7dcd2c0e8fe37855b389e3b3bcafd6903e57816efe42accad974e8f6edd0b25a6709b0a14a6282d2661ce8ec5fc68d33
|
@@ -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.192
|
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
|