lita-onewheel-twitter-photo 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lita/handlers/onewheel_twitter_photo.rb +10 -7
- data/lita-onewheel-twitter-photo.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 26d1ee76f37d142256f3dc8af6725a5261736012
|
4
|
+
data.tar.gz: '09c50fb5d9fe3c066969b1d61b2ba2a18c200402'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff9c2e0ac213ea263fe7b0cd61b53884ac14b39a6737813d35a3cbe714c87b2192659bc326fcdb9f78c260d98566b44c18936b145a917c37fbebdceb26141c23
|
7
|
+
data.tar.gz: 85b900758bad81bbd552f98a8742aea5fae6782833d795af96fecc6e540d02fd2798640e5ae9742d317659618e426f9eed837ec6ec74acf8e57c05f7930af3ac
|
@@ -4,6 +4,8 @@ require 'rest-client'
|
|
4
4
|
module Lita
|
5
5
|
module Handlers
|
6
6
|
class OnewheelTwitterPhoto < Handler
|
7
|
+
config :room, required: true
|
8
|
+
|
7
9
|
route /(http.*twitter.com\/.*\/status\/\d+)/i, :get_twitter_title
|
8
10
|
|
9
11
|
def get_twitter_photo(response)
|
@@ -23,13 +25,14 @@ module Lita
|
|
23
25
|
end
|
24
26
|
|
25
27
|
def get_twitter_title(response)
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
28
|
+
if response.message.source.room == config.room
|
29
|
+
uri = response.matches[0][0]
|
30
|
+
doc = RestClient.get uri
|
31
|
+
noko_doc = Nokogiri::HTML doc
|
32
|
+
title = noko_doc.xpath('//title').text.to_s
|
33
|
+
Lita.logger.debug title
|
34
|
+
response.reply title
|
35
|
+
end
|
33
36
|
end
|
34
37
|
|
35
38
|
Lita.register_handler(self)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = 'lita-onewheel-twitter-photo'
|
3
|
-
spec.version = '0.1.
|
3
|
+
spec.version = '0.1.2'
|
4
4
|
spec.authors = ['Andrew Kreps']
|
5
5
|
spec.email = ['andrew.kreps@gmail.com']
|
6
6
|
spec.description = %q{Lita interface to post links to twitter photos.}
|