ish_models 0.0.33.199 → 0.0.33.201
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 +4 -4
- data/lib/office/email_conversation.rb +23 -4
- data/lib/office/email_message.rb +0 -23
- data/lib/office/email_message_stub.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f7b84c12b393ec05bb90bf8b5f0cbebf9f56b4a03cc7109024721da40267834
|
4
|
+
data.tar.gz: 9e9f21da6318f174be8e1ad53d6d04ae39554bc7b0fcb4f158930deda6387e77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87be8ad0b221c7ead2a100b14e752bc67c32a6fe7b941d1153f92aa857050e3ebd3e775d74a8708ebec523585f791797d19f9a5fe0f479cad2df810fd025810a
|
7
|
+
data.tar.gz: 063d5e1a5d5fe71c7c3545768869d01c9c1461aa4bc14c2b958526c5be8232ae013a37ae8952b716d5f3c5ac6c7a36de8fc938df7e51d17f23ca16ac61b7923f
|
@@ -17,18 +17,20 @@ class Office::EmailConversation
|
|
17
17
|
Lead.find( lead_ids )
|
18
18
|
end
|
19
19
|
|
20
|
-
|
21
|
-
def tags
|
22
|
-
WpTag.find( term_ids )
|
23
|
-
end
|
20
|
+
|
24
21
|
|
25
22
|
has_many :email_messages
|
26
23
|
def email_messages
|
27
24
|
Office::EmailMessage.where( email_conversation_id: self.id )
|
28
25
|
end
|
29
26
|
|
27
|
+
def tags
|
28
|
+
WpTag.find( wp_term_ids )
|
29
|
+
end
|
30
|
+
|
30
31
|
## Copied from email_message
|
31
32
|
field :wp_term_ids, type: Array, default: []
|
33
|
+
|
32
34
|
## Tested manually ok, does not pass the spec. @TODO: hire to make pass spec? _vp_ 2023-03-07
|
33
35
|
def add_tag tag
|
34
36
|
if WpTag == tag.class
|
@@ -38,6 +40,7 @@ class Office::EmailConversation
|
|
38
40
|
throw "#add_tag expects a WpTag as the only parameter."
|
39
41
|
end
|
40
42
|
end
|
43
|
+
|
41
44
|
def remove_tag tag
|
42
45
|
if WpTag == tag.class
|
43
46
|
self[:wp_term_ids].delete( tag.id )
|
@@ -47,6 +50,22 @@ class Office::EmailConversation
|
|
47
50
|
end
|
48
51
|
end
|
49
52
|
|
53
|
+
def self.in_inbox
|
54
|
+
::Office::EmailConversation.where( :wp_term_ids => WpTag.email_inbox_tag.id ).order_by( latest_at: :desc )
|
55
|
+
end
|
56
|
+
|
57
|
+
def self.in_emailtag which
|
58
|
+
case which.class.name
|
59
|
+
when 'String'
|
60
|
+
tag_id = WpTag.emailtag(which).id
|
61
|
+
when 'WpTag'
|
62
|
+
tag_id = which.id
|
63
|
+
else
|
64
|
+
throw "unsupported in #in_emailtag: #{which}"
|
65
|
+
end
|
66
|
+
return ::Office::EmailConversation.where( :wp_term_ids => tag_id ).order_by( latest_at: :desc )
|
67
|
+
end
|
68
|
+
|
50
69
|
end
|
51
70
|
# EmailConversation = Office::EmailConversation
|
52
71
|
Conv = Office::EmailConversation
|
data/lib/office/email_message.rb
CHANGED
@@ -101,26 +101,3 @@ class Office::EmailMessage
|
|
101
101
|
|
102
102
|
end
|
103
103
|
::Msg = Office::EmailMessage
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
## trash _vp_ 2023-03-07
|
108
|
-
# def process
|
109
|
-
# Aws.config[:credentials] = Aws::Credentials.new(
|
110
|
-
# ::S3_CREDENTIALS[:access_key_id],
|
111
|
-
# ::S3_CREDENTIALS[:secret_access_key]
|
112
|
-
# )
|
113
|
-
# s3 = Aws::S3::Client.new
|
114
|
-
# obj = s3.get_object({
|
115
|
-
# bucket: 'ish-ses',
|
116
|
-
# key: self.object_key
|
117
|
-
# })
|
118
|
-
# obj2 = obj.body.read
|
119
|
-
# mail = Mail.read_from_string( obj2 )
|
120
|
-
# self.from = mail.from
|
121
|
-
# self.to = mail.to
|
122
|
-
# self.subject = mail.subject
|
123
|
-
# self.date = mail.date
|
124
|
-
# self.raw = obj2
|
125
|
-
# self.save
|
126
|
-
# end
|
@@ -17,7 +17,7 @@ class Office::EmailMessageStub
|
|
17
17
|
field :object_path, type: :string ## A routable s3 url ## @TODO: remove this field. _vp_ 2023-03-07
|
18
18
|
# validates_presence_of :object_path ## only need object_key == message_id
|
19
19
|
|
20
|
-
field :
|
20
|
+
field :wp_term_ids, type: :array, default: []
|
21
21
|
|
22
22
|
end
|
23
23
|
Stub = EMS = Office::EmailMessageStub
|