Class: Upcoming::Auth
Class Method Summary collapse
-
.check_token(token) ⇒ Object
Retrieve a full token from Upcoming, from just the token code.
-
.token(frob) ⇒ Object
Retrieve a token from the site, after the user has given your app an authentication Frob.
-
.token_code(token) ⇒ Object
Extracts the token code from a token hash.
Methods included from Defaults
Class Method Details
.check_token(token) ⇒ Object
Retrieve a full token from Upcoming, from just the token code. This method should also be called on saved tokens before proceeding to access user data, in order to verify that the token has not expired and is valid.
token
(Required) The token code to check.
Step 1: Set up your callback url: upcoming.yahoo.com/services/api/keygen.php
Step 2: Call upcoming.yahoo.com/services/auth/?api_key=Your API Key
Step 3: Catch the frob querystring parameter on your callback page and pass to Auth.token
28 29 30 31 |
# File 'lib/upcoming/auth.rb', line 28 def self.check_token(token) token = Upcoming::Auth.token_code(token) Mash.new(self.get('/', :query => {:method => 'auth.checkToken', :token => token}.merge(Upcoming.))).rsp.token.first end |
.token(frob) ⇒ Object
Retrieve a token from the site, after the user has given your app an authentication Frob
frob
(Required) The frob passed back to your application.
10 11 12 |
# File 'lib/upcoming/auth.rb', line 10 def self.token(frob) Mash.new(self.get('/', :query => {:method => 'auth.getToken', :frob => frob}.merge(Upcoming.))).rsp.token.first end |
.token_code(token) ⇒ Object
Extracts the token code from a token hash
35 36 37 |
# File 'lib/upcoming/auth.rb', line 35 def self.token_code(token) token.is_a?(Hash) ? token['token'] : token end |