postgarnet 1.0.5 → 1.0.6

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 +13 -2
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 50e9b339bd0beab74b01bd084f83ffebc12edd6cff5d87acd5351161ed794eb4
4
- data.tar.gz: c7599a67576e8289dad00e0fb6ddf7066490341f3ad8b9c935c5a34752b0a2fc
3
+ metadata.gz: a20076359cea5248f326df4b18f3506c328cc0e5784bdc09db9caad9882b49ac
4
+ data.tar.gz: 932a12ba077441f69ad5cf74958998e43c05c9d411c256c327f65714c8c0942a
5
5
  SHA512:
6
- metadata.gz: 7a6018c2ca7e8a0921bf396f3d1fbfa7495681d18778370562e54347568b7b51a8c0e24c08e481999e1c26306ceea0c12a912717851e8c7214f721cac20cc07b
7
- data.tar.gz: 1b59281dad022649f737f3c5fac56f3d1f2e66d5c8dcbdf6174a95097a5a64f213599d4362c10b7ac4b42b215d1e040f603b9034233ede2297fa414ddb5234b2
6
+ metadata.gz: 99d6b3b8f81fb870fe9baab7155a6634f7bc5f0f6828e6cf543b9cda88f788d408cd8981ca217bd518a425661ec6af1bdbbeb14deefee5f796bc93e9f1e89c3b
7
+ data.tar.gz: 3535244da7d04081782d4258fb16c4f15e3dba474559e3a3b25a4c63a1fe32448fb453765eba7948294a96da951ec318515e52304aef5fccca09f3f8f77b842b
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.5"
16
+ @@version = "1.0.6"
17
17
 
18
18
  def initialize(username: nil, password: nil)
19
19
  @username, @password, @subject, @content, @recipient, @author = @username, @smtp = nil
@@ -130,11 +130,21 @@ class Postgarnet
130
130
  return @username.clone
131
131
  end
132
132
 
133
+ def logout
134
+ if @username.nil? && @password.nil?
135
+ raise TransactionError, "No account to log out"
136
+ end
137
+ unless @smtp.nil?
138
+ raise TransactionError, "To log out, disconnect to the server first."
139
+ end
140
+ @username = nil
141
+ @password = nil
142
+ end
143
+
133
144
  def disconnect
134
145
  if @smtp.nil?
135
146
  raise TransactionError, "No connection to disconnect"
136
147
  end
137
- @smtp.finish
138
148
  @smtp = nil
139
149
  end
140
150
 
@@ -159,6 +169,7 @@ class Postgarnet
159
169
  if block_given?
160
170
  block.call
161
171
  end
172
+ true
162
173
  end
163
174
  rescue Exception => e
164
175
  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.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - trulyursdelv