lib/flickr_airlift.rb in flickr_airlift-0.0.2 vs lib/flickr_airlift.rb in flickr_airlift-0.0.3

- old
+ new

@@ -1,8 +1,9 @@ require 'rubygems' require 'flickraw' require 'net/http' +require 'cgi' module FlickrAirlift def self.download begin @@ -10,14 +11,21 @@ FlickRaw.api_key = "d4d152785af1b0ea68a5a2d173c75707" FlickRaw.shared_secret = "b9da0b4f99507dd0" frob = flickr.auth.getFrob auth_url = FlickRaw.auth_url :frob => frob, :perms => 'read' - # TODO: Use open if it's supported puts " " - puts "Open this url in your process to complete the authication process:" - puts auth_url - puts "Press Enter when you are finished." + if system("which open") + puts "opening your browser..." + sleep 1 + puts "Come back and press Enter when you are finished" + sleep 2 + system("open '#{auth_url}'") + else + puts "Open this url in your process to complete the authication process:" + puts auth_url + puts "Press Enter when you are finished." + end STDIN.getc # Authentication auth = flickr.auth.getToken :frob => frob login = flickr.test.login \ No newline at end of file