hangout 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +1 -0
- data/Gemfile.lock +3 -0
- data/bin/hangout +3 -1
- data/hangout.gemspec +2 -1
- data/lib/hangout/auth.rb +20 -7
- metadata +15 -4
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -13,6 +13,8 @@ GEM
|
|
13
13
|
faraday_middleware (>= 0.8)
|
14
14
|
hashie (~> 1.0)
|
15
15
|
hashie (1.2.0)
|
16
|
+
launchy (2.0.5)
|
17
|
+
addressable (~> 2.2.6)
|
16
18
|
minitest (2.11.3)
|
17
19
|
multipart-post (1.1.5)
|
18
20
|
rack (1.4.1)
|
@@ -24,5 +26,6 @@ PLATFORMS
|
|
24
26
|
DEPENDENCIES
|
25
27
|
foursquare2
|
26
28
|
hashie
|
29
|
+
launchy
|
27
30
|
minitest
|
28
31
|
rake
|
data/bin/hangout
CHANGED
@@ -11,7 +11,9 @@ CLIENT_ID = "KBLF31MGQW5WFW3RUH5CLL2QBXG1JG2L0DEJLIY1S5MXPFX0"
|
|
11
11
|
REDIRECT_URI = "http://xoeb.us/hangout/callback"
|
12
12
|
CONFIG_FILE = File.expand_path("~/.foursquare")
|
13
13
|
|
14
|
-
client = Foursquare2::Client.new(
|
14
|
+
client = Foursquare2::Client.new(
|
15
|
+
:oauth_token => get_user_token(CONFIG_FILE, CLIENT_ID, REDIRECT_URI)
|
16
|
+
)
|
15
17
|
|
16
18
|
recent_checkins = client.recent_checkins :afterTimestamp => Time.now.to_i - 14400
|
17
19
|
|
data/hangout.gemspec
CHANGED
@@ -3,7 +3,7 @@ $:.unshift lib unless $:.include?(lib)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "hangout"
|
6
|
-
s.version = "0.0.
|
6
|
+
s.version = "0.0.3"
|
7
7
|
s.platform = Gem::Platform::RUBY
|
8
8
|
s.executables = ['hangout']
|
9
9
|
s.authors = ["Chris Brown"]
|
@@ -13,6 +13,7 @@ Gem::Specification.new do |s|
|
|
13
13
|
s.description = "Find foursquare friends that have checked in nearby you recently. More features soon."
|
14
14
|
|
15
15
|
s.add_dependency('foursquare2')
|
16
|
+
s.add_dependency('launchy')
|
16
17
|
|
17
18
|
s.require_path = 'lib'
|
18
19
|
s.bindir = 'bin'
|
data/lib/hangout/auth.rb
CHANGED
@@ -1,22 +1,35 @@
|
|
1
|
+
require 'launchy'
|
2
|
+
|
1
3
|
def authorize client_id, redirect_uri
|
2
|
-
|
4
|
+
uri = authorize_url client_id, redirect_uri
|
5
|
+
Launchy.open("#{uri.scheme}://#{uri.host}#{uri.request_uri}")
|
6
|
+
end
|
7
|
+
|
8
|
+
def authorize_url client_id, redirect_uri
|
9
|
+
url = "https://foursquare.com/oauth2/authenticate?response_type=token&client_id=#{client_id}&redirect_uri=#{redirect_uri}"
|
10
|
+
URI(url)
|
3
11
|
end
|
4
12
|
|
5
|
-
def get_user_token
|
6
|
-
if File.exists?
|
7
|
-
File.read CONFIG_FILE
|
8
|
-
else
|
13
|
+
def get_user_token config_file, client_id, redirect_uri
|
14
|
+
if !File.exists? config_file
|
9
15
|
puts "Well shucks, looks like you haven't used this little app before."
|
10
16
|
puts "I'm going to open the browser now and grab a number for you. Could"
|
11
17
|
puts "you do me a favour and paste it in here?"
|
12
18
|
puts
|
19
|
+
puts "(It's the big long string after `access_token=` in your URL bar.)"
|
20
|
+
puts
|
13
21
|
puts "<Press return to open your browser...>"
|
14
22
|
gets
|
15
|
-
authorize
|
23
|
+
authorize client_id, redirect_uri
|
16
24
|
puts "Paste the key in here:"
|
17
25
|
key = gets
|
18
|
-
File.
|
26
|
+
File.open(config_file, "w") do |f|
|
19
27
|
f.write(key)
|
20
28
|
end
|
29
|
+
|
30
|
+
puts "Thanks, please re-run the application."
|
31
|
+
exit 0
|
21
32
|
end
|
33
|
+
|
34
|
+
File.read config_file
|
22
35
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hangout
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-03-
|
12
|
+
date: 2012-03-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: foursquare2
|
16
|
-
requirement: &
|
16
|
+
requirement: &70171453051440 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,18 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70171453051440
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: launchy
|
27
|
+
requirement: &70171453049880 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70171453049880
|
25
36
|
description: Find foursquare friends that have checked in nearby you recently. More
|
26
37
|
features soon.
|
27
38
|
email:
|