social_current 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/social_current/{github.rb → github_service.rb} +1 -1
- data/lib/social_current/stream.rb +1 -1
- data/lib/social_current/{twitter.rb → twitter_service.rb} +4 -2
- data/lib/social_current/version.rb +1 -1
- data/lib/social_current.rb +3 -2
- data/social_current.gemspec +3 -2
- data/test/{test_github.rb → test_github_service.rb} +2 -2
- data/test/test_stream.rb +1 -1
- data/test/{test_twitter.rb → test_twitter_service.rb} +3 -3
- metadata +23 -7
@@ -6,7 +6,7 @@ module SocialCurrent
|
|
6
6
|
|
7
7
|
def build
|
8
8
|
@stream ||= @options.collect do |k, v|
|
9
|
-
eval("SocialCurrent::" + k.to_s.capitalize).new(v).stream
|
9
|
+
eval("SocialCurrent::" + k.to_s.capitalize + "Service").new(v).stream
|
10
10
|
end.flatten.sort_by { |k, v| k[:created_at] }.reject { |k, v| k[:message].nil? }.reverse
|
11
11
|
end
|
12
12
|
end
|
@@ -1,6 +1,8 @@
|
|
1
1
|
module SocialCurrent
|
2
|
-
class
|
2
|
+
class TwitterService < Service
|
3
3
|
include HTTParty
|
4
|
+
include Twitter::Autolink
|
5
|
+
|
4
6
|
base_uri "https://api.twitter.com/1"
|
5
7
|
|
6
8
|
def raw_user
|
@@ -20,7 +22,7 @@ module SocialCurrent
|
|
20
22
|
private
|
21
23
|
|
22
24
|
def format_message(status)
|
23
|
-
"#{raw_user["name"]} said \"#{status["text"]}\""
|
25
|
+
auto_link("#{raw_user["name"]} said \"#{status["text"]}\"")
|
24
26
|
end
|
25
27
|
end
|
26
28
|
end
|
data/lib/social_current.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
require "httparty"
|
2
2
|
require "json"
|
3
3
|
require "tmpdir"
|
4
|
+
require "twitter-text"
|
4
5
|
|
5
6
|
require "social_current/version"
|
6
7
|
require "social_current/service"
|
7
|
-
require "social_current/
|
8
|
-
require "social_current/
|
8
|
+
require "social_current/github_service"
|
9
|
+
require "social_current/twitter_service"
|
9
10
|
require "social_current/stream"
|
data/social_current.gemspec
CHANGED
@@ -14,6 +14,7 @@ Gem::Specification.new do |gem|
|
|
14
14
|
gem.require_paths = ["lib"]
|
15
15
|
gem.version = SocialCurrent::VERSION
|
16
16
|
|
17
|
-
gem.add_runtime_dependency "httparty",
|
18
|
-
gem.
|
17
|
+
gem.add_runtime_dependency "httparty", "~> 0.8.3"
|
18
|
+
gem.add_runtime_dependency "twitter-text", "~> 1.4.17"
|
19
|
+
gem.add_development_dependency "fakeweb", "~> 1.3.0"
|
19
20
|
end
|
@@ -2,11 +2,11 @@ require "test_helper"
|
|
2
2
|
|
3
3
|
class TestGithub < Test::Unit::TestCase
|
4
4
|
def setup
|
5
|
-
@github = SocialCurrent::
|
5
|
+
@github = SocialCurrent::GithubService.new("tristanoneil")
|
6
6
|
end
|
7
7
|
|
8
8
|
def test_initialize
|
9
|
-
assert_instance_of SocialCurrent::
|
9
|
+
assert_instance_of SocialCurrent::GithubService, @github
|
10
10
|
assert_respond_to @github, :raw_stream
|
11
11
|
end
|
12
12
|
|
data/test/test_stream.rb
CHANGED
@@ -11,7 +11,7 @@ class TestStream < Test::Unit::TestCase
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def test_build
|
14
|
-
assert_equal "Tristan O'Neil said \"Was thinking
|
14
|
+
assert_equal "Tristan O'Neil said \"Was thinking @<a class=\"tweet-url username\" href=\"https://twitter.com/gristmilled\" rel=\"nofollow\">gristmilled</a> should put on a \"How to write a Ruby Gem\" course. It may just directly benefit me. Any interest in <a href=\"https://twitter.com/#!/search?q=%23btv\" title=\"#btv\" class=\"tweet-url hashtag\" rel=\"nofollow\">#btv</a>?\"", @stream.build[0][:message]
|
15
15
|
assert_equal 42, @stream.build.size
|
16
16
|
end
|
17
17
|
end
|
@@ -2,11 +2,11 @@ require "test_helper"
|
|
2
2
|
|
3
3
|
class TestTwitter < Test::Unit::TestCase
|
4
4
|
def setup
|
5
|
-
@twitter = SocialCurrent::
|
5
|
+
@twitter = SocialCurrent::TwitterService.new("tristanoneil")
|
6
6
|
end
|
7
7
|
|
8
8
|
def test_initialize
|
9
|
-
assert_instance_of SocialCurrent::
|
9
|
+
assert_instance_of SocialCurrent::TwitterService, @twitter
|
10
10
|
assert_respond_to @twitter, :raw_stream
|
11
11
|
end
|
12
12
|
|
@@ -19,7 +19,7 @@ class TestTwitter < Test::Unit::TestCase
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def test_stream
|
22
|
-
assert_equal "Tristan O'Neil said \"Was thinking
|
22
|
+
assert_equal "Tristan O'Neil said \"Was thinking @<a class=\"tweet-url username\" href=\"https://twitter.com/gristmilled\" rel=\"nofollow\">gristmilled</a> should put on a \"How to write a Ruby Gem\" course. It may just directly benefit me. Any interest in <a href=\"https://twitter.com/#!/search?q=%23btv\" title=\"#btv\" class=\"tweet-url hashtag\" rel=\"nofollow\">#btv</a>?\"", @twitter.stream[0][:message]
|
23
23
|
assert_equal "2012-05-16 13:59:57 UTC", @twitter.stream[0][:created_at].to_s
|
24
24
|
assert_equal 13, @twitter.stream.size
|
25
25
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: social_current
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -27,6 +27,22 @@ dependencies:
|
|
27
27
|
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: 0.8.3
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: twitter-text
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 1.4.17
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 1.4.17
|
30
46
|
- !ruby/object:Gem::Dependency
|
31
47
|
name: fakeweb
|
32
48
|
requirement: !ruby/object:Gem::Requirement
|
@@ -57,20 +73,20 @@ files:
|
|
57
73
|
- README.md
|
58
74
|
- Rakefile
|
59
75
|
- lib/social_current.rb
|
60
|
-
- lib/social_current/
|
76
|
+
- lib/social_current/github_service.rb
|
61
77
|
- lib/social_current/service.rb
|
62
78
|
- lib/social_current/stream.rb
|
63
|
-
- lib/social_current/
|
79
|
+
- lib/social_current/twitter_service.rb
|
64
80
|
- lib/social_current/version.rb
|
65
81
|
- social_current.gemspec
|
66
82
|
- test/support/github/stream.json
|
67
83
|
- test/support/github/user.json
|
68
84
|
- test/support/twitter/stream.json
|
69
85
|
- test/support/twitter/user.json
|
70
|
-
- test/
|
86
|
+
- test/test_github_service.rb
|
71
87
|
- test/test_helper.rb
|
72
88
|
- test/test_stream.rb
|
73
|
-
- test/
|
89
|
+
- test/test_twitter_service.rb
|
74
90
|
homepage:
|
75
91
|
licenses: []
|
76
92
|
post_install_message:
|
@@ -101,7 +117,7 @@ test_files:
|
|
101
117
|
- test/support/github/user.json
|
102
118
|
- test/support/twitter/stream.json
|
103
119
|
- test/support/twitter/user.json
|
104
|
-
- test/
|
120
|
+
- test/test_github_service.rb
|
105
121
|
- test/test_helper.rb
|
106
122
|
- test/test_stream.rb
|
107
|
-
- test/
|
123
|
+
- test/test_twitter_service.rb
|