lita-tweet 0.4.1 → 0.4.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 +5 -5
- data/lib/lita/handlers/tweet.rb +3 -3
- data/lita-tweet.gemspec +1 -1
- data/spec/lita/handlers/tweet_spec.rb +22 -12
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 0a8381085cef7ac265ebdbee6861d7b06a116842a4043f4fcb9ab883ff842584
|
4
|
+
data.tar.gz: c2973b1a8602a946538116211895fe6860c967c022dbea8507c8bc76dc76323f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4cb282492f1fd3d3d4ccc50ce58e207f17714909281e8d9102f4e270d3e7d7e44367a8f0dbb3206832fd348781637cc91c504bd5dad65bc2e7a0efcf6f5cdc03
|
7
|
+
data.tar.gz: b3fd7b1ce959e4b996e8569e81db3c6588b03f77550b2a02168505b6fadc07a5f8dd5ad1f383033b02fd458cdefd8394357535dafdd6329222f856a2ed7b826e
|
data/lib/lita/handlers/tweet.rb
CHANGED
@@ -7,11 +7,11 @@ module Lita
|
|
7
7
|
config :consumer_secret, type: String
|
8
8
|
config :http_url
|
9
9
|
|
10
|
-
route %r{
|
10
|
+
route %r{\Atweet\s(.+)}m, :tweet, command: true, restrict_to: :tweeters,
|
11
11
|
help: {"tweet MESSAGE" => "Post a tweet."}
|
12
|
-
route %r{
|
12
|
+
route %r{\Auntweet}, :untweet, command: true, restrict_to: :tweeters,
|
13
13
|
help: {"untweet" => "Delete the last tweet."}
|
14
|
-
route %r{
|
14
|
+
route %r{\Atwitter accounts}, :accounts, command: true,
|
15
15
|
restrict_to: :tweeters, help: {
|
16
16
|
"twitter accounts" => "List accounts that can be tweeted from.",
|
17
17
|
"twitter accounts add" => "Authorize a new account for tweeting.",
|
data/lita-tweet.gemspec
CHANGED
@@ -30,6 +30,20 @@ describe Lita::Handlers::Tweet, lita_handler: true do
|
|
30
30
|
Lita::Authorization.new(registry.config).add_user_to_group!(source.user, :tweeters)
|
31
31
|
end
|
32
32
|
|
33
|
+
def expect_tweet(body)
|
34
|
+
stub_request(:post, "https://api.twitter.com/1.1/statuses/update.json").
|
35
|
+
with(body: {status: body}).to_return(status: 200, body: %q[{
|
36
|
+
"created_at": "Sun Aug 14 01:53:54 +0000 2016",
|
37
|
+
"id": 12345,
|
38
|
+
"text": "some text",
|
39
|
+
"user": {
|
40
|
+
"id": 123,
|
41
|
+
"screen_name": "handle",
|
42
|
+
"created_at": "Wed Nov 04 17:18:22 +0000 2009"
|
43
|
+
}
|
44
|
+
}])
|
45
|
+
end
|
46
|
+
|
33
47
|
describe "#tweet" do
|
34
48
|
context "without an authorized account" do
|
35
49
|
it "should complain" do
|
@@ -44,19 +58,15 @@ describe Lita::Handlers::Tweet, lita_handler: true do
|
|
44
58
|
end
|
45
59
|
|
46
60
|
it "should send a tweet" do
|
47
|
-
|
48
|
-
with(body: {status: "some text"}).to_return(status: 200, body: %q[{
|
49
|
-
"created_at": "Sun Aug 14 01:53:54 +0000 2016",
|
50
|
-
"id": 12345,
|
51
|
-
"text": "some text",
|
52
|
-
"user": {
|
53
|
-
"id": 123,
|
54
|
-
"screen_name": "handle",
|
55
|
-
"created_at": "Wed Nov 04 17:18:22 +0000 2009"
|
56
|
-
}
|
57
|
-
}])
|
61
|
+
expect_tweet("some text")
|
58
62
|
send_command("tweet some text")
|
59
|
-
expect(replies).to include("
|
63
|
+
expect(replies).to include("Tweet posted!")
|
64
|
+
end
|
65
|
+
|
66
|
+
it "should capture newlines" do
|
67
|
+
expect_tweet("para one\n\npara two")
|
68
|
+
send_command("tweet para one\n\npara two")
|
69
|
+
expect(replies).to include("Tweet posted!")
|
60
70
|
end
|
61
71
|
end
|
62
72
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lita-tweet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andre Arko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lita
|
@@ -118,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
118
|
version: '0'
|
119
119
|
requirements: []
|
120
120
|
rubyforge_project:
|
121
|
-
rubygems_version: 2.
|
121
|
+
rubygems_version: 2.7.6
|
122
122
|
signing_key:
|
123
123
|
specification_version: 4
|
124
124
|
summary: Allows the Lita chat bot to tweet on command
|