akane-imkayac 0.0.1 → 0.0.2

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: bd49543bd49ef4ab2bba3396875e3b90679356fb
4
- data.tar.gz: f36a64cee9c99f744be4c42d557aa5131a7bded2
3
+ metadata.gz: 1b5f3b9d4393a71aef08adf5d2469244c3a0fd26
4
+ data.tar.gz: cb6b4e9ff764cda573f4710a1897201fc996bcc3
5
5
  SHA512:
6
- metadata.gz: aeb16720d67c435eea156ad39471e40b8fde3973fa51e679c9b34f6218a3e41bbe6f7ebfcae00499b4ccc488ec97335f786a1276dac34076c66f12fccbfa9e4c
7
- data.tar.gz: 31283f3d3b904b431f322eb8ceba7558a558ef3a0a867d2b8735a9fa7ce71aca40bcf83337ea5162432f74974375f7ad30e0daa8f9545df2288c6e7281124357
6
+ metadata.gz: 0f2342663271e350fddd1ee266bb95be3214eb51e829872aa901f9739c036f6f38643dc43661c3736ea3e71f078a58b8000a51c73fdf87d695a7c0ada910fc6b
7
+ data.tar.gz: 7d7715b8a50910061449ad376dd8a852236b60104deed1b5d0fc33a3894af96cb2eab9ed5f3dff7ee306c411957b0a94456f6ea412563cfc353ceabf81a96477
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # Akane::Imkayac
1
+ # akane-imkayac - storage plugin for akane that post matched tweet to im.kayac.com
2
2
 
3
- TODO: Write a gem description
3
+ Storage plugin gem for [akane](https://github.com/sorah/akane), that posts matched tweets to im.kayac.com for notification.
4
4
 
5
5
  ## Installation
6
6
 
@@ -18,7 +18,29 @@ Or install it yourself as:
18
18
 
19
19
  ## Usage
20
20
 
21
- TODO: Write usage instructions here
21
+ In your akane configuration yaml:
22
+
23
+ ```
24
+ storages:
25
+ - imkayac:
26
+ user: <im kayac user name>
27
+ # password: <your password (optional)>
28
+ # secret: <your secret key (optional)>
29
+ # handler: <handler erb template>
30
+ # message: <message erb template>
31
+ keywords:
32
+ - keyword to notify 1
33
+ - keyword to notify 2
34
+ - ...
35
+ excludes:
36
+ - keyword to exclude 1
37
+ - keyword to exclude 2
38
+ - ...
39
+ ```
40
+
41
+ I set `'tweetbot:///status/<%= tweet.id %>'` to handler for Tweetbot.
42
+
43
+ `handler` and `message` params are evaluated as ERB. Variable `account` and `tweet` (`Twitter::Tweet`) is available.
22
44
 
23
45
  ## Contributing
24
46
 
@@ -42,7 +42,7 @@ module Akane
42
42
  unless tweet.text &&
43
43
  !tweet.retweet? &&
44
44
  @config["excludes"].all? { |_| ! tweet.text.include?(_.to_s) } &&
45
- @config["keywords"].all? { |_| tweet.text.include?(_.to_s) }
45
+ @config["keywords"].any? { |_| tweet.text.include?(_.to_s) }
46
46
  return
47
47
  end
48
48
  payload = { message: ERB.new(@config["message"]).result(binding), }
@@ -1,3 +1,3 @@
1
1
  module AkaneImkayac
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/spec/imkayac_spec.rb CHANGED
@@ -49,6 +49,18 @@ describe Akane::Storages::Imkayac do
49
49
  end
50
50
  end
51
51
 
52
+ context "when multiple keyword given, and tweet matched to one of them" do
53
+ let(:config) { base_config.merge("keywords" => %w(foobar keyword)) }
54
+
55
+ it "sends" do
56
+ subject.record_tweet('tester', tweet)
57
+
58
+ expect(a_request(:post, "#{endpoint}/tester").with(
59
+ body: {message: '[tw] user: keyword'}
60
+ )).to have_been_made
61
+ end
62
+ end
63
+
52
64
  context "when matched both keywords and ignored keywords" do
53
65
  let(:tweet_text) { 'keyword ignore' }
54
66
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: akane-imkayac
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shota Fukumori (sora_h)
@@ -96,7 +96,6 @@ files:
96
96
  - akane-imkayac.gemspec
97
97
  - lib/akane-imkayac.rb
98
98
  - lib/akane-imkayac/version.rb
99
- - lib/akane/imkayac.rb
100
99
  - lib/akane/storages/imkayac.rb
101
100
  - spec/imkayac_spec.rb
102
101
  - spec/spec_helper.rb
data/lib/akane/imkayac.rb DELETED
@@ -1,7 +0,0 @@
1
- require "akane/imkayac/version"
2
-
3
- module Akane
4
- module Imkayac
5
- # Your code goes here...
6
- end
7
- end