ish_models 0.0.33.203 → 0.0.33.204
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 +4 -4
- data/lib/ish/email_context.rb +12 -39
- data/lib/ish/email_template.rb +15 -0
- data/lib/office/email_action.rb +6 -2
- data/lib/office/scheduled_email_action.rb +5 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fd65ff58860ac2afaa7c51f64095d05122b0138add7df7cbffe64d905d64aefb
|
4
|
+
data.tar.gz: 938f54cc4d112e4e205dac23db42f2621fcf560f4cb7febd8c9f61b083ff4538
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b20cdde2c6766f46c27bcee6385083ebdda9e4569101ef06f4f20dd394e6e2ee201070c4d2f59caa2d4c09f7be4565f94d4952c68ed30c7543232cc0161cfb1
|
7
|
+
data.tar.gz: 243bcc4f5c75ff33cf238552fce90b38c6e5d3fa251fb5ab018dbe1d9ca6be37927b568d574668a3966407e85e26cb3aaff98dd2204d51430769ed9fd0f5597a
|
data/lib/ish/email_context.rb
CHANGED
@@ -1,13 +1,11 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
#
|
1
|
+
##
|
2
|
+
## Send a single email
|
3
|
+
##
|
5
4
|
|
6
5
|
class ::Ish::EmailContext
|
7
6
|
include Mongoid::Document
|
8
7
|
include Mongoid::Timestamps
|
9
8
|
|
10
|
-
## @TODO: probably rename it to slug
|
11
9
|
field :slug
|
12
10
|
validates_uniqueness_of :slug, allow_nil: true
|
13
11
|
|
@@ -22,34 +20,19 @@ class ::Ish::EmailContext
|
|
22
20
|
|
23
21
|
PAGE_PARAM_NAME = 'email_contexts_page'
|
24
22
|
|
25
|
-
FROM_EMAILS = [
|
26
|
-
'Infinite Shelter <hello@infiniteshelter.com>',
|
27
|
-
'Infinite Shelter <no-reply@infiniteshelter.com>',
|
28
|
-
'Victor Piousbox <piousbox@gmail.com>',
|
29
|
-
'Victor Piousbox <victor@piousbox.com>',
|
30
|
-
'Victor Piousbox <no-reply@piousbox.com>',
|
31
|
-
'Victor Piousbox <admin@wasya.co>',
|
32
|
-
'WasyaCo Consulting <hello@wasya.co>',
|
33
|
-
'WasyaCo Consulting <no-reply@wasya.co>',
|
34
|
-
'Victor Piousbox <victor@wasya.co>',
|
35
|
-
];
|
36
23
|
field :from_email
|
37
|
-
validates_presence_of :from_email
|
38
|
-
def self.from_email_list
|
39
|
-
[ [nil, nil] ] + FROM_EMAILS.map { |i| [i, i] }
|
40
|
-
end
|
24
|
+
# validates_presence_of :from_email
|
41
25
|
|
42
26
|
field :subject
|
43
|
-
validates_presence_of :subject
|
27
|
+
# validates_presence_of :subject
|
44
28
|
|
45
29
|
field :body
|
46
30
|
|
47
31
|
belongs_to :email_template
|
48
|
-
def tmpl
|
49
|
-
email_template
|
50
|
-
end
|
32
|
+
def tmpl; email_template; end
|
51
33
|
|
52
34
|
belongs_to :scheduled_email_action, class_name: '::Office::ScheduledEmailAction', optional: true
|
35
|
+
def sch; scheduled_email_action; end
|
53
36
|
|
54
37
|
field :rendered_str
|
55
38
|
|
@@ -57,16 +40,10 @@ class ::Ish::EmailContext
|
|
57
40
|
field :send_at, type: DateTime
|
58
41
|
|
59
42
|
|
60
|
-
def self.unsent
|
61
|
-
|
62
|
-
end
|
63
|
-
def unsent
|
64
|
-
Ish::EmailContext.where( sent_at: nil )
|
65
|
-
end
|
43
|
+
def self.unsent; new.unsent; end
|
44
|
+
def unsent; Ish::EmailContext.where( sent_at: nil ); end
|
66
45
|
|
67
|
-
def self.scheduled
|
68
|
-
new.scheduled
|
69
|
-
end
|
46
|
+
def self.scheduled; new.scheduled; end
|
70
47
|
def scheduled
|
71
48
|
# or({ :send_at.lte => Time.now }, { :send_at => nil }) ## This won't work b/c I need draft state!
|
72
49
|
Ish::EmailContext.where({ :send_at.lte => Time.now })
|
@@ -74,12 +51,8 @@ class ::Ish::EmailContext
|
|
74
51
|
|
75
52
|
|
76
53
|
field :lead_id, type: :integer
|
77
|
-
def lead
|
78
|
-
|
79
|
-
end
|
80
|
-
def to_email
|
81
|
-
return lead[:email]
|
82
|
-
end
|
54
|
+
def lead; Lead.find( lead_id ); end
|
55
|
+
def to_email; lead[:email]; end
|
83
56
|
|
84
57
|
|
85
58
|
##
|
data/lib/ish/email_template.rb
CHANGED
@@ -21,7 +21,22 @@ class ::Ish::EmailTemplate
|
|
21
21
|
|
22
22
|
field :subject
|
23
23
|
field :body
|
24
|
+
|
25
|
+
FROM_EMAILS = [
|
26
|
+
'Infinite Shelter <hello@infiniteshelter.com>',
|
27
|
+
'Infinite Shelter <no-reply@infiniteshelter.com>',
|
28
|
+
'Victor Piousbox <piousbox@gmail.com>',
|
29
|
+
'Victor Piousbox <victor@piousbox.com>',
|
30
|
+
'Victor Piousbox <no-reply@piousbox.com>',
|
31
|
+
'Victor Piousbox <admin@wasya.co>',
|
32
|
+
'WasyaCo Consulting <hello@wasya.co>',
|
33
|
+
'WasyaCo Consulting <no-reply@wasya.co>',
|
34
|
+
'Victor Piousbox <victor@wasya.co>',
|
35
|
+
];
|
24
36
|
field :from_email
|
37
|
+
def self.from_email_list
|
38
|
+
[ [nil, nil] ] + FROM_EMAILS.map { |i| [i, i] }
|
39
|
+
end
|
25
40
|
|
26
41
|
## 2023-03-04 _vp_ This works!
|
27
42
|
def get_binding
|
data/lib/office/email_action.rb
CHANGED
@@ -13,13 +13,17 @@ class Office::EmailAction
|
|
13
13
|
field :descr, type: :string
|
14
14
|
|
15
15
|
belongs_to :email_template, class_name: '::Ish::EmailTemplate'
|
16
|
+
def tmpl; email_template; end
|
16
17
|
|
17
|
-
field :next_in_days, type: :string
|
18
|
-
field :next_at_time, type: :string
|
18
|
+
# field :next_in_days, type: :string
|
19
|
+
# field :next_at_time, type: :string
|
20
|
+
field :next_at_exe, type: :string
|
19
21
|
|
20
22
|
belongs_to :prev_email_action, class_name: '::Office::EmailAction', optional: true, inverse_of: :next_email_actions
|
21
23
|
has_many :next_email_actions, class_name: '::Office::EmailAction', inverse_of: :prev_email_action
|
22
24
|
|
23
25
|
has_many :scheduled_email_actions, class_name: '::Office::ScheduledEmailAction'
|
26
|
+
def schs; scheduled_email_actions; end
|
27
|
+
|
24
28
|
end
|
25
29
|
|
@@ -19,9 +19,13 @@ class Office::ScheduledEmailAction
|
|
19
19
|
scope :active, ->{ where( state: STATE_ACTIVE ) }
|
20
20
|
|
21
21
|
belongs_to :email_action, class_name: '::Office::EmailAction'
|
22
|
+
def act; email_action; end
|
23
|
+
|
22
24
|
has_many :email_contexts, class_name: '::Ish::EmailContext'
|
25
|
+
def ctxs; email_contexts; end
|
26
|
+
|
27
|
+
field :perform_at, type: :time
|
23
28
|
|
24
|
-
field :perform_at, type: :timestamp
|
25
29
|
|
26
30
|
end
|
27
31
|
::Sch = Office::ScheduledEmailAction
|