rubytter 0.10.3 → 0.11.0
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/README.rdoc +46 -18
- data/VERSION +1 -1
- data/examples/home_timeline.rb +14 -0
- data/lib/rubytter.rb +19 -2
- metadata +4 -2
data/README.rdoc
CHANGED
@@ -13,38 +13,66 @@ Rubytter is simple twitter library.
|
|
13
13
|
=== implemented API methods:
|
14
14
|
|
15
15
|
- /statuses/update
|
16
|
-
- /statuses/destroy
|
16
|
+
- /statuses/destroy/%s
|
17
17
|
- /statuses/public_timeline
|
18
|
+
- /statuses/home_timeline
|
18
19
|
- /statuses/friends_timeline
|
19
20
|
- /statuses/replies
|
20
|
-
- /statuses/
|
21
|
-
- /statuses/
|
22
|
-
- /statuses/
|
23
|
-
- /statuses/
|
24
|
-
- /
|
21
|
+
- /statuses/mentions
|
22
|
+
- /statuses/user_timeline/%s
|
23
|
+
- /statuses/show/%s
|
24
|
+
- /statuses/friends/%s
|
25
|
+
- /statuses/followers/%s
|
26
|
+
- /statuses/retweet/%s
|
27
|
+
- /statuses/retweets/%s
|
28
|
+
- /statuses/retweeted_by_me
|
29
|
+
- /statuses/retweeted_to_me
|
30
|
+
- /statuses/retweets_of_me
|
31
|
+
- /users/show/%s
|
25
32
|
- /direct_messages
|
26
33
|
- /direct_messages/sent
|
27
34
|
- /direct_messages/new
|
28
|
-
- /direct_messages/destroy
|
29
|
-
- /friendships/create
|
30
|
-
- /friendships/destroy
|
35
|
+
- /direct_messages/destroy/%s
|
36
|
+
- /friendships/create/%s
|
37
|
+
- /friendships/destroy/%s
|
31
38
|
- /friendships/exists
|
32
|
-
- /followers/ids
|
33
|
-
- /friends/ids
|
34
|
-
- /favorites
|
35
|
-
- /favorites/create
|
36
|
-
- /favorites/destroy
|
39
|
+
- /followers/ids/%s
|
40
|
+
- /friends/ids/%s
|
41
|
+
- /favorites/%s
|
42
|
+
- /favorites/create/%s
|
43
|
+
- /favorites/destroy/%s
|
37
44
|
- /account/verify_credentials
|
38
45
|
- /account/end_session
|
39
46
|
- /account/update_delivery_device
|
40
47
|
- /account/update_profile_colors
|
41
48
|
- /account/rate_limit_status
|
42
49
|
- /account/update_profile
|
43
|
-
- /notifications/follow
|
44
|
-
- /notifications/leave
|
45
|
-
- /blocks/create
|
46
|
-
- /blocks/destroy
|
50
|
+
- /notifications/follow/%s
|
51
|
+
- /notifications/leave/%s
|
52
|
+
- /blocks/create/%s
|
53
|
+
- /blocks/destroy/%s
|
54
|
+
- /blocks/exists/%s
|
55
|
+
- /blocks/blocking
|
56
|
+
- /blocks/blocking/ids
|
57
|
+
- /saved_searches
|
58
|
+
- /saved_searches/show/%s
|
59
|
+
- /saved_searches/create
|
60
|
+
- /saved_searches/destroy/%s
|
61
|
+
- /:user/lists (create)
|
62
|
+
- /:user/lists/%s (update)
|
63
|
+
- /:user/lists/%s (delete)
|
64
|
+
- /:user/lists
|
65
|
+
- /:user/lists/memberships
|
66
|
+
- /:user/lists/%s/statuses
|
67
|
+
- /:user/lists/%s
|
68
|
+
- /%s/%s/members
|
69
|
+
- /:user/%s/members
|
70
|
+
- /:user/%s/members
|
71
|
+
- /%s/%s/subscribers
|
72
|
+
- /%s/%s/subscribers
|
73
|
+
- /%s/%s/subscribers
|
47
74
|
- (search.twitter.com)/search
|
75
|
+
- (api.twitter.com)/1/users/search
|
48
76
|
|
49
77
|
== SYNOPSIS:
|
50
78
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.11.0
|
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
require 'rubygems'
|
4
|
+
require 'rubytter'
|
5
|
+
|
6
|
+
if ARGV.size < 2
|
7
|
+
puts "Usage: ruby #{File.basename(__FILE__)} user_id password"
|
8
|
+
exit
|
9
|
+
end
|
10
|
+
|
11
|
+
client = Rubytter.new(ARGV[0], ARGV[1])
|
12
|
+
client.home_timeline.each do |status|
|
13
|
+
puts "#{status.user.screen_name}: #{status.text}"
|
14
|
+
end
|
data/lib/rubytter.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
|
1
2
|
# -*- coding: utf-8 -*-
|
2
3
|
require 'rubygems'
|
3
4
|
require 'json'
|
@@ -38,6 +39,7 @@ class Rubytter
|
|
38
39
|
update_status /statuses/update post
|
39
40
|
remove_status /statuses/destroy/%s delete
|
40
41
|
public_timeline /statuses/public_timeline
|
42
|
+
home_timeline /statuses/home_timeline
|
41
43
|
friends_timeline /statuses/friends_timeline
|
42
44
|
replies /statuses/replies
|
43
45
|
mentions /statuses/mentions
|
@@ -45,6 +47,11 @@ class Rubytter
|
|
45
47
|
show /statuses/show/%s
|
46
48
|
friends /statuses/friends/%s
|
47
49
|
followers /statuses/followers/%s
|
50
|
+
retweet /statuses/retweet/%s post
|
51
|
+
retweets /statuses/retweets/%s
|
52
|
+
retweeted_by_me /statuses/retweeted_by_me
|
53
|
+
retweeted_to_me /statuses/retweeted_to_me
|
54
|
+
retweets_of_me /statuses/retweets_of_me
|
48
55
|
user /users/show/%s
|
49
56
|
direct_messages /direct_messages
|
50
57
|
sent_direct_messages /direct_messages/sent
|
@@ -55,7 +62,7 @@ class Rubytter
|
|
55
62
|
friendship_exists /friendships/exists
|
56
63
|
followers_ids /followers/ids/%s
|
57
64
|
friends_ids /friends/ids/%s
|
58
|
-
favorites /favorites
|
65
|
+
favorites /favorites/%s
|
59
66
|
favorite /favorites/create/%s post
|
60
67
|
remove_favorite /favorites/destroy/%s delete
|
61
68
|
verify_credentials /account/verify_credentials get
|
@@ -99,7 +106,9 @@ class Rubytter
|
|
99
106
|
def #{method}(*args)
|
100
107
|
path = login ? '#{path}'.gsub(':user', login) :'#{path}'
|
101
108
|
params = args.last.kind_of?(Hash) ? args.pop : {}
|
102
|
-
|
109
|
+
path = path % args
|
110
|
+
path.sub!(/\\/\\z/, '')
|
111
|
+
#{http_method}(path, params)
|
103
112
|
end
|
104
113
|
EOS
|
105
114
|
else
|
@@ -183,6 +192,14 @@ class Rubytter
|
|
183
192
|
)
|
184
193
|
end
|
185
194
|
|
195
|
+
def search_user(query, params = {})
|
196
|
+
path = '/1/users/search.json'
|
197
|
+
param_str = '?' + self.class.to_param_str(params.merge({:q => query}))
|
198
|
+
path = path + param_str unless param_str.empty?
|
199
|
+
req = create_request(Net::HTTP::Get.new(path))
|
200
|
+
self.class.structize(http_request("api.#{@host}", req))
|
201
|
+
end
|
202
|
+
|
186
203
|
def self.search_result_to_hash(json)
|
187
204
|
{
|
188
205
|
'id' => json['id'],
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubytter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jugyo
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-12-26 00:00:00 +09:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -49,6 +49,7 @@ files:
|
|
49
49
|
- examples/favorite.rb
|
50
50
|
- examples/follow.rb
|
51
51
|
- examples/friends_timeline.rb
|
52
|
+
- examples/home_timeline.rb
|
52
53
|
- examples/limit.rb
|
53
54
|
- examples/lists.rb
|
54
55
|
- examples/replies.rb
|
@@ -96,6 +97,7 @@ test_files:
|
|
96
97
|
- examples/favorite.rb
|
97
98
|
- examples/follow.rb
|
98
99
|
- examples/friends_timeline.rb
|
100
|
+
- examples/home_timeline.rb
|
99
101
|
- examples/limit.rb
|
100
102
|
- examples/lists.rb
|
101
103
|
- examples/replies.rb
|