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 +4 -4
- data/README.md +25 -3
- data/lib/akane/storages/imkayac.rb +1 -1
- data/lib/akane-imkayac/version.rb +1 -1
- data/spec/imkayac_spec.rb +12 -0
- metadata +1 -2
- data/lib/akane/imkayac.rb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b5f3b9d4393a71aef08adf5d2469244c3a0fd26
|
4
|
+
data.tar.gz: cb6b4e9ff764cda573f4710a1897201fc996bcc3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f2342663271e350fddd1ee266bb95be3214eb51e829872aa901f9739c036f6f38643dc43661c3736ea3e71f078a58b8000a51c73fdf87d695a7c0ada910fc6b
|
7
|
+
data.tar.gz: 7d7715b8a50910061449ad376dd8a852236b60104deed1b5d0fc33a3894af96cb2eab9ed5f3dff7ee306c411957b0a94456f6ea412563cfc353ceabf81a96477
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
#
|
1
|
+
# akane-imkayac - storage plugin for akane that post matched tweet to im.kayac.com
|
2
2
|
|
3
|
-
|
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
|
-
|
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"].
|
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), }
|
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.
|
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
|