ishapi 0.1.8.303 → 0.1.8.304

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: deb042effc76a3bac981e7d95c5ccbac9c1fe067b5afb6799f273a2fb061ba67
4
- data.tar.gz: a497b8b725895391c965abe2680adb51d739958ca36172615263aa3fd6b83703
3
+ metadata.gz: c2aa5889cc1b26469a45c1177f999974ab3c8d3dead962628024eaf53b22ffdf
4
+ data.tar.gz: ac848af52069580c948d4f9f25b3bb909b9114647bcdb2dd967dd963dc548513
5
5
  SHA512:
6
- metadata.gz: 206d685ea05a79c226a49d888e1ba2ced49e5ff32343999fe1a00e42c65eb8f139e17cc1dcb2bd6d0e7acbb83c257ef55205d75f318631c353a3aef22b6db143
7
- data.tar.gz: ceebf0b9f54feb97eeac59cc655d65c12fc10957431d4821bf472e18822d97d80be31b0407f914a2a94e63119c62a5cf8a743e9f96556f088c481e90fbad3eff
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
- object_key = 'bg57j6u0j38b5ts86635fkqtjlucn5tvrm2hea81'
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
- throw "mail body of unknown type: #{the_mail.content_type}"
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
- photo = Photo.new({
103
- content_type: att.content_type.split(';')[0],
104
- original_filename: att.content_type_parameters[:name],
105
- image_data: att.body.encoded,
106
- email_message_id: @message.id,
107
- })
108
- photo.decode_base64_image
109
- if photo.save
110
- ;
111
- else
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.303
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-15 00:00:00.000000000 Z
11
+ date: 2023-11-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails