facebookcl 0.2.3 → 0.2.4

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.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/facebookcl.gemspec +1 -1
  3. data/lib/facebookcl.rb +15 -8
  4. metadata +3 -3
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.3
1
+ 0.2.4
data/facebookcl.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{facebookcl}
8
- s.version = "0.2.3"
8
+ s.version = "0.2.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Justin Bishop"]
data/lib/facebookcl.rb CHANGED
@@ -13,7 +13,7 @@ module FacebookCL; class << self
13
13
  APP_ID = 119412046078
14
14
  SERVER_PORT = 6682
15
15
  GRAPH_URL = 'graph.facebook.com'
16
- NEXT_URL = 'http://www.dev.facebook.com/connect/facebook_cl.php'
16
+ NEXT_URL = 'http://127.0.0.1:6682'
17
17
 
18
18
  attr_accessor :uid
19
19
 
@@ -24,8 +24,7 @@ module FacebookCL; class << self
24
24
  self.access_token = data['access_token']
25
25
  self.uid = data['uid']
26
26
  else
27
- auth_url = "https://#{GRAPH_URL}/oauth/authorize?client_id=#{APP_ID}&redirect_uri=#{NEXT_URL}&scope=publish_stream,create_event,offline_access,email,read_stream,read_mailbox"
28
-
27
+ auth_url = "https://#{GRAPH_URL}/oauth/authorize?client_id=#{APP_ID}&redirect_uri=#{NEXT_URL}&type=user_agent&display=page&scope=publish_stream,create_event,offline_access,email,read_stream,read_mailbox"
29
28
  if (RUBY_PLATFORM.downcase.include?("darwin"))
30
29
  `open '#{auth_url}'`
31
30
  else
@@ -35,18 +34,26 @@ Welcome New User! You need to auth this application. So please visit here in y
35
34
  #{auth_url}}
36
35
  end
37
36
 
38
- session = TCPServer.new('127.0.0.1', SERVER_PORT).accept
37
+ server = TCPServer.new('127.0.0.1', SERVER_PORT)
38
+ session = server.accept
39
39
  session.print "HTTP/1.1 200/OK\r\nContent-type:text/html\r\n\r\n"
40
- request = session.gets.strip
40
+ session.gets
41
+ session.print "<script>
42
+ window.location.replace(window.location.toString().replace('#', '?'))
43
+ </script>"
44
+ session.close
41
45
 
42
- session.print 'Success! ' +
43
- 'You can close this window and return to FacebookCL now.'
46
+ session = server.accept
47
+ session.print "HTTP/1.1 200/OK\r\nContent-type:text/html\r\n\r\n"
48
+ request = session.gets.strip
49
+ session.print "Success! " +
50
+ "You can now close this window and return to FacebookCL."
44
51
  session.close
52
+ server.close
45
53
 
46
54
  self.access_token = request.
47
55
  gsub(/^GET \/\?access_token=/, '').
48
56
  gsub(/ HTTP.*$/, '')
49
-
50
57
  self.uid = get('me')['id']
51
58
 
52
59
  puts "Saving authentication data to #{config_filename}"
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: facebookcl
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 31
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 3
10
- version: 0.2.3
9
+ - 4
10
+ version: 0.2.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Justin Bishop