moomerman-twitter_oauth 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/twitter_oauth.rb +0 -4
- data/lib/twitter_oauth/client.rb +15 -1
- metadata +1 -1
data/lib/twitter_oauth.rb
CHANGED
data/lib/twitter_oauth/client.rb
CHANGED
@@ -7,6 +7,16 @@ module TwitterOAuth
|
|
7
7
|
@secret = options[:secret]
|
8
8
|
end
|
9
9
|
|
10
|
+
def login(token, secret)
|
11
|
+
request_token = OAuth::RequestToken.new(
|
12
|
+
consumer, token, secret
|
13
|
+
)
|
14
|
+
@access_token = request_token.get_access_token
|
15
|
+
@token = @access_token.token
|
16
|
+
@secret = @access_token.secret
|
17
|
+
@access_token
|
18
|
+
end
|
19
|
+
|
10
20
|
def show(username = @username)
|
11
21
|
oauth_response = access_token.get("/users/show/#{username}.json")
|
12
22
|
JSON.parse(oauth_response.body)
|
@@ -31,7 +41,11 @@ module TwitterOAuth
|
|
31
41
|
oauth_response = access_token.post('/direct_messages/new.format', :user => user, :text => text)
|
32
42
|
JSON.parse(oauth_response.body)
|
33
43
|
end
|
34
|
-
|
44
|
+
|
45
|
+
def request_token
|
46
|
+
consumer.get_request_token
|
47
|
+
end
|
48
|
+
|
35
49
|
private
|
36
50
|
def consumer
|
37
51
|
@consumer ||= OAuth::Consumer.new(
|