tumblr_wrapper 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -0
- data/lib/tumblr_wrapper/client.rb +10 -1
- data/lib/tumblr_wrapper/version.rb +1 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -34,6 +34,7 @@ then authorize in browser here:
|
|
34
34
|
|
35
35
|
tumblr oauth is strict, you need to save the oauth verifier from the response:
|
36
36
|
|
37
|
+
client.request_token(request_token, request_token_secret) // set the request token again
|
37
38
|
access_token = client.access_token("OAUTH VERIFIER")
|
38
39
|
|
39
40
|
If you have the token and secret for your user:
|
@@ -1,5 +1,5 @@
|
|
1
1
|
class TumblrWrapper::Client
|
2
|
-
attr_reader :consumer
|
2
|
+
attr_reader :consumer
|
3
3
|
def initialize
|
4
4
|
@consumer = OAuth::Consumer.new(
|
5
5
|
TumblrWrapper.consumer_key,
|
@@ -21,6 +21,15 @@ class TumblrWrapper::Client
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
+
def request_token(token = nil, secret=nil)
|
25
|
+
if token && secret
|
26
|
+
OAuth::RequestToken.new(consumer, token, secret)
|
27
|
+
else
|
28
|
+
@request_token
|
29
|
+
end
|
30
|
+
@request_token
|
31
|
+
end
|
32
|
+
|
24
33
|
def access_token_from_hash(token_hash)
|
25
34
|
@access_token = OAuth::AccessToken.from_hash(consumer, token_hash)
|
26
35
|
end
|