forwarded_email_parser 0.2.1 → 0.3.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
  SHA256:
3
- metadata.gz: fa1c8fcd33e236217fd5629ff47809fc924b89a61af4ec5eb63f1a88c6eb972e
4
- data.tar.gz: 70ba284ea1ee95aa1adf5489fd389b82796895397e242f0d21f123abb01eb0d7
3
+ metadata.gz: 85aa8385741abdaac820d341bb15229b2af13b656002b6b2b9e7df354dd4f1e6
4
+ data.tar.gz: e298da919b4955a4269bd9c6c9d5dc867c574d4d75a61d25d89e75cdf48a3f22
5
5
  SHA512:
6
- metadata.gz: 5d91f572f185391d21f1bf8afc83651889bf1f82666ecc578e147f5ce88e1ea6a2adb9283ba4e437205042abcb25fd584455e3b752cfa009ae67b57f33cccd45
7
- data.tar.gz: 0f2d93a0222768b308eebebf0b90895992c38c936dbf82648de9a0f43cb70c29db18dcac17909fbb4fd2d02954536ffd91a1fcd6f20ae90bf3ac2199ed02127a
6
+ metadata.gz: fe3682b1c601b8dfdca27f9f3deef2b41eac3553cf9380488a784a2acd5d02dd87d2d97e05dc8a792c1df088b374120000a0bbabbb6fbf6d907aa79bf80d35c1
7
+ data.tar.gz: d75f207923a047ba11963cfebf82313f273f100ede6b86d20679afb12955c16ec80e52a76aa936a0b8b58cf1b68e4810bfb6183465e8246686bfb3e50f61a77e
data/README.md CHANGED
@@ -10,15 +10,15 @@ Cloned from https://github.com/crisp-oss/email-forward-parser
10
10
 
11
11
  ## Installation
12
12
 
13
- TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
13
+ TODO: Replace `forwarded_email_parser` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
14
14
 
15
15
  Install the gem and add to the application's Gemfile by executing:
16
16
 
17
- $ bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
17
+ $ bundle add forwarded_email_parser
18
18
 
19
19
  If bundler is not being used to manage dependencies, install the gem by executing:
20
20
 
21
- $ gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
21
+ $ gem install forwarded_email_parser
22
22
 
23
23
  ## Usage
24
24
 
@@ -16,5 +16,49 @@ module ForwardedEmailParser
16
16
  @cc = email[:cc]
17
17
  @body = email[:body]
18
18
  end
19
+
20
+ def sender_name
21
+ case @from
22
+ when Hash
23
+ @from[:name]
24
+ when Array
25
+ @from.reject { |f| f[:name].nil? }.first&.dig(:name)
26
+ when String
27
+ @from
28
+ end
29
+ end
30
+
31
+ def sender_address
32
+ case @from
33
+ when Hash
34
+ @from[:address]
35
+ when Array
36
+ @from.reject { |f| f[:address].nil? }.first&.dig(:address)
37
+ when String
38
+ @from
39
+ end
40
+ end
41
+
42
+ def recipient_name
43
+ case @to
44
+ when Hash
45
+ @to[:name]
46
+ when Array
47
+ @to.reject { |t| t[:name].nil? }.first&.dig(:name)
48
+ when String
49
+ @to
50
+ end
51
+ end
52
+
53
+ def recipient_address
54
+ case @to
55
+ when Hash
56
+ @to[:address]
57
+ when Array
58
+ @to.reject { |t| t[:address].nil? }.first&.dig(:address)
59
+ when String
60
+ @to
61
+ end
62
+ end
19
63
  end
20
64
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ForwardedEmailParser
4
- VERSION = "0.2.1"
4
+ VERSION = "0.3.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forwarded_email_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Clayton Lengel-Zigich
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-08-05 00:00:00.000000000 Z
11
+ date: 2024-08-07 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Extract information from forwarded emails. Cloned from https://github.com/crisp-oss/email-forward-parser.
14
14
  email: