ish_models 0.0.33.183 → 0.0.33.185
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_context.rb +39 -5
- data/lib/ish/{campaign.rb → trash/email_campaign.rb} +8 -3
- data/lib/ish/{lead.rb → trash/lead.rb} +0 -0
- data/lib/ish/{lead.rb-bk → trash/lead.rb-bk} +0 -0
- data/lib/ish_models.rb +0 -3
- metadata +4 -5
- data/lib/ish/issue.rb +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 85b9a6758d41c84ed2393951c0e8bd9733d92f745859689e64940677205962bf
|
4
|
+
data.tar.gz: 4133474740d173f9eddc0339a2c8fcc2b335a199db36f2f19cc813afe2889594
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4139e2903f034633a246aa43217b5f7eb64f3a5ec475774633d28b97984da2b35fa5ec4fde1ec4798b6c04f49c855db258df812f9dcb1e18e069326886d58031
|
7
|
+
data.tar.gz: 2ce2bed1e8a34efa83e643de5277561c3bc804503c5f6c293e72025ba639fc3b489eebd6d21296fe8d4598f1401bf9387d7fcfa21c686b30b3ed0e4c54a4d3c1
|
data/lib/ish/email_context.rb
CHANGED
@@ -1,12 +1,17 @@
|
|
1
1
|
|
2
2
|
#
|
3
|
-
#
|
3
|
+
# Sends a single email, or a campaign.
|
4
4
|
#
|
5
5
|
|
6
6
|
class Ish::EmailContext
|
7
7
|
include Mongoid::Document
|
8
8
|
include Mongoid::Timestamps
|
9
9
|
|
10
|
+
field :title
|
11
|
+
def slug
|
12
|
+
title
|
13
|
+
end
|
14
|
+
|
10
15
|
PAGE_PARAM_NAME = 'email_contexts_page'
|
11
16
|
|
12
17
|
FROM_EMAILS = %w| piousbox@gmail.com victor@piousbox.com victor@wasya.co no-reply@piousbox.com |
|
@@ -16,8 +21,13 @@ class Ish::EmailContext
|
|
16
21
|
[ [nil, nil] ] + FROM_EMAILS.map { |i| [i, i] }
|
17
22
|
end
|
18
23
|
|
19
|
-
|
20
|
-
|
24
|
+
TYPE_SINGLE = 'TYPE_SINGLE'
|
25
|
+
TYPE_CAMPAIGN = 'TYPE_CAMPAIGN'
|
26
|
+
field :type, default: TYPE_SINGLE
|
27
|
+
def self.types_list
|
28
|
+
[ [TYPE_SINGLE, TYPE_SINGLE], [TYPE_CAMPAIGN, TYPE_CAMPAIGN] ]
|
29
|
+
end
|
30
|
+
|
21
31
|
|
22
32
|
field :subject
|
23
33
|
validates_presence_of :subject
|
@@ -30,11 +40,35 @@ class Ish::EmailContext
|
|
30
40
|
field :rendered_str
|
31
41
|
|
32
42
|
field :sent_at, type: DateTime
|
43
|
+
field :scheduled_at, type: DateTime
|
44
|
+
|
45
|
+
def self.all_campaigns
|
46
|
+
Ish::EmailContext.where( type: TYPE_CAMPAIGN )
|
47
|
+
end
|
48
|
+
|
49
|
+
def campaign_leads
|
50
|
+
if self.type == TYPE_CAMPAIGN
|
51
|
+
return ::EmailCampaignLead.where( email_campaign_id: self.id.to_s ).includes( :lead )
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def leads
|
56
|
+
campaign_leads&.map { |p| p.lead }
|
57
|
+
end
|
58
|
+
|
33
59
|
|
34
60
|
#
|
35
61
|
# For templating:
|
36
62
|
#
|
37
|
-
field :
|
63
|
+
field :tmpl_name
|
64
|
+
|
65
|
+
field :to_email
|
66
|
+
validates_presence_of :to_email, if: -> { type == TYPE_SINGLE }
|
67
|
+
|
68
|
+
#
|
69
|
+
# For tracking
|
70
|
+
#
|
71
|
+
attr_reader :tid
|
38
72
|
|
39
73
|
end
|
40
|
-
|
74
|
+
EmailCampaign = Ish::EmailContext
|
@@ -1,4 +1,5 @@
|
|
1
|
-
|
1
|
+
|
2
|
+
class Ish::EmailCampaign
|
2
3
|
include Mongoid::Document
|
3
4
|
include Mongoid::Timestamps
|
4
5
|
|
@@ -12,12 +13,16 @@ class Ish::Campaign
|
|
12
13
|
field :subject
|
13
14
|
field :body
|
14
15
|
|
16
|
+
## @TODO: tags instead?
|
15
17
|
field :is_done, :type => Boolean, :default => false
|
16
18
|
field :is_trash, :type => Boolean, :default => false
|
19
|
+
field :tag # 'hired_com_ror', not enumerated for now _vp_ 20180103
|
17
20
|
|
21
|
+
## @TODO: sent on, scheduled_on, ...
|
18
22
|
field :applied_on, :type => Time
|
19
23
|
|
20
|
-
|
21
|
-
|
24
|
+
## Need tracking!
|
25
|
+
|
26
|
+
## this looks like an email_context, copy from there.
|
22
27
|
|
23
28
|
end
|
File without changes
|
File without changes
|
data/lib/ish_models.rb
CHANGED
@@ -43,7 +43,6 @@ require 'gameui/marker'
|
|
43
43
|
require 'gameui/premium_purchase'
|
44
44
|
|
45
45
|
require 'ish/cache_key'
|
46
|
-
require 'ish/campaign'
|
47
46
|
require 'ish/crawler'
|
48
47
|
require 'ish/email_context'
|
49
48
|
require 'ish/email_template'
|
@@ -52,8 +51,6 @@ require 'ish/gallery_name'
|
|
52
51
|
require 'ish/image_asset'
|
53
52
|
require 'ish/input_error'
|
54
53
|
require 'ish/invoice'
|
55
|
-
require 'ish/issue'
|
56
|
-
require 'ish/lead'
|
57
54
|
require 'ish/lorem_ipsum'
|
58
55
|
require 'ish/meeting'
|
59
56
|
require 'ish/payment'
|
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.185
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- piousbox
|
@@ -123,7 +123,6 @@ files:
|
|
123
123
|
- lib/gameui/marker.rb
|
124
124
|
- lib/gameui/premium_purchase.rb
|
125
125
|
- lib/ish/cache_key.rb
|
126
|
-
- lib/ish/campaign.rb
|
127
126
|
- lib/ish/configuration.rb
|
128
127
|
- lib/ish/crawler.rb
|
129
128
|
- lib/ish/email_context.rb
|
@@ -133,14 +132,14 @@ files:
|
|
133
132
|
- lib/ish/image_asset.rb
|
134
133
|
- lib/ish/input_error.rb
|
135
134
|
- lib/ish/invoice.rb
|
136
|
-
- lib/ish/issue.rb
|
137
|
-
- lib/ish/lead.rb
|
138
|
-
- lib/ish/lead.rb-bk
|
139
135
|
- lib/ish/lorem_ipsum.rb
|
140
136
|
- lib/ish/meeting.rb
|
141
137
|
- lib/ish/payment.rb
|
142
138
|
- lib/ish/premium_item.rb
|
143
139
|
- lib/ish/railtie.rb
|
140
|
+
- lib/ish/trash/email_campaign.rb
|
141
|
+
- lib/ish/trash/lead.rb
|
142
|
+
- lib/ish/trash/lead.rb-bk
|
144
143
|
- lib/ish/user_profile.rb
|
145
144
|
- lib/ish/utils.rb
|
146
145
|
- lib/ish_models.rb
|