moomerman-twitter_oauth 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
data/lib/twitter_oauth/client.rb
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
module TwitterOAuth
|
2
2
|
class Client
|
3
3
|
|
4
|
-
def friends_ids
|
5
|
-
|
4
|
+
def friends_ids(options={})
|
5
|
+
args = options.map{|k,v| "#{k}=#{v}"}.join('&')
|
6
|
+
oauth_response = access_token.get("/friends/ids.json?#{args}")
|
6
7
|
JSON.parse(oauth_response.body)
|
7
8
|
end
|
8
9
|
|
9
|
-
def followers_ids
|
10
|
-
|
10
|
+
def followers_ids(options={})
|
11
|
+
args = options.map{|k,v| "#{k}=#{v}"}.join('&')
|
12
|
+
oauth_response = access_token.get("/followers/ids.json?#{args}")
|
11
13
|
JSON.parse(oauth_response.body)
|
12
14
|
end
|
13
15
|
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module TwitterOAuth
|
2
|
+
class Client
|
3
|
+
|
4
|
+
# Returns a single status, specified by the id parameter below.
|
5
|
+
def status(id)
|
6
|
+
oauth_response = access_token.get("/statuses/show/#{id}.json")
|
7
|
+
JSON.parse(oauth_response.body)
|
8
|
+
end
|
9
|
+
|
10
|
+
# Updates the authenticating user's status.
|
11
|
+
def update(message, options={})
|
12
|
+
oauth_response = access_token.post('/statuses/update.json', options.merge(:status => message))
|
13
|
+
JSON.parse(oauth_response.body)
|
14
|
+
end
|
15
|
+
|
16
|
+
# Destroys the status specified by the required ID parameter
|
17
|
+
def status_destroy(id)
|
18
|
+
oauth_response = access_token.post("/statuses/destroy/#{id}.json")
|
19
|
+
JSON.parse(oauth_response.body)
|
20
|
+
end
|
21
|
+
|
22
|
+
# Retweets the tweet specified by the id parameter. Returns the original tweet with retweet details embedded.
|
23
|
+
def retweet(id)
|
24
|
+
oauth_response = access_token.post("/statuses/retweet/#{id}.json")
|
25
|
+
JSON.parse(oauth_response.body)
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
@@ -2,80 +2,61 @@ module TwitterOAuth
|
|
2
2
|
class Client
|
3
3
|
|
4
4
|
# Returns the 20 most recent statuses from non-protected users who have set a custom user icon.
|
5
|
-
def public_timeline
|
6
|
-
|
5
|
+
def public_timeline(options={})
|
6
|
+
args = options.map{|k,v| "#{k}=#{v}"}.join('&')
|
7
|
+
oauth_response = access_token.get("/statuses/public_timeline.json?#{args}")
|
7
8
|
JSON.parse(oauth_response.body)
|
8
9
|
end
|
9
10
|
|
10
11
|
# Returns the 20 most recent statuses, including retweets, posted by the authenticating user and that user's friends.
|
11
12
|
# This is the equivalent of /timeline/home on the Web.
|
12
|
-
def home_timeline
|
13
|
-
|
13
|
+
def home_timeline(options={})
|
14
|
+
args = options.map{|k,v| "#{k}=#{v}"}.join('&')
|
15
|
+
oauth_response = access_token.get("/statuses/home_timeline.json?#{args}")
|
14
16
|
JSON.parse(oauth_response.body)
|
15
17
|
end
|
16
18
|
|
17
19
|
# Returns the 20 most recent statuses posted by the authenticating user and that user's friends.
|
18
|
-
def friends_timeline(
|
19
|
-
|
20
|
+
def friends_timeline(options={})
|
21
|
+
args = options.map{|k,v| "#{k}=#{v}"}.join('&')
|
22
|
+
oauth_response = access_token.get("/statuses/friends_timeline.json?#{args}")
|
20
23
|
JSON.parse(oauth_response.body)
|
21
24
|
end
|
22
25
|
|
23
26
|
# Returns the 20 most recent statuses posted from the authenticating user.
|
24
|
-
def
|
25
|
-
|
26
|
-
|
27
|
-
end
|
28
|
-
|
29
|
-
# Returns a single status, specified by the id parameter below.
|
30
|
-
def status(id)
|
31
|
-
oauth_response = access_token.get("/statuses/show/#{id}.json")
|
32
|
-
JSON.parse(oauth_response.body)
|
33
|
-
end
|
34
|
-
|
35
|
-
# Updates the authenticating user's status.
|
36
|
-
def update(message)
|
37
|
-
oauth_response = access_token.post('/statuses/update.json', :status => message)
|
27
|
+
def user_timeline(options={})
|
28
|
+
args = options.map{|k,v| "#{k}=#{v}"}.join('&')
|
29
|
+
oauth_response = access_token.get("/statuses/user_timeline.json?#{args}")
|
38
30
|
JSON.parse(oauth_response.body)
|
39
31
|
end
|
32
|
+
alias :user :user_timeline
|
40
33
|
|
41
34
|
# Returns the 20 most recent @replies (status updates prefixed with @username) for the authenticating user.
|
42
|
-
def
|
43
|
-
|
44
|
-
|
45
|
-
end
|
46
|
-
|
47
|
-
# Retweets the tweet specified by the id parameter. Returns the original tweet with retweet details embedded.
|
48
|
-
def retweet(id)
|
49
|
-
oauth_response = access_token.post("/statuses/retweet/#{id}.json")
|
35
|
+
def mentions(options={})
|
36
|
+
args = options.map{|k,v| "#{k}=#{v}"}.join('&')
|
37
|
+
oauth_response = access_token.get("/statuses/mentions.json?#{args}")
|
50
38
|
JSON.parse(oauth_response.body)
|
51
39
|
end
|
40
|
+
alias :replies :mentions
|
52
41
|
|
53
42
|
# Returns the 20 most recent retweets posted by the authenticating user
|
54
|
-
def retweeted_by_me
|
55
|
-
|
43
|
+
def retweeted_by_me(options={})
|
44
|
+
args = options.map{|k,v| "#{k}=#{v}"}.join('&')
|
45
|
+
oauth_response = access_token.get("/statuses/retweeted_by_me.json?#{args}")
|
56
46
|
JSON.parse(oauth_response.body)
|
57
47
|
end
|
58
48
|
|
59
49
|
# Returns the 20 most recent retweets posted by the authenticating user's friends.
|
60
|
-
def retweeted_to_me
|
61
|
-
|
50
|
+
def retweeted_to_me(options={})
|
51
|
+
args = options.map{|k,v| "#{k}=#{v}"}.join('&')
|
52
|
+
oauth_response = access_token.get("/statuses/retweeted_to_me.json?#{args}")
|
62
53
|
JSON.parse(oauth_response.body)
|
63
54
|
end
|
64
55
|
|
65
56
|
# Returns the 20 most recent tweets of the authenticated user that have been retweeted by others.
|
66
|
-
def retweets_of_me
|
67
|
-
|
68
|
-
|
69
|
-
end
|
70
|
-
|
71
|
-
# alias
|
72
|
-
def mentions
|
73
|
-
replies
|
74
|
-
end
|
75
|
-
|
76
|
-
# Destroys the status specified by the required ID parameter
|
77
|
-
def status_destroy(id)
|
78
|
-
oauth_response = access_token.post("/statuses/destroy/#{id}.json")
|
57
|
+
def retweets_of_me(options={})
|
58
|
+
args = options.map{|k,v| "#{k}=#{v}"}.join('&')
|
59
|
+
oauth_response = access_token.get("/statuses/retweets_of_me.json?#{args}")
|
79
60
|
JSON.parse(oauth_response.body)
|
80
61
|
end
|
81
62
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: moomerman-twitter_oauth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Taylor
|
@@ -55,8 +55,9 @@ files:
|
|
55
55
|
- lib/twitter_oauth
|
56
56
|
- lib/twitter_oauth.rb
|
57
57
|
- lib/twitter_oauth/client.rb
|
58
|
+
- lib/twitter_oauth/timeline.rb
|
58
59
|
- lib/twitter_oauth/account.rb
|
59
|
-
- lib/twitter_oauth/
|
60
|
+
- lib/twitter_oauth/status.rb
|
60
61
|
- lib/twitter_oauth/direct_messages.rb
|
61
62
|
- lib/twitter_oauth/search.rb
|
62
63
|
- lib/twitter_oauth/blocks.rb
|