inbox_items 0.1.8 → 0.2.0

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
  SHA1:
3
- metadata.gz: 040a681ffa820e0aaeff75acd77801c7dd6f8127
4
- data.tar.gz: 3e4b7d091d83e948f9d24d9d3ea9e0b50cb21c4a
3
+ metadata.gz: 477a719284630db29f7a3fd7f5729e36f62be3ef
4
+ data.tar.gz: 32a11c890728a25d5488c5913d983655f6357bd2
5
5
  SHA512:
6
- metadata.gz: af08fe2629a00e37cafe7e144330b6cd028d326a1ce6538e52dffe94ef91a9c664db34e27a5fc04ff4b8573bff8d6b2a00d64324d53c2517ed587faa5663a542
7
- data.tar.gz: e47010949286245dde55f7bb6e72ffc01ac55cfe2539aeca215d3dfaf83e5434fe754339c589f5a3e170dd44cd200619031f046cf233d8105325f1d3019ad5f5
6
+ metadata.gz: 3514c4091f499091948bc30354e136f2290b38622f47eb7148b7dfc1fe3026de9f60f51c6639c7ffb0088fd019670823a1f53257dbfa9cb01727ce36de5b6d81
7
+ data.tar.gz: 701ed873e1d1004ba5efe6ab92604803f7481a562fa0d743986c4904173dd3240b30fa70d5ae48bd57b3196b97a99cc41a48e1f32de09b307d7a595ff1a73977
data/Rakefile CHANGED
@@ -3,7 +3,7 @@ begin
3
3
  rescue LoadError
4
4
  puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
5
  end
6
-
6
+ require 'bundler/gem_tasks'
7
7
  require 'rdoc/task'
8
8
 
9
9
  RDoc::Task.new(:rdoc) do |rdoc|
@@ -35,3 +35,4 @@ end
35
35
 
36
36
 
37
37
  task default: :test
38
+
@@ -1,4 +1,5 @@
1
1
  class EmailProcessor
2
+ require 'charlock_holmes'
2
3
 
3
4
  def initialize(email)
4
5
  @email = email
@@ -14,6 +15,7 @@ class EmailProcessor
14
15
  file_upload = create_file_upload(attachment, inbox_item)
15
16
  InboxItems::MoveEmailAttachmentToS3Job.perform_later(file_upload) if file_upload
16
17
  rescue => e
18
+
17
19
  Rails.logger.info "Rescue from error at EmailProcessor attachments each with index line 17: #{e}"
18
20
  next
19
21
  end
@@ -31,11 +33,16 @@ class EmailProcessor
31
33
  end
32
34
 
33
35
  def formatted_subject
34
- @email.subject.gsub(/FWD:|Fwd:|Fw:|Re:|RE:/, '').strip
36
+ transcoded @email.subject.gsub(/FWD:|Fwd:|Fw:|Re:|RE:/, '').strip
35
37
  end
36
38
 
37
39
  def formatted_body
38
- email.body.gsub(/Sent from my iPhone/, '')
40
+ transcoded email.body.gsub(/Sent from my iPhone/, '')
41
+ end
42
+
43
+ def transcoded(content)
44
+ detection = CharlockHolmes::EncodingDetector.detect(content)
45
+ CharlockHolmes::Converter.convert content, detection[:encoding], 'UTF-8'
39
46
  end
40
47
 
41
48
  def directory
@@ -1,3 +1,3 @@
1
1
  module InboxItems
2
- VERSION = "0.1.8"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inbox_items
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gordon B. Isnor
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-26 00:00:00.000000000 Z
11
+ date: 2016-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails