ish_models 0.0.33.235 → 0.0.33.237
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ish/email_campaign.rb +21 -24
- data/lib/ish/email_context.rb +3 -1
- data/lib/ish/email_template.rb +1 -1
- data/lib/ish_models.rb +2 -1
- data/lib/office/action.rb +29 -0
- data/lib/office/action_tie.rb +16 -0
- data/lib/office/email_action.rb +1 -9
- data/lib/office/email_action_tie.rb +1 -20
- data/lib/office/email_conversation.rb +0 -3
- data/lib/office/email_message_stub.rb +0 -1
- data/lib/office/scheduled_email_action.rb +3 -22
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ecce740f5d2efcbf23bae3ac90345798790279b39de3559a1f400911b11107df
|
4
|
+
data.tar.gz: 8f5a2146fe4099ff9ee7a3869507e98450f57a024b133b8b4706ad4aab384839
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e04996ef74d595649d87c22b6f6e828c713f8bc4638f2da49ed85548481467c22e66a3c00b3435afb9337bc863a42eb6c69613598e0889a93124f07bd2b44c3d
|
7
|
+
data.tar.gz: 491b70c769dd230079e463bc8b2387e7fbf91ae72a0872782b68de4ae0046ad1ffd8d5aa0ad8e68269a659613f03b39e7d565cdc6d498b5d25742348c15e99f5
|
data/lib/ish/email_campaign.rb
CHANGED
@@ -1,9 +1,8 @@
|
|
1
1
|
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
2
|
+
##
|
3
|
+
## Sends a campaign.
|
4
|
+
## _vp_ 2023-02-02
|
5
|
+
##
|
7
6
|
class Ish::EmailCampaign
|
8
7
|
include Mongoid::Document
|
9
8
|
include Mongoid::Timestamps
|
@@ -14,11 +13,11 @@ class Ish::EmailCampaign
|
|
14
13
|
|
15
14
|
PAGE_PARAM_NAME = 'email_contexts_page'
|
16
15
|
|
16
|
+
field :from_email
|
17
|
+
validates_presence_of :from_email
|
17
18
|
FROM_EMAILS = %w| hello@infiniteshelter.com no-reply@infiniteshelter.com
|
18
19
|
piousbox@gmail.com hello@piousbox.com no-reply@piousbox.com victor@piousbox.com
|
19
20
|
admin@wasya.co hello@wasya.co no-reply@wasya.co victor@wasya.co |
|
20
|
-
field :from_email
|
21
|
-
validates_presence_of :from_email
|
22
21
|
def self.from_email_list
|
23
22
|
[ [nil, nil] ] + FROM_EMAILS.map { |i| [i, i] }
|
24
23
|
end
|
@@ -40,23 +39,21 @@ class Ish::EmailCampaign
|
|
40
39
|
campaign_leads&.map { |p| p.lead }
|
41
40
|
end
|
42
41
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
# ##
|
47
|
-
# ## commonly: name, companyName
|
48
|
-
# field :tmpl, type: Hash, default: {}
|
49
|
-
# def body_templated
|
50
|
-
# out = email_template.body
|
51
|
-
# tmpl.each do |k, v|
|
52
|
-
# out.gsub!("{#{k}}", v)
|
53
|
-
# end
|
54
|
-
# out
|
55
|
-
# end
|
56
|
-
|
57
|
-
#
|
58
|
-
# For tracking
|
59
|
-
#
|
42
|
+
##
|
43
|
+
## For tracking
|
44
|
+
##
|
60
45
|
attr_reader :tid
|
61
46
|
|
47
|
+
def do_send
|
48
|
+
leads.each do |lead|
|
49
|
+
ctx = Ctx.create!({
|
50
|
+
email_template: tmpl,
|
51
|
+
from_email: tmpl.from_email,
|
52
|
+
lead_id: lead.id,
|
53
|
+
send_at: Time.now,
|
54
|
+
subject: tmpl.subject,
|
55
|
+
})
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
62
59
|
end
|
data/lib/ish/email_context.rb
CHANGED
data/lib/ish/email_template.rb
CHANGED
@@ -12,7 +12,7 @@ class ::Ish::EmailTemplate
|
|
12
12
|
field :layout, type: :string, default: 'plain'
|
13
13
|
LAYOUTS = %w| plain
|
14
14
|
m20221201react m20221222merryxmas
|
15
|
-
marketing_react_1
|
15
|
+
marketing_react_1 marketing_react_2
|
16
16
|
marketing_ror_1 marketing_ror_2
|
17
17
|
marketing_wordpres_1 marketing_wordpress_2
|
18
18
|
piousbox_roundborders
|
data/lib/ish_models.rb
CHANGED
@@ -64,6 +64,8 @@ require 'photo'
|
|
64
64
|
require 'report'
|
65
65
|
require 'video'
|
66
66
|
|
67
|
+
require 'office/action'
|
68
|
+
require 'office/action_tie'
|
67
69
|
require 'office/email_action'
|
68
70
|
require 'office/email_action_tie'
|
69
71
|
require 'office/email_conversation'
|
@@ -75,4 +77,3 @@ require 'office/scheduled_email_action'
|
|
75
77
|
|
76
78
|
|
77
79
|
|
78
|
-
|
@@ -0,0 +1,29 @@
|
|
1
|
+
|
2
|
+
class Office::Action
|
3
|
+
include Mongoid::Document
|
4
|
+
include Mongoid::Timestamps
|
5
|
+
store_in collection: 'office_actions'
|
6
|
+
|
7
|
+
field :slug, type: :string
|
8
|
+
validates :slug, uniqueness: true, allow_nil: true
|
9
|
+
|
10
|
+
field :descr, type: :string ## optional
|
11
|
+
|
12
|
+
|
13
|
+
STATE_ACTIVE = 'active'
|
14
|
+
STATE_INACTIVE = 'inactive'
|
15
|
+
STATES = [ STATE_ACTIVE, STATE_INACTIVE ]
|
16
|
+
field :state, type: :string
|
17
|
+
scope :active, ->{ where( state: STATE_ACTIVE ) }
|
18
|
+
|
19
|
+
|
20
|
+
has_many :ties, class_name: '::Office::ActionTie', inverse_of: :office_action
|
21
|
+
has_many :prev_ties, class_name: '::Office::ActionTie', inverse_of: :next_office_action
|
22
|
+
accepts_nested_attributes_for :ties
|
23
|
+
|
24
|
+
field :action_exe, type: :string
|
25
|
+
|
26
|
+
field :perform_at, type: :time
|
27
|
+
|
28
|
+
end
|
29
|
+
OAct = Office::Action
|
@@ -0,0 +1,16 @@
|
|
1
|
+
|
2
|
+
class Office::ActionTie
|
3
|
+
include Mongoid::Document
|
4
|
+
include Mongoid::Timestamps
|
5
|
+
store_in collection: 'office_action_ties'
|
6
|
+
|
7
|
+
attr_accessor :to_delete
|
8
|
+
|
9
|
+
belongs_to :office_action, class_name: '::Office::Action', inverse_of: :ties
|
10
|
+
belongs_to :next_office_action, class_name: '::Office::Action', inverse_of: :prev_ties
|
11
|
+
|
12
|
+
field :next_at_exe, type: :string
|
13
|
+
validates :next_at_exe, presence: true
|
14
|
+
|
15
|
+
end
|
16
|
+
OActie = Office::ActionTie
|
data/lib/office/email_action.rb
CHANGED
@@ -7,10 +7,6 @@ class Office::EmailAction
|
|
7
7
|
include Mongoid::Document
|
8
8
|
include Mongoid::Timestamps
|
9
9
|
|
10
|
-
# field :next_at_exe, type: :string
|
11
|
-
# field :next_in_days, type: :string
|
12
|
-
# field :next_at_time, type: :string
|
13
|
-
|
14
10
|
field :slug, type: :string
|
15
11
|
validates :slug, uniqueness: true, allow_nil: true
|
16
12
|
|
@@ -19,10 +15,6 @@ class Office::EmailAction
|
|
19
15
|
belongs_to :email_template, class_name: '::Ish::EmailTemplate'
|
20
16
|
def tmpl; email_template; end
|
21
17
|
|
22
|
-
# belongs_to :prev_email_action, class_name: '::Office::EmailAction', optional: true, inverse_of: :next_email_actions
|
23
|
-
# has_many :next_email_actions, class_name: '::Office::EmailAction', inverse_of: :prev_email_action
|
24
|
-
# accepts_nested_attributes_for :next_email_actions
|
25
|
-
|
26
18
|
has_many :scheduled_email_actions, class_name: '::Office::ScheduledEmailAction'
|
27
19
|
def schs; scheduled_email_actions; end
|
28
20
|
|
@@ -31,4 +23,4 @@ class Office::EmailAction
|
|
31
23
|
accepts_nested_attributes_for :ties
|
32
24
|
|
33
25
|
end
|
34
|
-
|
26
|
+
EAct = Office::EmailAction
|
@@ -11,27 +11,8 @@ class Office::EmailActionTie
|
|
11
11
|
belongs_to :email_action, class_name: '::Office::EmailAction', inverse_of: :ties
|
12
12
|
belongs_to :next_email_action, class_name: '::Office::EmailAction', inverse_of: :prev_ties
|
13
13
|
|
14
|
-
|
15
14
|
field :next_at_exe, type: :string
|
16
15
|
validates :next_at_exe, presence: true
|
17
16
|
|
18
|
-
# field :next_in_days, type: :string
|
19
|
-
# field :next_at_time, type: :string
|
20
|
-
|
21
|
-
# field :slug, type: :string
|
22
|
-
# validates :slug, uniqueness: true, allow_nil: true
|
23
|
-
|
24
|
-
# field :descr, type: :string ## optional, can remove
|
25
|
-
|
26
|
-
# belongs_to :email_template, class_name: '::Ish::EmailTemplate'
|
27
|
-
# def tmpl; email_template; end
|
28
|
-
|
29
|
-
# belongs_to :prev_email_action, class_name: '::Office::EmailAction', optional: true, inverse_of: :next_email_actions
|
30
|
-
# has_many :next_email_actions, class_name: '::Office::EmailAction', inverse_of: :prev_email_action
|
31
|
-
# accepts_nested_attributes_for :next_email_actions
|
32
|
-
|
33
|
-
# has_many :scheduled_email_actions, class_name: '::Office::ScheduledEmailAction'
|
34
|
-
# def schs; scheduled_email_actions; end
|
35
|
-
|
36
17
|
end
|
37
|
-
|
18
|
+
EActie = Office::EmailActionTie
|
@@ -17,8 +17,6 @@ class Office::EmailConversation
|
|
17
17
|
Lead.find( lead_ids )
|
18
18
|
end
|
19
19
|
|
20
|
-
|
21
|
-
|
22
20
|
has_many :email_messages
|
23
21
|
def email_messages
|
24
22
|
Office::EmailMessage.where( email_conversation_id: self.id )
|
@@ -85,5 +83,4 @@ class Office::EmailConversation
|
|
85
83
|
end
|
86
84
|
|
87
85
|
end
|
88
|
-
# EmailConversation = Office::EmailConversation
|
89
86
|
Conv = Office::EmailConversation
|
@@ -15,7 +15,6 @@ class Office::EmailMessageStub
|
|
15
15
|
validates_presence_of :object_key
|
16
16
|
|
17
17
|
field :object_path, type: :string ## A routable s3 url ## @TODO: remove this field. _vp_ 2023-03-07
|
18
|
-
# validates_presence_of :object_path ## only need object_key == message_id
|
19
18
|
|
20
19
|
field :wp_term_ids, type: :array, default: []
|
21
20
|
|
@@ -6,6 +6,7 @@ class Office::ScheduledEmailAction
|
|
6
6
|
include Mongoid::Document
|
7
7
|
include Mongoid::Timestamps
|
8
8
|
include Mongoid::Paranoia
|
9
|
+
store_in collection: 'office_scheduled_email_actions'
|
9
10
|
|
10
11
|
field :lead_id, type: :integer
|
11
12
|
def lead
|
@@ -19,9 +20,9 @@ class Office::ScheduledEmailAction
|
|
19
20
|
scope :active, ->{ where( state: STATE_ACTIVE ) }
|
20
21
|
|
21
22
|
belongs_to :email_action, class_name: '::Office::EmailAction'
|
22
|
-
|
23
|
+
validates :email_action, uniqueness: { scope: :lead_id }
|
24
|
+
def act; email_action; end
|
23
25
|
def act= a; email_action= a; end
|
24
|
-
validates :email_action, uniqueness: { scope: :lead_id }
|
25
26
|
|
26
27
|
has_many :email_contexts, class_name: '::Ish::EmailContext'
|
27
28
|
def ctxs; email_contexts; end
|
@@ -59,23 +60,3 @@ class Office::ScheduledEmailAction
|
|
59
60
|
end
|
60
61
|
::Sch = Office::ScheduledEmailAction
|
61
62
|
|
62
|
-
## @TODO: herehere 2023-03-04 _vp_ Currently Working on this
|
63
|
-
=begin
|
64
|
-
::Sch.active.where( :perform_at.lte => Time.now ) do |sch|
|
65
|
-
next_a = sch.next_email_action
|
66
|
-
|
67
|
-
if sch.next_actions.present?
|
68
|
-
sch.next_actions.each do |next_a|
|
69
|
-
next_sch_a = ::Office::ScheduledEmailAction.new({
|
70
|
-
email_action: next_a
|
71
|
-
|
72
|
-
next_time = Time.now + eval( sch.next_in_days )
|
73
|
-
next_time.time = eval( sch.next_at_time )
|
74
|
-
sch.update_attribute( :perform_at, next_time )
|
75
|
-
end
|
76
|
-
else
|
77
|
-
sch.update_attribute( state: STATE_INACTIVE )
|
78
|
-
end
|
79
|
-
=end
|
80
|
-
|
81
|
-
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ish_models
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.33.
|
4
|
+
version: 0.0.33.237
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- piousbox
|
@@ -158,6 +158,8 @@ files:
|
|
158
158
|
- lib/mongoid/votable.rb
|
159
159
|
- lib/mongoid/voter.rb
|
160
160
|
- lib/newsitem.rb
|
161
|
+
- lib/office/action.rb
|
162
|
+
- lib/office/action_tie.rb
|
161
163
|
- lib/office/email_action.rb
|
162
164
|
- lib/office/email_action_tie.rb
|
163
165
|
- lib/office/email_conversation.rb
|