ish_models 0.0.33.183 → 0.0.33.184

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: 85f8fca5beb0c5b47064b21cc701211337dc0958413042fe7a0d06760bf37b6d
4
- data.tar.gz: 401e647a0822369046967e7a89f1f5e8171a39788c13c599641855497b955532
3
+ metadata.gz: 3e6eff98102df0e1c876a6efbead562210b0d6863d9a75574aef191c778a011b
4
+ data.tar.gz: 5a5b1eaab82f0ccb24304b8ee61821504c3940e8cca6e54ef4ec161c5394dc7d
5
5
  SHA512:
6
- metadata.gz: 64946732013186fc3677c73c907a089165534e57b3fbaa064ecd6a4194acf8d9e263b4fd5736f4aab5e726105f76fa960cf396487bf75bf88dce5dec6708acb4
7
- data.tar.gz: 299a36f616f7e436f650071604ae9fdc7ae20e23269579b9cb06904be845bfc8516b849022091dfed625bf7eb657f04cb086ca4ff63b92168d27bfcc33632fbe
6
+ metadata.gz: d35fb3fc9226c8720e083090b86bca77399bfa62a99cc4c1e3650688a25a4f9f9ab1dc59c825f258f6e25016cf7c5fafb6b223d1b16553555858783b9b7c11f2
7
+ data.tar.gz: af86d30206881902dc9654d38a903f6b1a7fbd41f81c1719b959478ddcf2ab691ae03d83edbec538098137bc4812427ab3d08326052fc4da4821f426ef878025
@@ -1,12 +1,14 @@
1
1
 
2
2
  #
3
- # This looks like it sends a single email?
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
+
10
12
  PAGE_PARAM_NAME = 'email_contexts_page'
11
13
 
12
14
  FROM_EMAILS = %w| piousbox@gmail.com victor@piousbox.com victor@wasya.co no-reply@piousbox.com |
@@ -16,8 +18,13 @@ class Ish::EmailContext
16
18
  [ [nil, nil] ] + FROM_EMAILS.map { |i| [i, i] }
17
19
  end
18
20
 
19
- field :to_email
20
- validates_presence_of :to_email
21
+ TYPE_SINGLE = 'TYPE_SINGLE'
22
+ TYPE_CAMPAIGN = 'TYPE_CAMPAIGN'
23
+ field :type, default: TYPE_SINGLE
24
+ def self.types_list
25
+ [ [TYPE_SINGLE, TYPE_SINGLE], [TYPE_CAMPAIGN, TYPE_CAMPAIGN] ]
26
+ end
27
+
21
28
 
22
29
  field :subject
23
30
  validates_presence_of :subject
@@ -30,11 +37,27 @@ class Ish::EmailContext
30
37
  field :rendered_str
31
38
 
32
39
  field :sent_at, type: DateTime
40
+ field :scheduled_at, type: DateTime
41
+
42
+ def leads
43
+ if self.type == TYPE_CAMPAIGN
44
+ return ::EmailCampaignLead.where( email_campaign_id: self.id.to_s ).includes( :lead ).map { |p| p.lead }
45
+ end
46
+ end
47
+
33
48
 
34
49
  #
35
50
  # For templating:
36
51
  #
37
- field :name
52
+ field :tmpl_name
53
+
54
+ field :to_email
55
+ validates_presence_of :to_email, if: -> { type == TYPE_SINGLE }
56
+
57
+ #
58
+ # For tracking
59
+ #
60
+ attr_reader :tid
38
61
 
39
62
  end
40
63
  EmailContext = Ish::EmailContext
@@ -1,4 +1,5 @@
1
- class Ish::Campaign
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
- field :tag # 'hired_com_ror', not enumerated for now _vp_ 20180103
21
- field :location
24
+ ## Need tracking!
25
+
26
+ ## this looks like an email_context, copy from there.
22
27
 
23
28
  end
data/lib/ish_models.rb CHANGED
@@ -43,8 +43,8 @@ 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'
47
+ # require 'ish/email_campaign' ## context + leadset is a campaign.
48
48
  require 'ish/email_context'
49
49
  require 'ish/email_template'
50
50
  require 'ish/email_unsubscribe'
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.183
4
+ version: 0.0.33.184
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
@@ -141,6 +140,7 @@ files:
141
140
  - lib/ish/payment.rb
142
141
  - lib/ish/premium_item.rb
143
142
  - lib/ish/railtie.rb
143
+ - lib/ish/trash/email_campaign.rb
144
144
  - lib/ish/user_profile.rb
145
145
  - lib/ish/utils.rb
146
146
  - lib/ish_models.rb