lib/flickr/auth.rb in commonthread-flickr_fu-0.1.6 vs lib/flickr/auth.rb in commonthread-flickr_fu-0.2.0
- old
+ new
@@ -5,10 +5,15 @@
# get or return a frob to use for authentication
def frob
@frob ||= get_frob
end
+
+ # set the frob
+ def frob= frob
+ @frob=frob
+ end
# generates the authorization url to allow access to a flickr account.
#
# Params
# * perms (Optional)
@@ -56,10 +61,12 @@
rsp.frob.to_s
end
def get_token(pass_through)
- if @flickr.token_cache and File.exists?(@flickr.token_cache)
+ if @flickr.token
+ @flickr.token
+ elsif @flickr.token_cache and File.exists?(@flickr.token_cache)
YAML.load_file(@flickr.token_cache)
elsif pass_through
rsp = @flickr.send_request('flickr.auth.getToken', {:frob => self.frob})
Token.new(:token => rsp.auth.token.to_s, :permisions => rsp.auth.perms.to_s, :user_id => rsp.auth.user[:nsid], :username => rsp.auth.user[:username], :user_real_name => rsp.auth.user[:fullname])
\ No newline at end of file