ish_models 0.0.33.202 → 0.0.33.204

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: f4d55a1db780f3a656dc89b8f42080058fbf3fe63cf68a078e15ded503b1fc3f
4
- data.tar.gz: c3b8b68584d144d8eb0afd391fd1c85a4f43f9f8b891377512bc82fca349abbb
3
+ metadata.gz: fd65ff58860ac2afaa7c51f64095d05122b0138add7df7cbffe64d905d64aefb
4
+ data.tar.gz: 938f54cc4d112e4e205dac23db42f2621fcf560f4cb7febd8c9f61b083ff4538
5
5
  SHA512:
6
- metadata.gz: 27fa2bf8d18914900c1671f39c8cbaf04c1dd6d1f047d0fe435a7ef64ea70bd56fb5ac0e85e007d74a4859b4d9362d390d97c83ea56003f17b7534be9ef8e564
7
- data.tar.gz: 8e4a9af7e7ace39f488c46c35175b60e6c85f7ae509a5d8ff281e1aae67d931907d5d24a8533a0f90d25079e974d3491ddb5e760b5e53cf17a548a09f4d899b4
6
+ metadata.gz: 3b20cdde2c6766f46c27bcee6385083ebdda9e4569101ef06f4f20dd394e6e2ee201070c4d2f59caa2d4c09f7be4565f94d4952c68ed30c7543232cc0161cfb1
7
+ data.tar.gz: 243bcc4f5c75ff33cf238552fce90b38c6e5d3fa251fb5ab018dbe1d9ca6be37927b568d574668a3966407e85e26cb3aaff98dd2204d51430769ed9fd0f5597a
@@ -1,13 +1,11 @@
1
-
2
- #
3
- # Sends a single email
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,35 +40,19 @@ class ::Ish::EmailContext
57
40
  field :send_at, type: DateTime
58
41
 
59
42
 
60
- def self.unsent
61
- new.unsent
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 })
73
50
  end
74
51
 
75
52
 
76
- field :lead_id
77
- def lead
78
- Lead.find lead_id
79
- end
80
- ## @deprecated: use self.lead
81
- field :to_email
82
- def to_email
83
- if self[:lead_id]
84
- return lead[:email]
85
- else
86
- return self[:to_email]
87
- end
88
- end
53
+ field :lead_id, type: :integer
54
+ def lead; Lead.find( lead_id ); end
55
+ def to_email; lead[:email]; end
89
56
 
90
57
 
91
58
  ##
@@ -99,3 +66,5 @@ class ::Ish::EmailContext
99
66
  end
100
67
 
101
68
  end
69
+ Ctx = ::Ish::EmailContext
70
+
@@ -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
@@ -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
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.202
4
+ version: 0.0.33.204
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox