rightsignature 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
data/README.md
CHANGED
@@ -39,14 +39,14 @@ request_token = @rs_connection.new_request_token
|
|
39
39
|
|
40
40
|
Now Visit the url generated from
|
41
41
|
```
|
42
|
-
@rs_oauth =
|
42
|
+
@rs_oauth = @rs_connection.oauth_connection
|
43
43
|
@rs_oauth.request_token.authorize_url
|
44
44
|
```
|
45
45
|
and log into the site.
|
46
46
|
|
47
47
|
After approving the application, you will be redirected to the callback url that is in the RightSignature API settings (https://rightsignature.com/oauth_clients). The OAuth verifier should be in the params "oauth_verifier". Put the verifier in:
|
48
48
|
```
|
49
|
-
@rs_oauth =
|
49
|
+
@rs_oauth = @rs_connection.oauth_connection
|
50
50
|
@rs_oauth.generate_access_token(params[:oauth_verifer])
|
51
51
|
```
|
52
52
|
|
@@ -62,6 +62,11 @@ You can also load the Access Token and Secret by calling
|
|
62
62
|
@rs_oauth.set_access_token(token, secret)
|
63
63
|
```
|
64
64
|
|
65
|
+
If you need to set the Request Token for the OAuth Consumer:
|
66
|
+
```
|
67
|
+
@rs_oauth.set_request_token(token, secret)
|
68
|
+
```
|
69
|
+
|
65
70
|
After loading the configuration, you can use wrappers in RightSignature::Connection to call the API, or use RightSignature::Connection for more custom calls.
|
66
71
|
|
67
72
|
Documents
|
@@ -58,6 +58,14 @@ module RightSignature
|
|
58
58
|
def new_request_token
|
59
59
|
@request_token = oauth_consumer.get_request_token
|
60
60
|
end
|
61
|
+
|
62
|
+
# Sets request token.
|
63
|
+
# * <b>request_token</b>: request token key
|
64
|
+
# * <b>request_token_secret</b>: request token secret
|
65
|
+
#
|
66
|
+
def set_request_token(request_token, request_token_secret)
|
67
|
+
@request_token = OAuth::RequestToken.new(oauth_consumer, request_token, request_token_secret)
|
68
|
+
end
|
61
69
|
|
62
70
|
# Uses request token and given OAuth verifier to generate an access token. Requires a request token to be set.
|
63
71
|
# * <b>oauth_verifier</b>: OAuth verifier
|
@@ -77,6 +77,15 @@ describe RightSignature::OauthConnection do
|
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
80
|
+
describe "set_request_token" do
|
81
|
+
it "should create RequestToken with given token and secret" do
|
82
|
+
oauth_connection = RightSignature::OauthConnection.new({:consumer_key => "Consumer123", :consumer_secret => "Secret098"})
|
83
|
+
oauth_connection.set_request_token('request1', 'secret2')
|
84
|
+
oauth_connection.request_token.token.should == 'request1'
|
85
|
+
oauth_connection.request_token.secret.should == 'secret2'
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
80
89
|
describe "generate_access_token" do
|
81
90
|
before do
|
82
91
|
@oauth_connection = RightSignature::OauthConnection.new({:consumer_key => "Consumer123", :consumer_secret => "Secret098"})
|