watirmark_email 1.3.1 → 1.3.2

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
  SHA1:
3
- metadata.gz: bb366bfcf3fab9ccfcc228545902f2c27b6b95e6
4
- data.tar.gz: 25d666f434e75c7e26454177a529c38bb90b3c76
3
+ metadata.gz: 97ec9e6825fcf1b1e0273c1168b0e13aed8628c4
4
+ data.tar.gz: 0e82308d2868089ed42603ce6ad938a67e76661c
5
5
  SHA512:
6
- metadata.gz: 25ea7b742c9c6d989d5cdcf7b76991113d04d1d09c701af78f9d85cbd1d94e59bd307cadeb842a3bcc444c2560271ac2e0065e1399c0ed2c6b9009ba718b6984
7
- data.tar.gz: 7e32bea10309b1bb6d4103851da24ab1b71d9c7bf1e3c75828c626c721760beeff6a45dbd2db5587ed567632f060a48c3b6cf7887ab1b54316fce1995b754ffc
6
+ metadata.gz: 7ab6b3dc26a7a0a31e6924e9c22c965f8dfa6e81f4cdd9a74baf370b2c549a8c3a3e31e7f05f959638461dae8782971045600733facc17eba1179e6d3cb327a5
7
+ data.tar.gz: c7a7d3c1d6f09e83e3b7fa776e8412d39a6a689452edf344f772af031aec20ff681404807088e0c99240cec81fee8e3b4457239569e1da749e17ca121b71797b
@@ -133,6 +133,34 @@ module WatirmarkEmail
133
133
  end
134
134
  attachment
135
135
  end
136
+
137
+ def get_email_attachment_file(search_array, timeout=600)
138
+ attachment_file = nil
139
+ finished = false
140
+ ::Timeout.timeout(timeout) do
141
+ @log.debug("start Timeout block for #{timeout} seconds")
142
+ loop do
143
+ begin
144
+ imap = connect
145
+ msgs = imap.search(search_array)
146
+ if (msgs && msgs.length > 0)
147
+ msgs.each do |msgID|
148
+ attachment_file = Base64.decode64(imap.fetch(msgID, "BODY[#{2}]")[0].attr["BODY[#{2}]"])
149
+ finished = true
150
+ end
151
+ end
152
+ rescue => e
153
+ @log.info("Error connecting to IMAP: #{e.message}")
154
+ ensure
155
+ disconnect(imap) unless imap.nil? # because sometimes the timeout happens before imap is defined
156
+ end
157
+ break if finished
158
+ @log.debug("Couldn't find email yet ... trying again")
159
+ sleep 10
160
+ end
161
+ end
162
+ attachment_file
163
+ end
136
164
  end
137
165
  end
138
166
 
@@ -1,7 +1,7 @@
1
1
  module WatirmarkEmail
2
2
  module VERSION
3
3
  NAME = 'watirmark_email'
4
- STRING = '1.3.1'
4
+ STRING = '1.3.2'
5
5
  SUMMARY = "#{NAME}-#{STRING}"
6
6
  end
7
7
  end
data/spec/spec_helper.rb CHANGED
@@ -12,5 +12,3 @@ require 'watirmark_email'
12
12
  # username: <supply your own>
13
13
  # password: <not telling>
14
14
  CREDENTIALS = YAML.load_file(File.join(File.dirname(__FILE__), "email_server_credentials.yaml"))
15
-
16
- alias :context :describe
@@ -24,7 +24,7 @@ describe "WatirmarkEmail::QAMail" do
24
24
 
25
25
  it 'should send an email to qamail' do
26
26
  e = WatirmarkEmail::QAMail.new(@username, @password)
27
- e.send_email(@send_to, :subject => 'UNIT TEST MESSAGE', :body => "Watirmark Email test message").should be_true
27
+ e.send_email(@send_to, :subject => 'UNIT TEST MESSAGE', :body => "Watirmark Email test message").should == true
28
28
  end
29
29
 
30
30
  it "should get a sample email with 'Watirmark Email test message' in the body of the email" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: watirmark_email
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alan Baird
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-01 00:00:00.000000000 Z
11
+ date: 2016-01-26 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: watirmark_email lets you get email from both GMAIL and generic IMAP servers
14
14
  email: abaird@convio.com
@@ -35,23 +35,22 @@ require_paths:
35
35
  - lib
36
36
  required_ruby_version: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  required_rubygems_version: !ruby/object:Gem::Requirement
42
42
  requirements:
43
- - - '>='
43
+ - - ">="
44
44
  - !ruby/object:Gem::Version
45
45
  version: '0'
46
46
  requirements: []
47
47
  rubyforge_project:
48
- rubygems_version: 2.4.8
48
+ rubygems_version: 2.4.6
49
49
  signing_key:
50
50
  specification_version: 4
51
- summary: watirmark_email-1.3.1
51
+ summary: watirmark_email-1.3.2
52
52
  test_files:
53
53
  - spec/get_emails_spec.rb
54
54
  - spec/spec_helper.rb
55
55
  - spec/watirmark_email_gmail_spec.rb
56
56
  - spec/watirmark_email_qamail_spec.rb
57
- has_rdoc: