cinch-twitter 0.2.0 → 0.3.1
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.
- data/CHANGELOG.md +3 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +2 -2
- data/README.md +4 -2
- data/VERSION +1 -1
- data/cinch-twitter.gemspec +5 -5
- data/lib/cinch/plugins/twitter/formatter.rb +6 -11
- data/lib/cinch/plugins/twitter/tweet_handler.rb +1 -1
- metadata +5 -5
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -21,7 +21,7 @@ GEM
|
|
21
21
|
rdoc (3.12)
|
22
22
|
json (~> 1.4)
|
23
23
|
simple_oauth (0.1.8)
|
24
|
-
twitter (
|
24
|
+
twitter (3.1.1)
|
25
25
|
faraday (~> 0.8)
|
26
26
|
multi_json (~> 1.3)
|
27
27
|
simple_oauth (~> 0.1.6)
|
@@ -36,5 +36,5 @@ DEPENDENCIES
|
|
36
36
|
cinch (>= 2.0.3)
|
37
37
|
jeweler (~> 1.8.4)
|
38
38
|
rdoc (~> 3.12)
|
39
|
-
twitter (>=
|
39
|
+
twitter (>= 3.0.0)
|
40
40
|
yard (~> 0.7)
|
data/README.md
CHANGED
@@ -12,14 +12,16 @@ Usage
|
|
12
12
|
* `?ts [term]` - Searches for three of the most recent tweets regarding the specified query
|
13
13
|
|
14
14
|
Shorthand commands are also available:
|
15
|
-
* `@[username]<+D>`,
|
15
|
+
* `@[username]<+D>`, `@#[id]`
|
16
|
+
|
17
|
+
If for instance, an error occurs (such as a timeout, an account is protected, or can't be found), the plugin will send a notice with an informative message.
|
16
18
|
|
17
19
|
Requiring and including the plugin
|
18
20
|
----------------------------------
|
19
21
|
require 'cinch/plugins/twitter'
|
20
22
|
# ...
|
21
23
|
Bot.config {|c|
|
22
|
-
|
24
|
+
# ...
|
23
25
|
c.plugins.plugins << Cinch::Plugins::Twitter
|
24
26
|
|
25
27
|
Configuration
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.1
|
data/cinch-twitter.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "cinch-twitter"
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.3.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Mark Seymour"]
|
12
|
-
s.date = "2012-
|
12
|
+
s.date = "2012-07-10"
|
13
13
|
s.description = "A Twitter plugin for Cinch."
|
14
14
|
s.email = "mark.seymour.ns@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -43,7 +43,7 @@ Gem::Specification.new do |s|
|
|
43
43
|
|
44
44
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
45
45
|
s.add_runtime_dependency(%q<activesupport>, [">= 3.0.0"])
|
46
|
-
s.add_runtime_dependency(%q<twitter>, [">=
|
46
|
+
s.add_runtime_dependency(%q<twitter>, [">= 3.0.0"])
|
47
47
|
s.add_runtime_dependency(%q<cinch>, [">= 2.0.3"])
|
48
48
|
s.add_development_dependency(%q<yard>, ["~> 0.7"])
|
49
49
|
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
@@ -51,7 +51,7 @@ Gem::Specification.new do |s|
|
|
51
51
|
s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
|
52
52
|
else
|
53
53
|
s.add_dependency(%q<activesupport>, [">= 3.0.0"])
|
54
|
-
s.add_dependency(%q<twitter>, [">=
|
54
|
+
s.add_dependency(%q<twitter>, [">= 3.0.0"])
|
55
55
|
s.add_dependency(%q<cinch>, [">= 2.0.3"])
|
56
56
|
s.add_dependency(%q<yard>, ["~> 0.7"])
|
57
57
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
@@ -60,7 +60,7 @@ Gem::Specification.new do |s|
|
|
60
60
|
end
|
61
61
|
else
|
62
62
|
s.add_dependency(%q<activesupport>, [">= 3.0.0"])
|
63
|
-
s.add_dependency(%q<twitter>, [">=
|
63
|
+
s.add_dependency(%q<twitter>, [">= 3.0.0"])
|
64
64
|
s.add_dependency(%q<cinch>, [">= 2.0.3"])
|
65
65
|
s.add_dependency(%q<yard>, ["~> 0.7"])
|
66
66
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
@@ -8,11 +8,11 @@ module Cinch
|
|
8
8
|
module Formatter
|
9
9
|
|
10
10
|
def format_tweet(tweet)
|
11
|
-
tweet_text = expand_uris(tweet.
|
11
|
+
tweet_text = expand_uris(tweet.full_text, tweet.urls)
|
12
12
|
parts, head, body, tail, urls = [], [], [], [], []
|
13
13
|
head = Cinch::Formatting.format(:bold,"#{tweet.user.screen_name} »")
|
14
14
|
body << CGI::unescapeHTML(tweet_text.gsub("\n", " ").squeeze(" "))
|
15
|
-
body << Cinch::Formatting.format(:aqua,"*twoosh*") if tweet.
|
15
|
+
body << Cinch::Formatting.format(:aqua,"*twoosh*") if tweet.full_text.length == 140
|
16
16
|
tail << "From #{tweet.place.full_name}" if !tweet.place.blank?
|
17
17
|
tail << "at #{tweet.created_at.strftime("%B %-d, %Y, %-I:%m%P")}"
|
18
18
|
tail << "via #{tweet.source.gsub( %r{</?[^>]+?>}, '' )}"
|
@@ -24,11 +24,11 @@ module Cinch
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def format_search(tweet)
|
27
|
-
tweet_text = expand_uris(tweet.
|
27
|
+
tweet_text = expand_uris(tweet.full_text, tweet.urls)
|
28
28
|
parts, head, body, tail, urls = [], [], [], [], []
|
29
29
|
head = Cinch::Formatting.format(:bold,"#{tweet.from_user} »")
|
30
30
|
body << CGI::unescapeHTML(tweet_text.gsub("\n", " ").squeeze(" "))
|
31
|
-
body << Cinch::Formatting.format(:aqua,"*twoosh*") if tweet.
|
31
|
+
body << Cinch::Formatting.format(:aqua,"*twoosh*") if tweet.full_text.length == 140
|
32
32
|
tail << "at #{tweet.created_at.strftime("%B %-d, %Y, %-I:%m%P")}"
|
33
33
|
urls << "https://twitter.com/#{tweet.from_user}"
|
34
34
|
parts = [head, body, ["(", tail.join(" "), ")"].join, urls].flatten
|
@@ -36,7 +36,7 @@ module Cinch
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def format_tweep_info(tweep)
|
39
|
-
tweep_status_text = expand_uris(tweep.status.
|
39
|
+
tweep_status_text = expand_uris(tweep.status.full_text, tweep.status.urls)
|
40
40
|
head = "#{Cinch::Formatting.format(:aqua,tweep.name)}" + Cinch::Formatting.format(:silver," (#{tweep.screen_name})") + Cinch::Formatting.format(:grey," - #{tweep.url} https://twitter.com/#{tweep.screen_name}")
|
41
41
|
bio = ""
|
42
42
|
bio = Cinch::Formatting.format(:aqua,"\"#{tweep.description.strip}\"") if !tweep.description.blank?
|
@@ -66,12 +66,7 @@ module Cinch
|
|
66
66
|
private
|
67
67
|
|
68
68
|
def expand_uris t, uris
|
69
|
-
tweet
|
70
|
-
uris.each {|u|
|
71
|
-
expanded_url, url = u["expanded_url"], u["url"]
|
72
|
-
tweet.gsub! url, expanded_url
|
73
|
-
}
|
74
|
-
return tweet
|
69
|
+
uris.each_with_object(t) {|entity,tweet| tweet.gsub!(entity.url, entity.expanded_url) }
|
75
70
|
end
|
76
71
|
|
77
72
|
end
|
@@ -58,7 +58,7 @@ module Cinch
|
|
58
58
|
params = {term: "cat"}.merge(params)
|
59
59
|
begin
|
60
60
|
results = []
|
61
|
-
::Twitter.search(params[:term], include_entities: true, rpp: 3, result_type: "recent").each {|status|
|
61
|
+
::Twitter.search(params[:term], include_entities: true, rpp: 3, result_type: "recent").results.each {|status|
|
62
62
|
params[:username] = status.from_user
|
63
63
|
results << format_search(status)
|
64
64
|
}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cinch-twitter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-07-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -34,7 +34,7 @@ dependencies:
|
|
34
34
|
requirements:
|
35
35
|
- - ! '>='
|
36
36
|
- !ruby/object:Gem::Version
|
37
|
-
version:
|
37
|
+
version: 3.0.0
|
38
38
|
type: :runtime
|
39
39
|
prerelease: false
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -42,7 +42,7 @@ dependencies:
|
|
42
42
|
requirements:
|
43
43
|
- - ! '>='
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version:
|
45
|
+
version: 3.0.0
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
47
|
name: cinch
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
@@ -160,7 +160,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
160
160
|
version: '0'
|
161
161
|
segments:
|
162
162
|
- 0
|
163
|
-
hash:
|
163
|
+
hash: 257628495
|
164
164
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
165
165
|
none: false
|
166
166
|
requirements:
|