webspicy 0.20.16 → 0.20.17

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: 7a8de4780fb659f78ce0f61cebc61abed9ab6206a45c953bff95071a67761ee7
4
- data.tar.gz: 8258fbb268baddb39d4549540484816aefde696a41a6166bf3cbe45d6bdf9912
3
+ metadata.gz: db9ccb05ac501d744769feebb3bb41d5775727fbf11b2507cd3d2aee6d0b6f10
4
+ data.tar.gz: 5b314097454003e48edd6e72a94e05f439709478586ac0eefb1a31eed1192d37
5
5
  SHA512:
6
- metadata.gz: 434f5a5616992040d25c7fefd9c483ff622b96a5f71c59a1efeb3ac72ab37d6329e3e941b6487ff68ca18648e52848d9ce58dc78d7f44dcfc73bba486131c81d
7
- data.tar.gz: 7aca5fd9abb963b086ccd2d0d9e80c1f783d5cafb0f691760545dfe6689f87419197daca678c03027f3c4eb2fc145896d18d2e1c823e115531903585389a862c
6
+ metadata.gz: 40dcc1ae84b4bd1146412435663e2d2198c53dc15cc858b5e88370656d6bf612b056b542cb7efef71b69dec395bbb0a36766b731f053c84b1f760c66e02ff942
7
+ data.tar.gz: 29744550467db7bd83ad6e102e8296fe4df99911f2b29c77af66488ef37320bbfecf8a37258e931cde4bd7b3a02715b733125e3fbefa73cbe13e72fd3bba511b
@@ -42,6 +42,13 @@ module Webspicy
42
42
  @subject ||= data["subject"]
43
43
  end
44
44
 
45
+ def headers
46
+ @headers ||= data["headers"].reduce(OpenStruct.new){|acc, (key, value)|
47
+ acc[key.downcase] = value
48
+ acc
49
+ }
50
+ end
51
+
45
52
  end # class Email
46
53
  end # class Fakesendgrid
47
54
  end # class Tester
@@ -39,6 +39,13 @@ module Webspicy
39
39
  recipients - cc - to
40
40
  end
41
41
 
42
+ def headers
43
+ @headers ||= email.header.reduce(OpenStruct.new){|acc, h|
44
+ acc[h.name.downcase] = h.unparsed_value
45
+ acc
46
+ }
47
+ end
48
+
42
49
  def email
43
50
  @email ||= Mail.read_from_string(raw_data)
44
51
  end
@@ -38,6 +38,14 @@ module Webspicy
38
38
  .first
39
39
  end
40
40
 
41
+ def headers
42
+ @headers ||= data["headerLines"]
43
+ .reduce(OpenStruct.new){|acc, h|
44
+ acc[h["key"].downcase] = h["line"].split(': ')[1..].join(': ')
45
+ acc
46
+ }
47
+ end
48
+
41
49
  end # class Email
42
50
  end # class Fakesmtp
43
51
  end # class Tester
@@ -2,7 +2,7 @@ module Webspicy
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 20
5
- TINY = 16
5
+ TINY = 17
6
6
  end
7
7
  VERSION = "#{Version::MAJOR}.#{Version::MINOR}.#{Version::TINY}"
8
8
  end
@@ -44,7 +44,10 @@ module Webspicy
44
44
  "value": "test <b>test</b> test",
45
45
  "type": "text/html"
46
46
  }
47
- ]
47
+ ],
48
+ "headers": {
49
+ "x-header-key": "personalised-header-value"
50
+ }
48
51
  }
49
52
  J
50
53
 
@@ -58,6 +61,7 @@ module Webspicy
58
61
  expect(subject.cc).to eql(["a-cc-recipient@world.com"])
59
62
  expect(subject.bcc).to eql(["a-bcc-recipient@world.com"])
60
63
  expect(subject.subject).to eql("Hello World")
64
+ expect(subject.headers['x-header-key']).to eql('personalised-header-value')
61
65
  end
62
66
 
63
67
  end
@@ -12,6 +12,7 @@ module Webspicy
12
12
  To: someone@world.com, someoneelse@world.com
13
13
  CC: a-cc-recipient@world.com
14
14
  Subject: Hey world, hello!
15
+ X-Ses-Configuration-Set: SesConfigurationSet
15
16
  Message-ID: <2421bae3-9c42-7988-23b4-b1f6168130c9@webspicy.io>
16
17
  Date: Thu, 24 Jun 2021 13:45:16 +0000
17
18
  MIME-Version: 1.0
@@ -55,6 +56,11 @@ module Webspicy
55
56
  expect(subject.cc).to eql(["a-cc-recipient@world.com"])
56
57
  expect(subject.bcc).to eql(["a-bcc-recipient@world.com"])
57
58
  expect(subject.subject).to eql("Hey world, hello!")
59
+ expect(subject.headers[:from]).to eql("Webspicy <noreply@webspicy.io>")
60
+ expect(subject.headers[:cc]).to eql("a-cc-recipient@world.com")
61
+ expect(subject.headers["message-id"]).to eql("<2421bae3-9c42-7988-23b4-b1f6168130c9@webspicy.io>")
62
+ expect(subject.headers["mime-version"]).to eql("1.0")
63
+ expect(subject.headers["x-ses-configuration-set"]).to eql("SesConfigurationSet")
58
64
  end
59
65
 
60
66
  end
@@ -96,6 +96,10 @@ module Webspicy
96
96
  expect(subject.to).to eql(["someone@world.com", "someoneelse@world.com"])
97
97
  expect(subject.cc).to eql(["a-cc-recipient@world.com"])
98
98
  expect(subject.subject).to eql("Hello World")
99
+ expect(subject.headers[:cc]).to eql("a-cc-recipient@world.com")
100
+ expect(subject.headers[:date]).to eql("Tue, 20 Apr 2021 14:06:13 +0000")
101
+ expect(subject.headers['message-id']).to eql("<607edfd56836e_1b0492af@1d3356d02030.mail>")
102
+ expect(subject.headers['mime-version']).to eql("1.0")
99
103
  end
100
104
 
101
105
  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.16
4
+ version: 0.20.17
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-25 00:00:00.000000000 Z
11
+ date: 2021-06-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake