postgarnet 1.0.3 → 1.0.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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/postgarnet.rb +8 -2
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 271a04be208146d3bb3c4e705d049d02ccdf6fbd104d171ff83ad548379bfc18
4
- data.tar.gz: 1b9b7ff07abe7f4314321409c8726cc433e11349c5727b424400ca48991c5988
3
+ metadata.gz: 9941e185008d258ea17607ab5b40881c84fa288f0fa2048d7eaefed20394d1d7
4
+ data.tar.gz: 1b4b5c7d7cf62df9722044838e4f0ce1de792ed7080c09ebe98d621219b2da26
5
5
  SHA512:
6
- metadata.gz: 1c89bef7166ffbd7ca165c08f1842944b62a8d5ea001d7865a568599f273108641ed35cfe571f3008b1221250723181a2be864daa9f225eaf490c784283b77b2
7
- data.tar.gz: c1093b6c03e7d6303b5990d5a813e6e4278ca6e2946e2efb0e2a5dba48e759f006d3bdac77681f24acf993314d254b92628f679cae5cf76438370086aec70af5
6
+ metadata.gz: df75d7317b258d8d3e6a14a6c04fe9714298febfaad36931b90898146271755e7859f40184600e5e679afe4127bc8ac11d7c0bc89cd3212e536285d35bbd1954
7
+ data.tar.gz: 26c445b1b0b2eb82d02e469f995f78bcedffbe79b4657c81ab50bf578ad311a180970647eec554f326646f245a3257e0fe448b17bea0e9d1df4e5c772971c2bb
data/lib/postgarnet.rb CHANGED
@@ -13,7 +13,7 @@ class TransactionError < StandardError
13
13
  end
14
14
 
15
15
  class Postgarnet
16
- @@version = "1.0.3"
16
+ @@version = "1.0.4"
17
17
 
18
18
  def initialize(username:, password:)
19
19
  @username, @password, @subject, @content, @recipient, @author = @username, @smtp = nil
@@ -103,6 +103,9 @@ class Postgarnet
103
103
  begin
104
104
  @smtp = Net::SMTP.new(host, port)
105
105
  @smtp.enable_starttls
106
+ if block_given?
107
+ block.call
108
+ end
106
109
  rescue Exception => e
107
110
  raise TransactionError, "Error when connecting: #{e}"
108
111
  else
@@ -137,7 +140,7 @@ class Postgarnet
137
140
  return @smtp
138
141
  end
139
142
 
140
- def send(client="localhost")
143
+ def send(client="localhost", &block)
141
144
  if [@username, @password, @author, @recipient, @subject, @content].any?(&:nil?)
142
145
  raise FormatError, "Incomplete parameters"
143
146
  end
@@ -148,6 +151,9 @@ class Postgarnet
148
151
  message = self.create_msg
149
152
  @smtp.start(client, @username, @password, :plain) do
150
153
  @smtp.send_message(message, @username, @recipient)
154
+ if block_given?
155
+ block.call
156
+ end
151
157
  end
152
158
  rescue Exception => e
153
159
  raise TransactionError, "Error when sending: #{e}"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: postgarnet
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - trulyursdelv