Top Level Namespace
Defined Under Namespace
Modules: Hangout
Classes: String
Instance Method Summary
collapse
Instance Method Details
#authorize(client_id, redirect_uri) ⇒ Object
1
2
3
|
# File 'lib/hangout/auth.rb', line 1
def authorize client_id, redirect_uri
`open https://foursquare.com/oauth2/authenticate?client_id=#{client_id}&response_type=token&redirect_uri=#{redirect_uri}`
end
|
#get_user_token ⇒ Object
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/hangout/auth.rb', line 5
def get_user_token
if File.exists? CONFIG_FILE
File.read CONFIG_FILE
else
puts "Well shucks, looks like you haven't used this little app before."
puts "I'm going to open the browser now and grab a number for you. Could"
puts "you do me a favour and paste it in here?"
puts
puts "<Press return to open your browser...>"
gets
authorize CLIENT_ID, REDIRECT_URI
puts "Paste the key in here:"
key = gets
File.new(CONFIG_FILE) do |f|
f.write(key)
end
end
end
|