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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e6e898aebdc8cb4642bee3fce34f206a03cff896
4
- data.tar.gz: ceb00944a8cb45895f8cb0c23ae44e73592d2618
3
+ metadata.gz: b6620e478dd2ef58bfab3ff9f1aac61a8db11b1f
4
+ data.tar.gz: 603f7dae54eb007364b9cb588196d19b9d0f6524
5
5
  SHA512:
6
- metadata.gz: c37aad291ce1bace2cd30c90a57f6867dab4603ae28353c9f545078bf793d46ca5b0c661de5d18188825cf7703561532c4e965e37c4950f7acc29fac015eac18
7
- data.tar.gz: 08dfa58ac59a9224d54bf0d34628c90e456c8337027a2b6f96179916e0aa6b9f38ca0fa10d8be1d3b5851a9fda2a405ca3d6cca0afb0619d158bccaf089fd7af
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
 
@@ -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"], attachments:["picture.jpg", "spreadsheet.csv"], skip_error: false})
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
@@ -1,3 +1,3 @@
1
1
  module Artichoke
2
- VERSION = '0.0.93'
2
+ VERSION = '0.0.94'
3
3
  end
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.93
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-02-08 00:00:00.000000000 Z
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