webspicy 0.20.12 → 0.20.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a280bcc156de5e615f010269f8d3dcdca0263b5d5141e3dc7ae3f15e4cdb3af8
4
- data.tar.gz: 1d37b10be638894707bfe31ee52f159ffbf68ddd24c0097383d4588a380fb627
3
+ metadata.gz: 01b2fecc83c9d660dc6eba242b306e965196a6ecf9ad12b9b0e5929d9394e1ab
4
+ data.tar.gz: 16e008749db41f89755e9c0cc65457e438383044aaf54c6e171fc565b2da8ba0
5
5
  SHA512:
6
- metadata.gz: ec5e2fddb49307367af9e46115b81ac6b7d7cdbb971efec0cc03c4fdd9be9ee92fd35fba1430e7e708552f77456019927210132f3951c3ed0f7beb78e93b9bf1
7
- data.tar.gz: 1ae63f53ee9e5f826dd8c7f7739f4814895e7000c75149b80fd1faa6378e23270970f846f634c2c28808b814b63a15b60c53a285d139985b857f3e07d01e497d
6
+ metadata.gz: 0f7a18cbbfead965fefc954c07ea8ebb2d91e60cfd0e72c2658ec5e7c5c1425b6d9f0c8e2d3c09e7b3399697ab299c36f9873e1837422f785e96e1a298cccfaa
7
+ data.tar.gz: 12377e4af44a7b6d65c6daf3c83a41d1201ec3deab8922343b25f8f6483f07fb997dca45ed6e3fbc243c5f869c915642a7e6a867bf90dc0e5f8bae5fda7fb726
@@ -9,7 +9,9 @@ module Webspicy
9
9
  attr_reader :data
10
10
 
11
11
  def from
12
- @from ||= data["from"]["email"]
12
+ @from ||= data['from']['name'] ?
13
+ "#{data['from']['name']} <#{data['from']['email']}>" :
14
+ data['from']['email']
13
15
  end
14
16
 
15
17
  def to
@@ -9,7 +9,10 @@ module Webspicy
9
9
  attr_reader :data
10
10
 
11
11
  def from
12
- data["body"]["Source"]
12
+ rx = /^From:\s*(.*)$/
13
+ raw_data
14
+ .each_line
15
+ .find{|l| l =~ rx }[rx, 1].strip
13
16
  end
14
17
 
15
18
  def to
@@ -18,14 +21,14 @@ module Webspicy
18
21
  .select{|(k,v)|
19
22
  k =~ /Destinations.member/
20
23
  }
21
- .map{|(k,v)| v }
24
+ .map{|(k,v)| v.strip }
22
25
  end
23
26
 
24
27
  def subject
25
28
  rx = /^Subject:\s*(.*)$/
26
29
  raw_data
27
30
  .each_line
28
- .find{|l| l =~ rx }[rx, 1]
31
+ .find{|l| l =~ rx }[rx, 1].strip
29
32
  end
30
33
 
31
34
  def raw_data
@@ -2,7 +2,7 @@ module Webspicy
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 20
5
- TINY = 12
5
+ TINY = 13
6
6
  end
7
7
  VERSION = "#{Version::MAJOR}.#{Version::MINOR}.#{Version::TINY}"
8
8
  end
@@ -40,7 +40,7 @@ module Webspicy
40
40
  }
41
41
 
42
42
  it 'works as expected' do
43
- expect(subject.from).to eql("info@mydomain.be")
43
+ expect(subject.from).to eql("Foo Bar <info@mydomain.be>")
44
44
  expect(subject.to).to eql(["support@mydomain.fr"])
45
45
  expect(subject.subject).to eql("Hello World")
46
46
  end
@@ -6,9 +6,26 @@ module Webspicy
6
6
  describe Email do
7
7
 
8
8
  DATA = Base64.encode64 <<~J
9
- From: Webspicy <noreply@webspicy.io>
10
- To: someone@world.com
11
- Subject: Hey world, hello!
9
+ Content-Type: multipart/alternative;
10
+ boundary="--_NmP-d246fd025a6652c9-Part_1"
11
+ From: Webspicy <noreply@webspicy.io>
12
+ To: david.parloir@gmail.com
13
+ Subject: Hey world, hello!
14
+ Message-ID: <2421bae3-9c42-7988-23b4-b1f6168130c9@webspicy.io>
15
+ Date: Thu, 24 Jun 2021 13:45:16 +0000
16
+ MIME-Version: 1.0
17
+
18
+ ----_NmP-d246fd025a6652c9-Part_1
19
+ Content-Type: text/plain; charset=utf-8
20
+ Content-Transfer-Encoding: 7bit
21
+
22
+ Hello world, in a text version
23
+ ----_NmP-d246fd025a6652c9-Part_1
24
+ Content-Type: text/html; charset=utf-8
25
+ Content-Transfer-Encoding: 7bit
26
+
27
+ Hello world, in an html version
28
+ ----_NmP-d246fd025a6652c9-Part_1--
12
29
  J
13
30
 
14
31
  DATA = JSON.parse <<~J
@@ -29,7 +46,7 @@ module Webspicy
29
46
  }
30
47
 
31
48
  it 'works as expected' do
32
- expect(subject.from).to eql("noreply@webspicy.io")
49
+ expect(subject.from).to eql("Webspicy <noreply@webspicy.io>")
33
50
  expect(subject.to).to eql(["someone@world.com"])
34
51
  expect(subject.subject).to eql("Hey world, hello!")
35
52
  end
@@ -15,7 +15,7 @@ module Webspicy
15
15
  },
16
16
  {
17
17
  "key": "from",
18
- "line": "From: info@mydomain.be"
18
+ "line": "From: Webspicy <noreply@webspicy.io>"
19
19
  },
20
20
  {
21
21
  "key": "reply-to",
@@ -82,7 +82,7 @@ module Webspicy
82
82
  }
83
83
 
84
84
  it 'works as expected' do
85
- expect(subject.from).to eql("info@mydomain.be")
85
+ expect(subject.from).to eql("Webspicy <noreply@webspicy.io>")
86
86
  expect(subject.to).to eql(["support@mydomain.fr"])
87
87
  expect(subject.subject).to eql("Hello World")
88
88
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webspicy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.20.12
4
+ version: 0.20.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bernard Lambeau
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-09 00:00:00.000000000 Z
11
+ date: 2021-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake