ish_models 0.0.33.293 → 0.0.33.295
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/office/email_message.rb +77 -1
- metadata +1 -2
- data/lib/wco/serverhost.rb-trash +0 -45
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dd109584f1dbefcf5529b405a7f2bf1111dc969e72490ccf680baf644d1142b1
|
4
|
+
data.tar.gz: 0e210e736be69898278317a5fe3eff5f8b609dab8e98952205b9332f7143456c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 227539221105af1aac985806960386ffd6d631122c06fe5d425600a5c2abf0a0aa5b162087da9f86ed7865e5c0d5c7ab51fda0ee8ac25cbb820e1e3154812529
|
7
|
+
data.tar.gz: 985ef810e3e8277c18a6179fcbd13467b935f4718be1b0ed138779d778d02ea835c32891da3d2b1533ebd4c1a1505c9c510c53dc7cae6a7f74582f15360b5161
|
data/lib/office/email_message.rb
CHANGED
@@ -26,7 +26,6 @@ class Office::EmailMessage
|
|
26
26
|
field :preamble
|
27
27
|
field :epilogue
|
28
28
|
|
29
|
-
has_many :attachments, class_name: 'Photo'
|
30
29
|
|
31
30
|
def lead
|
32
31
|
Lead.find_by email: from
|
@@ -52,6 +51,7 @@ class Office::EmailMessage
|
|
52
51
|
end
|
53
52
|
|
54
53
|
has_many :email_attachments, class_name: 'Office::EmailAttachment', inverse_of: :email_message
|
54
|
+
has_many :attachments, class_name: 'Photo'
|
55
55
|
|
56
56
|
def preview_str
|
57
57
|
body = part_html || part_html || 'Neither part_html nor part_txt!'
|
@@ -100,6 +100,82 @@ class Office::EmailMessage
|
|
100
100
|
end
|
101
101
|
end
|
102
102
|
|
103
|
+
## From: https://stackoverflow.com/questions/24672834/how-do-i-remove-emoji-from-string/24673322
|
104
|
+
def self.strip_emoji(text)
|
105
|
+
text = text.force_encoding('utf-8').encode
|
106
|
+
clean = ""
|
107
|
+
|
108
|
+
# symbols & pics
|
109
|
+
regex = /[\u{1f300}-\u{1f5ff}]/
|
110
|
+
clean = text.gsub regex, ""
|
111
|
+
|
112
|
+
# enclosed chars
|
113
|
+
regex = /[\u{2500}-\u{2BEF}]/ # I changed this to exclude chinese char
|
114
|
+
clean = clean.gsub regex, ""
|
115
|
+
|
116
|
+
# emoticons
|
117
|
+
regex = /[\u{1f600}-\u{1f64f}]/
|
118
|
+
clean = clean.gsub regex, ""
|
119
|
+
|
120
|
+
#dingbats
|
121
|
+
regex = /[\u{2702}-\u{27b0}]/
|
122
|
+
clean = clean.gsub regex, ""
|
123
|
+
end
|
124
|
+
|
125
|
+
## For recursive parts of type `related`.
|
126
|
+
## Content dispositions:
|
127
|
+
# "inline; creation-date=\"Tue, 11 Apr 2023 19:39:42 GMT\"; filename=image005.png; modification-date=\"Tue, 11 Apr 2023 19:47:53 GMT\"; size=14916",
|
128
|
+
#
|
129
|
+
## Content Types:
|
130
|
+
# "application/pdf; name=\"Securities Forward Agreement -- HaulHub Inc -- Victor Pudeyev -- 2021-10-26.docx.pdf\""
|
131
|
+
# "image/jpeg; name=TX_DL_2.jpg"
|
132
|
+
# "image/png; name=image005.png"
|
133
|
+
# "multipart/alternative; boundary=_000_BL0PR10MB2913C560ADE059F0AB3A6D11829A9BL0PR10MB2913namp_",
|
134
|
+
# "text/html; charset=utf-8"
|
135
|
+
# "text/plain; charset=UTF-8"
|
136
|
+
# "text/calendar; charset=utf-8; method=REQUEST"
|
137
|
+
def churn_subpart part
|
138
|
+
if part.content_disposition&.include?('attachment')
|
139
|
+
## @TODO: attachments !
|
140
|
+
;
|
141
|
+
else
|
142
|
+
if part.content_type.include?("multipart/related") ||
|
143
|
+
part.content_type.include?("multipart/alternative")
|
144
|
+
|
145
|
+
part.parts.each do |subpart|
|
146
|
+
churn_subpart( subpart )
|
147
|
+
end
|
148
|
+
else
|
149
|
+
attachment = Office::EmailAttachment.new({
|
150
|
+
content: part.decoded,
|
151
|
+
content_type: part.content_type,
|
152
|
+
email_message: self,
|
153
|
+
})
|
154
|
+
attachment.save
|
155
|
+
|
156
|
+
if part.content_type.include?('text/html')
|
157
|
+
part_html = part.decoded
|
158
|
+
|
159
|
+
elsif part.content_type.include?("text/plain")
|
160
|
+
part_txt = part.decoded
|
161
|
+
|
162
|
+
elsif part.content_type.include?("text/calendar")
|
163
|
+
;
|
164
|
+
elsif part.content_type.include?("application/pdf")
|
165
|
+
;
|
166
|
+
elsif part.content_type.include?("image/jpeg")
|
167
|
+
;
|
168
|
+
elsif part.content_type.include?("image/png")
|
169
|
+
;
|
170
|
+
|
171
|
+
else
|
172
|
+
puts! part.content_type, '444 No action for a part with this content_type'
|
173
|
+
|
174
|
+
end
|
175
|
+
end
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
103
179
|
|
104
180
|
end
|
105
181
|
::Msg = Office::EmailMessage
|
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.295
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- piousbox
|
@@ -238,7 +238,6 @@ files:
|
|
238
238
|
- lib/wco/price.rb
|
239
239
|
- lib/wco/product.rb
|
240
240
|
- lib/wco/serverhost.rb
|
241
|
-
- lib/wco/serverhost.rb-trash
|
242
241
|
- lib/wco/subscription.rb
|
243
242
|
homepage: https://wasya.co
|
244
243
|
licenses:
|
data/lib/wco/serverhost.rb-trash
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
# WORKDIR = "/Users/piousbox/projects/docker_wco"
|
5
|
-
|
6
|
-
# class Instance
|
7
|
-
# def chmod
|
8
|
-
# start do |ssh|
|
9
|
-
# ssh.exec "sudo chmod +x /tmp/provision.sh"
|
10
|
-
# # other operations on ssh
|
11
|
-
# end
|
12
|
-
# end
|
13
|
-
# private
|
14
|
-
# def start
|
15
|
-
# Net::SSH.start(ip, 'ubuntu', keys: "mykey.pem" ) do |ssh|
|
16
|
-
# yield ssh
|
17
|
-
# end
|
18
|
-
# end
|
19
|
-
# end
|
20
|
-
|
21
|
-
|
22
|
-
## works:
|
23
|
-
# nginx_root = '/opt/nginx'
|
24
|
-
# config = { service_name: 'abba', }
|
25
|
-
# Net::SSH.start( "18.209.12.11", "ubuntu", keys: "access/mac_id_rsa_3.pem" ) do |ssh|
|
26
|
-
# out = ssh.scp.upload! "tmp/#{config[:service_name]}", "/opt/tmp/two.txt" do |ch, name, sent, total|
|
27
|
-
# puts "#{name}: #{sent}/#{total}"
|
28
|
-
# end
|
29
|
-
# puts! out, 'out'
|
30
|
-
# end
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
def create_volume_1 config={}
|
36
|
-
puts! config, '#create_volume'
|
37
|
-
|
38
|
-
out = ` cd #{WORKDIR} ; \
|
39
|
-
[ ! -e #{config[:kind]}__prototype.zip ] && wget #{config.tmpl.volume_zip} ; \
|
40
|
-
[ ! -e #{config[:kind]}__prototype ] && unzip #{config[:kind]}__prototype.zip ; \
|
41
|
-
mv #{config[:kind]}__prototype #{config[:service_name]}_data ; \
|
42
|
-
echo ok #create_volume
|
43
|
-
`;
|
44
|
-
puts! out, 'out'
|
45
|
-
end
|