eco-helpers 2.1.3 → 2.1.4

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: bd18bdf6133a2fa0ccc023a3bdf11140b9af98364bfa6327f171e93373ee51f0
4
- data.tar.gz: 4918192e55fe12081ba8db062b2bdcaf8afd1058732a93d23cd1180015af623a
3
+ metadata.gz: ca676558c0e1a885b1f9e15d68e3c4f3688b90713c88182854b426a8ce1bf447
4
+ data.tar.gz: 41e8693e90664d7789040dd2dab66521e330693a9ae62f7bb5c5bc2dbd940911
5
5
  SHA512:
6
- metadata.gz: 8bdd14bfa761ce494c920bd4242d49b9bfb37eb91b2021a7f1d4799b10e09a3d0af66491aca287c8d15874d436a77e9e94e4b1237e3925795b48b2df7876ec92
7
- data.tar.gz: 06cc22d088ef35c755ed554578c58357782443a48ba0542fe21c13dc332b87123fb244bd8f98f805e9801b011cec309e33166c57876c7456cb101bf1bbd37867
6
+ metadata.gz: 65b5157cc78ff3016f932283e2f0504e46681e15dc2acd902bb0e6188af98f5fe5271ad0db49a48fe969c642df3146daffeffcb0008dda3012433450dbbc1e87
7
+ data.tar.gz: 3a23f58986631f819b18bd8395ec92c321e9cb21bfde172a3e565df309cdad3b759d1d60f8c4bf52cff29332b49607f30afad19c90a80c5f9fb974637c3b218e
data/CHANGELOG.md CHANGED
@@ -1,19 +1,24 @@
1
1
  # Change Log
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
- ## [2.1.4] - 2022-10-xx
4
+ ## [2.1.5] - 2022-10-xx
5
5
 
6
6
  ### Added
7
7
  ### Changed
8
8
  ### Fixed
9
9
 
10
+ ## [2.1.4] - 2022-10-20
11
+
12
+ ### Added
13
+ - `Eco::API::Common::Session::Mailer#mail` added parameters `cc` and `bcc`
14
+
10
15
  ## [2.1.3] - 2022-10-11
11
16
 
12
17
  ### Added
13
18
  - `Eco::API::UseCases::OozeSamples::OozeBaseCase`
14
19
  - `with_fields`, `with_sections` and `add_field` accept an `entry` parameter
15
20
  - also did some internal refactor
16
-
21
+
17
22
  ### Changed
18
23
  - Upgraded `ecoportal-api-v2` **gem**
19
24
 
@@ -16,11 +16,9 @@ module Eco
16
16
  # @param to [String] destination email address
17
17
  # @param subject [String] subject of the email
18
18
  # @param body [String] `html` or plain text message
19
- def mail(to: nil, subject:, body:)
19
+ def mail(to: nil, subject:, body:, cc: nil, bcc: nil)
20
20
  ses.send_email(
21
- destination: {
22
- to_addresses: [fetch_to(to)].flatten,
23
- },
21
+ destination: fetch_destination(to: to, cc: cc, bcc: bcc),
24
22
  source: fetch_from,
25
23
  message: {
26
24
  subject: {
@@ -64,6 +62,15 @@ module Eco
64
62
  @enviro.config || {}
65
63
  end
66
64
 
65
+ def fetch_destination(to: nil, cc: nil, bcc: nil)
66
+ cc_to = [cc].flatten.compact.uniq
67
+ bcc_to = [bcc].flatten.compact.uniq
68
+ { to_addresses: [fetch_to(to)].flatten }.tap do |dest|
69
+ dest.merge!(cc_addresses: cc_to) unless cc_to.empty?
70
+ dest.merge!(bcc_addresses: bcc_to) unless bcc_to.empty?
71
+ end
72
+ end
73
+
67
74
  def fetch_to(value = nil)
68
75
  value || config.mailer.to
69
76
  end
data/lib/eco/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Eco
2
- VERSION = "2.1.3"
2
+ VERSION = "2.1.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eco-helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.3
4
+ version: 2.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oscar Segura