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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: '04582ac09a828fb3ff82c0648149a54c7cc66c32'
4
- data.tar.gz: c0e62a2f6a9c230a387fe20359b372bd4dfeb766
3
+ metadata.gz: 26d1ee76f37d142256f3dc8af6725a5261736012
4
+ data.tar.gz: '09c50fb5d9fe3c066969b1d61b2ba2a18c200402'
5
5
  SHA512:
6
- metadata.gz: 3aa2d71bfcde9c463dd144f9e77fb3738500426bd2e8be72bffa38a044ea8556c629fa31991217916172d35c37ca17fd4965f9ec64c1896746370300c80d36ee
7
- data.tar.gz: c9fa0490c0292083f127e8fae60f87697a64857863ce48bbe928a93fd67a68d5bfb6bca201ce3d20e5c1ee62b24353ef47d305d51eb592dab4f21de3f7cce839
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
- uri = response.matches[0][0]
27
- doc = RestClient.get uri
28
- noko_doc = Nokogiri::HTML doc
29
- title = noko_doc.xpath('//title').text.to_s
30
- Lita.logger.debug response.message.source.room
31
- Lita.logger.debug title
32
- response.reply title
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.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.}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-onewheel-twitter-photo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kreps