ishapi 0.1.8.303 → 0.1.8.304
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/jobs/ishapi/email_message_intake_job.rb +22 -14
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2aa5889cc1b26469a45c1177f999974ab3c8d3dead962628024eaf53b22ffdf
|
4
|
+
data.tar.gz: ac848af52069580c948d4f9f25b3bb909b9114647bcdb2dd967dd963dc548513
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c3702b34c60967c73931108100513252416ba21dec37e7365276ec2c4eee3b97135d275f19c50b80b0a9611c3cbfdf5eb84d84ac75d30a2ca5842acb948be1a9
|
7
|
+
data.tar.gz: e540871e032d8f92633ad726ba51b6e17b14430688ea7af76637f880ec54676fbbb55c4fd0ae6ef8a31dccb883f460143844a5fdefac118586110ce19a0227dd
|
@@ -10,11 +10,15 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob
|
|
10
10
|
queue_as :default
|
11
11
|
|
12
12
|
=begin
|
13
|
-
|
13
|
+
|
14
|
+
object_key = 'n0v5mg6q1t4fjjnfh8vj8a96t85rp9la2ud0gdg1'
|
14
15
|
MsgStub.where({ object_key: object_key }).delete
|
15
16
|
|
16
|
-
stub = MsgStub.create({ object_key: object_key })
|
17
|
+
stub = MsgStub.create!({ object_key: object_key })
|
17
18
|
id = stub.id
|
19
|
+
|
20
|
+
Ishapi::EmailMessageIntakeJob.perform_now( stub.id.to_s )
|
21
|
+
|
18
22
|
=end
|
19
23
|
def perform id
|
20
24
|
stub = ::Office::EmailMessageStub.find id
|
@@ -25,6 +29,7 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob
|
|
25
29
|
raise "This stub has already been processed: #{stub.id.to_s}."
|
26
30
|
return
|
27
31
|
end
|
32
|
+
|
28
33
|
client = Aws::S3::Client.new({
|
29
34
|
region: ::S3_CREDENTIALS[:region_ses],
|
30
35
|
access_key_id: ::S3_CREDENTIALS[:access_key_id_ses],
|
@@ -93,29 +98,32 @@ class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob
|
|
93
98
|
elsif the_mail.content_type.blank?
|
94
99
|
@message.part_txt = body
|
95
100
|
else
|
96
|
-
|
101
|
+
@message.logs.push "mail body of unknown type: #{the_mail.content_type}"
|
97
102
|
end
|
98
103
|
end
|
99
104
|
|
100
105
|
## Attachments
|
101
106
|
the_mail.attachments.each do |att|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
107
|
+
content_type = att.content_type.split(';')[0]
|
108
|
+
if content_type.include? 'image'
|
109
|
+
photo = Photo.new({
|
110
|
+
content_type: content_type,
|
111
|
+
original_filename: att.content_type_parameters[:name],
|
112
|
+
image_data: att.body.encoded,
|
113
|
+
email_message_id: @message.id,
|
114
|
+
})
|
115
|
+
photo.decode_base64_image
|
116
|
+
photo.save
|
117
|
+
elsif att.filename
|
112
118
|
attachment = Office::EmailAttachment.new({
|
113
|
-
content: att.decoded,
|
119
|
+
content: att.body.decoded,
|
114
120
|
content_type: att.content_type,
|
115
121
|
email_message: @message,
|
116
122
|
filename: att.filename,
|
117
123
|
})
|
118
124
|
attachment.save
|
125
|
+
else
|
126
|
+
@message.logs.push "Could not save an attachment!"
|
119
127
|
end
|
120
128
|
end
|
121
129
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ishapi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.8.
|
4
|
+
version: 0.1.8.304
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- piousbox
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-11-
|
11
|
+
date: 2023-11-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|