wco_models 3.1.0.48 → 3.1.0.50

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: da2441d1a8e01d619d5587ee73a3d39c750878741856c8ede9538800c2ab5b71
4
- data.tar.gz: 58d78cbd4f8b08de5157cdcf61c676356a62797f11d42a3beb4ae0c052fec707
3
+ metadata.gz: 1a17b1b5e607a9bd18dd6f5b6f6b4346e8af8b25460bc07a622fd7c54d1cf928
4
+ data.tar.gz: c5974d04bbac542b413cf6d444694e5e319271c27a4a399accd8c811a2609166
5
5
  SHA512:
6
- metadata.gz: 6f0b1f607df0481214cf2b37d19484cd93b9f770eee53fd7e997c4a7bc9628e0ac52c59e3d41de01853e12985f56c58a8bfb68e1f1f6563c07ce898311a78b42
7
- data.tar.gz: 1eb8cd6f8b833f58c4b8369d8aa689878b793e1ba7220efc9d64e93d0d0ea69a518683c351e85798334eb5d4082bc9e4e5ef97b7694acf3a405200a9889eeae8
6
+ metadata.gz: f8645a7db623d91cafd9f3a828e2e9ceabea87dcbefecdadfe21cddd74f51cbad6622535466179e9d004b9201d5f89a11157ceeb629bc551def8ea450045fbe2
7
+ data.tar.gz: 538e2e1e434bd37a7995f8b51b573f424aa76eb483cc196eb34d3c0dc89f18346f238ebbea244c586db976c8cfdf33be1ae6946a6b69aa6fa3f3b7c45bf7eacb
@@ -16,6 +16,8 @@ class Wco::Lead
16
16
  belongs_to :leadset, class_name: 'Wco::Leadset'
17
17
  has_one :photo, class_name: 'Wco::Photo'
18
18
 
19
+ has_many :email_messages, class_name: '::WcoEmail::Message', inverse_of: :lead
20
+
19
21
  has_and_belongs_to_many :conversations, class_name: '::WcoEmail::Conversation'
20
22
  def convs; conversations; end
21
23
  has_many :email_contexts, class_name: '::WcoEmail::Context'
@@ -1,7 +1,7 @@
1
+
1
2
  ##
2
3
  ## Send a single email
3
4
  ##
4
-
5
5
  class WcoEmail::Context
6
6
  include Mongoid::Document
7
7
  include Mongoid::Timestamps
@@ -45,6 +45,8 @@ class WcoEmail::Context
45
45
  self[:subject].presence || tmpl.subject
46
46
  end
47
47
 
48
+ belongs_to :reply_to_message, class_name: 'WcoEmail::Message', inverse_of: :replies, optional: true
49
+
48
50
  belongs_to :email_template, class_name: 'WcoEmail::EmailTemplate'
49
51
  def tmpl; email_template; end
50
52
 
@@ -106,10 +106,10 @@ class WcoEmail::EmailTemplate
106
106
  binding()
107
107
  end
108
108
 
109
- has_many :email_actions, class_name: 'WcoEmail::EmailAction'
110
- has_many :email_contexts, class_name: 'WcoEmail::EmailContext'
111
- has_many :email_filters, class_name: 'WcoEmail::EmailFilter'
112
- has_many :unsubscribes, class_name: 'WcoEmail::Unsubscribe'
109
+ has_many :email_actions, class_name: '::WcoEmail::EmailAction'
110
+ has_many :email_contexts, class_name: '::WcoEmail::Context'
111
+ has_many :email_filters, class_name: '::WcoEmail::EmailFilter'
112
+ has_many :unsubscribes, class_name: '::WcoEmail::Unsubscribe'
113
113
 
114
114
  SLUG_BLANK = 'blank'
115
115
  def self.blank_template
@@ -49,6 +49,8 @@ class WcoEmail::Message
49
49
 
50
50
  field :from, type: :string
51
51
  field :froms, type: Array, default: []
52
+ belongs_to :lead, class_name: 'Wco::Lead', inverse_of: :email_messages
53
+
52
54
  field :to, type: :string
53
55
  field :tos, type: Array, default: []
54
56
  field :cc, type: :string
@@ -67,8 +69,9 @@ class WcoEmail::Message
67
69
 
68
70
  belongs_to :stub, class_name: 'WcoEmail::MessageStub'
69
71
 
70
- has_many :assets, class_name: 'Wco::Asset'
71
- has_many :photos, class_name: 'Wco::Photo'
72
+ has_many :assets, class_name: '::Wco::Asset'
73
+ has_many :photos, class_name: '::Wco::Photo'
74
+ has_many :replies, class_name: '::WcoEmail::Context', inverse_of: :reply_to_message
72
75
 
73
76
  def apply_filter filter
74
77
  case filter.kind
@@ -192,7 +195,7 @@ class WcoEmail::Message
192
195
 
193
196
  content_type = att.content_type.split(';')[0]
194
197
  if content_type.include? 'image'
195
- photo = Wco::Photo.new({
198
+ photo = ::Wco::Photo.new({
196
199
  content_type: content_type,
197
200
  email_message_id: self.id,
198
201
  image_data: att.body.encoded,
@@ -207,7 +210,7 @@ class WcoEmail::Message
207
210
  File.open("/tmp/#{filename}", 'w:UTF-8:ASCII-8BIT') do |f|
208
211
  f.puts(sio.read)
209
212
  end
210
- asset = Wco::Asset.new({
213
+ asset = ::Wco::Asset.new({
211
214
  email_message: self,
212
215
  filename: filename,
213
216
  object: File.open("/tmp/#{filename}"),
data/lib/wco_models.rb CHANGED
@@ -1,6 +1,8 @@
1
1
 
2
2
  require 'aws-sdk-s3'
3
3
 
4
+ require 'business_time'
5
+
4
6
  require 'cancancan'
5
7
 
6
8
  require 'devise'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wco_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0.48
4
+ version: 3.1.0.50
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Pudeyev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-08 00:00:00.000000000 Z
11
+ date: 2024-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-s3