artichoke 0.0.93 → 0.0.94
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 +4 -4
- data/README.md +6 -0
- data/lib/artichoke/poller.rb +3 -2
- data/lib/artichoke/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6620e478dd2ef58bfab3ff9f1aac61a8db11b1f
|
4
|
+
data.tar.gz: 603f7dae54eb007364b9cb588196d19b9d0f6524
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f90faf2a5a81fd257e2fbc89c727d06dc073a6ae2a02800c41e820c8a530d7dc68b98b880332a9b8d803f73eaa440563ff9b393ccb9204d1f707f58a64f75d1f
|
7
|
+
data.tar.gz: 6f72b433c6e58a213c4c3eb69d08924e5dbe54935e9e454c676cad24d4ab12ca6c7d76a32642732ec31a61c2e74c41bf86911dee65b010922585bdc5211818b4
|
data/README.md
CHANGED
@@ -36,7 +36,13 @@ This is best used prior to an action that should trigger the email you want to e
|
|
36
36
|
# You can pass in a defined timeout period for the poller to execute
|
37
37
|
# and if not defined, it will default to 75 seconds.
|
38
38
|
email = @poller.find({message_subject: "Ninjas are coming!!", timeout: 30})
|
39
|
+
|
40
|
+
|
41
|
+
### Partial subject match
|
39
42
|
|
43
|
+
# By default, artichoke will only find emails with exact match of the email's subject.
|
44
|
+
# You can pass in a flag for allowing emails with partial subject matches
|
45
|
+
email = @poller.find({message_subject: "Ninjas are", timeout: 30, partial_subject_match: true})
|
40
46
|
|
41
47
|
### Find email by subject and content(s)
|
42
48
|
|
data/lib/artichoke/poller.rb
CHANGED
@@ -23,7 +23,8 @@ module Artichoke
|
|
23
23
|
end
|
24
24
|
|
25
25
|
|
26
|
-
### poller.find({message_subject: "Sample Email", timeout:75, content:["specific positioning", "footer"],
|
26
|
+
### poller.find({message_subject: "Sample Email", timeout:75, content:["specific positioning", "footer"],
|
27
|
+
### attachments:["picture.jpg", "spreadsheet.csv"], skip_error: false, partial_subject_match: true})
|
27
28
|
def find(options={})
|
28
29
|
raise ArgumentError.new("Email Subject required") unless options[:message_subject]
|
29
30
|
begin
|
@@ -37,7 +38,7 @@ module Artichoke
|
|
37
38
|
end
|
38
39
|
@gmail.inbox.emails(:gm => gm_string).each do |email|
|
39
40
|
message = email.message
|
40
|
-
if (message.date.to_i >= @gmail_start_time.to_i) && (message.subject == options[:message_subject])
|
41
|
+
if (message.date.to_i >= @gmail_start_time.to_i) && (options[:partial_subject_match] || message.subject == options[:message_subject])
|
41
42
|
body = (message.text_part.try(:decoded) || message.html_part.try(:decoded) || message.body.to_s.force_encoding('utf-8'))
|
42
43
|
return Message.new(message) if (options[:content]|| []).all?{|c| body =~ /#{Regexp.escape(c)}/}
|
43
44
|
end
|
data/lib/artichoke/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: artichoke
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.94
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathaniel Ritholtz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-gmail-nritholtz
|