rest-graph 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +9 -1
- data/README.rdoc +1 -1
- data/example/rails/app/controllers/application_controller.rb +1 -1
- data/example/rails/app/views/{rest-graph.erb → rest-graph/authorization.erb} +0 -0
- data/lib/rest-graph.rb +6 -5
- data/lib/rest-graph/load_config.rb +1 -1
- data/lib/rest-graph/{rails_controller.rb → rails_util.rb} +3 -1
- data/lib/rest-graph/version.rb +1 -1
- data/rest-graph.gemspec +6 -8
- data/test/test_oauth.rb +5 -0
- data/test/test_parse.rb +2 -2
- metadata +7 -7
data/CHANGES
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
= rest-graph changes history
|
2
2
|
|
3
|
-
== rest-graph 1.2.
|
3
|
+
== rest-graph 1.2.1 -- 2010-06-02
|
4
|
+
* Deprecated RailsController, use RailsUtil instead.
|
5
|
+
* Fixed a bug that passing access_token in query string
|
6
|
+
in RestGraph#authorize_url
|
7
|
+
* Fixed a bug that Facebook changed the format (I think) of fbs_ in cookies.
|
8
|
+
Thanks betelgeuse, closes #1
|
9
|
+
http://github.com/cardinalblue/rest-graph/issues/issue/1
|
10
|
+
|
11
|
+
== rest-graph 1.2.0 -- 2010-05-27
|
4
12
|
* Add RestGraph#parse_json!
|
5
13
|
* Add RailsController to help you integrate into Rails.
|
6
14
|
* Simplify arguments checking and require dependency.
|
data/README.rdoc
CHANGED
@@ -8,7 +8,7 @@ class ApplicationController < ActionController::Base
|
|
8
8
|
# Scrub sensitive parameters from your log
|
9
9
|
# filter_parameter_logging :password
|
10
10
|
|
11
|
-
include RestGraph::
|
11
|
+
include RestGraph::RailsUtil
|
12
12
|
before_filter :setup_iframe
|
13
13
|
before_filter :setup_rest_graph
|
14
14
|
|
File without changes
|
data/lib/rest-graph.rb
CHANGED
@@ -117,12 +117,12 @@ class RestGraph < RestGraphStruct
|
|
117
117
|
|
118
118
|
if RUBY_VERSION >= '1.9.1'
|
119
119
|
def parse_rack_env! env
|
120
|
-
self.data = env['HTTP_COOKIE'] =~ /fbs_#{app_id}=
|
120
|
+
self.data = env['HTTP_COOKIE'] =~ /fbs_#{app_id}=([^\;]+)/ &&
|
121
121
|
check_sig_and_return_data(Rack::Utils.parse_query($1))
|
122
122
|
end
|
123
123
|
else
|
124
124
|
def parse_rack_env! env
|
125
|
-
self.data = (env['HTTP_COOKIE'] || '') =~ /fbs_#{app_id}=
|
125
|
+
self.data = (env['HTTP_COOKIE'] || '') =~ /fbs_#{app_id}=([^\;]+)/ &&
|
126
126
|
check_sig_and_return_data(Rack::Utils.parse_query($1))
|
127
127
|
end
|
128
128
|
end
|
@@ -133,7 +133,7 @@ class RestGraph < RestGraphStruct
|
|
133
133
|
|
134
134
|
def parse_fbs! fbs
|
135
135
|
self.data = fbs &&
|
136
|
-
check_sig_and_return_data(Rack::Utils.parse_query(fbs
|
136
|
+
check_sig_and_return_data(Rack::Utils.parse_query(fbs))
|
137
137
|
end
|
138
138
|
|
139
139
|
def parse_json! json
|
@@ -145,7 +145,7 @@ class RestGraph < RestGraphStruct
|
|
145
145
|
# oauth related
|
146
146
|
|
147
147
|
def authorize_url opts={}
|
148
|
-
query = {:client_id => app_id}.merge(opts)
|
148
|
+
query = {:client_id => app_id, :access_token => nil}.merge(opts)
|
149
149
|
"#{graph_server}oauth/authorize#{build_query_string(query)}"
|
150
150
|
end
|
151
151
|
|
@@ -168,7 +168,8 @@ class RestGraph < RestGraphStruct
|
|
168
168
|
end
|
169
169
|
|
170
170
|
def build_query_string query={}
|
171
|
-
|
171
|
+
qq = access_token ? {:access_token => access_token}.merge(query) : query
|
172
|
+
q = qq.select{ |k, v| v }
|
172
173
|
return '' if q.empty?
|
173
174
|
return '?' + q.map{ |(k, v)| "#{k}=#{CGI.escape(v.to_s)}" }.join('&')
|
174
175
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
require 'rest-graph'
|
3
3
|
|
4
|
-
module RestGraph::
|
4
|
+
module RestGraph::RailsUtil
|
5
5
|
module_function
|
6
6
|
# filters for you
|
7
7
|
def setup_iframe
|
@@ -98,3 +98,5 @@ module RestGraph::RailsController
|
|
98
98
|
sub(/[\&\?]code=[^\&]+/, '')
|
99
99
|
end
|
100
100
|
end
|
101
|
+
|
102
|
+
RestGraph::RailsController = RestGraph::RailsUtil
|
data/lib/rest-graph/version.rb
CHANGED
data/rest-graph.gemspec
CHANGED
@@ -2,23 +2,21 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{rest-graph}
|
5
|
-
s.version = "1.2.
|
5
|
+
s.version = "1.2.1"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Cardinal Blue", "Lin Jen-Shin (aka godfat 真常)"]
|
9
|
-
s.date = %q{2010-
|
10
|
-
s.description = %q{ A super simple Facebook Open Graph API client
|
11
|
-
If you feel SYNOPSIS is so hard to understand, please read
|
12
|
-
{examples}[http://github.com/cardinalblue/rest-graph/tree/master/example].}
|
9
|
+
s.date = %q{2010-06-02}
|
10
|
+
s.description = %q{ A super simple Facebook Open Graph API client}
|
13
11
|
s.email = %q{dev (XD) cardinalblue.com}
|
14
|
-
s.extra_rdoc_files = ["CHANGES", "LICENSE", "TODO", "example/rails/README", "example/rails/app/views/rest-graph.erb", "example/rails/config/rest-graph.yaml", "example/rails/script/console", "example/rails/script/server", "rest-graph.gemspec"]
|
15
|
-
s.files = ["CHANGES", "LICENSE", "README.rdoc", "Rakefile", "TODO", "example/rails/README", "example/rails/Rakefile", "example/rails/app/controllers/application_controller.rb", "example/rails/app/views/rest-graph.erb", "example/rails/config/boot.rb", "example/rails/config/environment.rb", "example/rails/config/environments/development.rb", "example/rails/config/environments/production.rb", "example/rails/config/environments/test.rb", "example/rails/config/initializers/cookie_verification_secret.rb", "example/rails/config/initializers/new_rails_defaults.rb", "example/rails/config/initializers/session_store.rb", "example/rails/config/rest-graph.yaml", "example/rails/config/routes.rb", "example/rails/script/console", "example/rails/script/server", "init.rb", "lib/rest-graph.rb", "lib/rest-graph/auto_load.rb", "lib/rest-graph/load_config.rb", "lib/rest-graph/
|
12
|
+
s.extra_rdoc_files = ["CHANGES", "LICENSE", "TODO", "example/rails/README", "example/rails/app/views/rest-graph/authorization.erb", "example/rails/config/rest-graph.yaml", "example/rails/script/console", "example/rails/script/server", "rest-graph.gemspec"]
|
13
|
+
s.files = ["CHANGES", "LICENSE", "README.rdoc", "Rakefile", "TODO", "example/rails/README", "example/rails/Rakefile", "example/rails/app/controllers/application_controller.rb", "example/rails/app/views/rest-graph/authorization.erb", "example/rails/config/boot.rb", "example/rails/config/environment.rb", "example/rails/config/environments/development.rb", "example/rails/config/environments/production.rb", "example/rails/config/environments/test.rb", "example/rails/config/initializers/cookie_verification_secret.rb", "example/rails/config/initializers/new_rails_defaults.rb", "example/rails/config/initializers/session_store.rb", "example/rails/config/rest-graph.yaml", "example/rails/config/routes.rb", "example/rails/script/console", "example/rails/script/server", "init.rb", "lib/rest-graph.rb", "lib/rest-graph/auto_load.rb", "lib/rest-graph/load_config.rb", "lib/rest-graph/rails_util.rb", "lib/rest-graph/version.rb", "rest-graph.gemspec", "test/common.rb", "test/config/rest-graph.yaml", "test/test_default.rb", "test/test_fql.rb", "test/test_handler.rb", "test/test_load_config.rb", "test/test_oauth.rb", "test/test_parse.rb", "test/test_rest-graph.rb"]
|
16
14
|
s.homepage = %q{http://github.com/cardinalblue/rest-graph}
|
17
15
|
s.rdoc_options = ["--main", "README.rdoc"]
|
18
16
|
s.require_paths = ["lib"]
|
19
17
|
s.rubyforge_project = %q{rest-graph}
|
20
18
|
s.rubygems_version = %q{1.3.7}
|
21
|
-
s.summary = %q{A super simple Facebook Open Graph API client
|
19
|
+
s.summary = %q{A super simple Facebook Open Graph API client}
|
22
20
|
s.test_files = ["test/test_default.rb", "test/test_fql.rb", "test/test_handler.rb", "test/test_load_config.rb", "test/test_oauth.rb", "test/test_parse.rb", "test/test_rest-graph.rb"]
|
23
21
|
|
24
22
|
if s.respond_to? :specification_version then
|
data/test/test_oauth.rb
CHANGED
@@ -31,4 +31,9 @@ describe RestGraph do
|
|
31
31
|
@rg.data.should == result
|
32
32
|
end
|
33
33
|
|
34
|
+
it 'would not append access_token in authorize_url even presented' do
|
35
|
+
RestGraph.new(:access_token => 'do not use me').authorize_url.
|
36
|
+
should == 'https://graph.facebook.com/oauth/authorize'
|
37
|
+
end
|
38
|
+
|
34
39
|
end
|
data/test/test_parse.rb
CHANGED
@@ -18,8 +18,8 @@ describe RestGraph do
|
|
18
18
|
app_id = '1829'
|
19
19
|
secret = app_id.reverse
|
20
20
|
sig = '398262caea8442bd8801e8fba7c55c8a'
|
21
|
-
fbs = "
|
22
|
-
"secret=abc&session_key=def-456&sig=#{sig}&uid=3
|
21
|
+
fbs = "access_token=#{CGI.escape(access_token)}&expires=0&" \
|
22
|
+
"secret=abc&session_key=def-456&sig=#{sig}&uid=3"
|
23
23
|
|
24
24
|
check = lambda{ |token|
|
25
25
|
http_cookie =
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rest-graph
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 29
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 1.2.
|
9
|
+
- 1
|
10
|
+
version: 1.2.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Cardinal Blue
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2010-
|
19
|
+
date: 2010-06-02 00:00:00 +08:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -142,7 +142,7 @@ extra_rdoc_files:
|
|
142
142
|
- LICENSE
|
143
143
|
- TODO
|
144
144
|
- example/rails/README
|
145
|
-
- example/rails/app/views/rest-graph.erb
|
145
|
+
- example/rails/app/views/rest-graph/authorization.erb
|
146
146
|
- example/rails/config/rest-graph.yaml
|
147
147
|
- example/rails/script/console
|
148
148
|
- example/rails/script/server
|
@@ -156,7 +156,7 @@ files:
|
|
156
156
|
- example/rails/README
|
157
157
|
- example/rails/Rakefile
|
158
158
|
- example/rails/app/controllers/application_controller.rb
|
159
|
-
- example/rails/app/views/rest-graph.erb
|
159
|
+
- example/rails/app/views/rest-graph/authorization.erb
|
160
160
|
- example/rails/config/boot.rb
|
161
161
|
- example/rails/config/environment.rb
|
162
162
|
- example/rails/config/environments/development.rb
|
@@ -173,7 +173,7 @@ files:
|
|
173
173
|
- lib/rest-graph.rb
|
174
174
|
- lib/rest-graph/auto_load.rb
|
175
175
|
- lib/rest-graph/load_config.rb
|
176
|
-
- lib/rest-graph/
|
176
|
+
- lib/rest-graph/rails_util.rb
|
177
177
|
- lib/rest-graph/version.rb
|
178
178
|
- rest-graph.gemspec
|
179
179
|
- test/common.rb
|