rest-graph 1.9.1 → 2.0.0
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/.travis.yml +13 -0
- data/{CHANGES → CHANGES.md} +59 -23
- data/Gemfile +21 -16
- data/README.md +24 -14
- data/Rakefile +34 -20
- data/{TODO → TODO.md} +5 -3
- data/example/rails2/Gemfile +2 -2
- data/example/rails2/Rakefile +1 -0
- data/example/rails2/app/controllers/application_controller.rb +12 -3
- data/example/rails2/config/environment.rb +1 -1
- data/example/rails2/test/functional/application_controller_test.rb +28 -1
- data/example/rails3/Gemfile +2 -2
- data/example/rails3/app/controllers/application_controller.rb +12 -3
- data/example/rails3/config/boot.rb +6 -0
- data/example/rails3/config/environments/development.rb +0 -3
- data/example/rails3/test/functional/application_controller_test.rb +28 -1
- data/lib/rest-graph/config_util.rb +1 -1
- data/lib/rest-graph/core.rb +26 -8
- data/lib/rest-graph/rails_util.rb +6 -3
- data/lib/rest-graph/version.rb +1 -1
- data/rest-graph.gemspec +116 -152
- data/task/.gitignore +1 -0
- data/task/gemgem.rb +117 -18
- data/test/test_default.rb +8 -12
- data/test/test_parse.rb +4 -0
- data/test/test_timeout.rb +9 -9
- metadata +27 -127
- data/README +0 -371
data/.travis.yml
ADDED
data/{CHANGES → CHANGES.md}
RENAMED
@@ -1,10 +1,37 @@
|
|
1
|
-
|
1
|
+
# CHANGES
|
2
2
|
|
3
|
-
|
3
|
+
## rest-graph 2.0.0 -- 2011-10-08
|
4
|
+
|
5
|
+
We have moved the development from rest-graph to [rest-core][].
|
6
|
+
By now on, we would only fix bugs in rest-graph rather than adding
|
7
|
+
features, and we would only backport important changes from rest-core
|
8
|
+
once in a period. If you want the latest goodies, please see [rest-core][]
|
9
|
+
Otherwise, you can stay with rest-graph with bugs fixes.
|
10
|
+
|
11
|
+
[rest-core]: https://github.com/cardinalblue/rest-core
|
12
|
+
|
13
|
+
* [RestGraph] Added `RestGraph#parse_fbsr!` which can parse Facebook's new
|
14
|
+
cookie. Also, `RestGraph#parse_cookies!` would look for that too.
|
15
|
+
* [RestGraph] Added `expires_in` attribute which would be passed to cache.
|
16
|
+
The default value is 600 seconds. No effect if there's no cache, or if
|
17
|
+
the cache didn't support `:expires_in` option.
|
18
|
+
* [RestGraph] Now `RestGraph#initialize` accepts string keys.
|
19
|
+
* [RestGraph] We don't support em-http-request >= 1 at the moment.
|
20
|
+
* [RestGraph] Fixed that parsing an invalid signed_request would raise an
|
21
|
+
error. From now on it would simply ignore it and wipe out the data.
|
22
|
+
|
23
|
+
* [RailsUtil] Now by default, RestGraph would cache all GET requests in
|
24
|
+
`Rails.cache` for 600 seconds. You can change this by running:
|
25
|
+
|
26
|
+
rest_graph_setup(:cache => nil, :expires_in => 3600)
|
27
|
+
|
28
|
+
To disable cache or lengthen/shorten the lifetime of the cache result.
|
29
|
+
|
30
|
+
## rest-graph 1.9.1 -- 2011-06-07
|
4
31
|
|
5
32
|
* [RestGraph] Fixed parse_fbs! where fbs contains some json. (thanks Bruce)
|
6
33
|
|
7
|
-
|
34
|
+
## rest-graph 1.9.0 -- 2011-05-26
|
8
35
|
|
9
36
|
* [RestGraph] Removed deprecated rest-graph/auto_load.rb, and
|
10
37
|
rest-graph/autoload.rb. Please simply require 'rest-graph'
|
@@ -35,7 +62,7 @@
|
|
35
62
|
cause problems, thus we have provided this option to use POST
|
36
63
|
instead.
|
37
64
|
|
38
|
-
|
65
|
+
## rest-graph 1.8.0 -- 2011-03-08
|
39
66
|
|
40
67
|
* [RestGraph] Now require 'rest-graph/autoload' is deprecated, simply use
|
41
68
|
require 'rest-graph' would require anything you "might" or
|
@@ -79,7 +106,7 @@
|
|
79
106
|
|
80
107
|
* [FacebookUtil] Added some very Facebook specific utilities.
|
81
108
|
|
82
|
-
|
109
|
+
## rest-graph 1.7.0 -- 2010-12-30
|
83
110
|
|
84
111
|
* [RestGraph] Renamed rest-graph/auto_load to rest-graph/autoload; auto_load
|
85
112
|
would be still working for a while.
|
@@ -101,7 +128,7 @@
|
|
101
128
|
* [RailsUtil] Extract rest_graph_filter_uri, which would filter session,
|
102
129
|
code, singed_request, etc. on the redirecting URI.
|
103
130
|
|
104
|
-
|
131
|
+
## rest-graph 1.6.0 -- 2010-11-19
|
105
132
|
|
106
133
|
* [RestGraph] Added em-http as an alternate for HTTP client. So rest-client
|
107
134
|
is no longer a must-have dependency. Pass :async => true to
|
@@ -179,7 +206,7 @@
|
|
179
206
|
RestGraph::TestUtil.history. This would get cleaned up in
|
180
207
|
RestGraph::TestUtil.teardown as well.
|
181
208
|
|
182
|
-
|
209
|
+
## rest-graph 1.5.0 -- 2010-10-11
|
183
210
|
|
184
211
|
* [RestGraph] Make sure RestGraph::Error#message is string, that way,
|
185
212
|
irb could print out error message correctly. Introduced
|
@@ -246,7 +273,7 @@ should be formatted by "#{app_id}|#{secret}" instead of the usual one.
|
|
246
273
|
|
247
274
|
* [RailsUtil] URI.encode before URI.parse for broken URL Facebook passed.
|
248
275
|
|
249
|
-
|
276
|
+
## rest-graph 1.4.6 -- 2010-09-01
|
250
277
|
|
251
278
|
* [RestGraph] Now it will try to pick yajl-ruby or json gem from memory first,
|
252
279
|
if it's not there, then try to load one and try to pick one
|
@@ -277,7 +304,7 @@ should be formatted by "#{app_id}|#{secret}" instead of the usual one.
|
|
277
304
|
Now it's:
|
278
305
|
`rest_graph_authorize(message)`
|
279
306
|
|
280
|
-
|
307
|
+
## rest-graph 1.4.5 -- 2010-08-07
|
281
308
|
|
282
309
|
* [RestGraph] Treat oauth_token as access_token as well. This came from
|
283
310
|
Facebook's new signed_request. Why didn't they choose
|
@@ -290,12 +317,12 @@ should be formatted by "#{app_id}|#{secret}" instead of the usual one.
|
|
290
317
|
fbs with user code, instead of using sessions/cookies.
|
291
318
|
That way, you can save fbs into memcache or somewhere.
|
292
319
|
|
293
|
-
|
320
|
+
## rest-graph 1.4.4 -- 2010-08-06
|
294
321
|
|
295
322
|
* [RailsUtil] Fixed a bug that empty query appends a question mark,
|
296
323
|
that confuses Facebook, so that redirect_uri didn't match.
|
297
324
|
|
298
|
-
|
325
|
+
## rest-graph 1.4.3 -- 2010-08-06
|
299
326
|
|
300
327
|
* [RestGraph] Fixed a bug in RestGraph#fbs, which didn't join '&'.
|
301
328
|
Thanks, Andrew.
|
@@ -308,7 +335,7 @@ should be formatted by "#{app_id}|#{secret}" instead of the usual one.
|
|
308
335
|
* [RailsUtil] Favor Request#fullpath over Request#request_uri,
|
309
336
|
which came from newer Rack and thus for Rails 3.
|
310
337
|
|
311
|
-
|
338
|
+
## rest-graph 1.4.2 -- 2010-08-05
|
312
339
|
|
313
340
|
* [RestGraph] Added RestGraph#fbs to generate fbs with correct sig,
|
314
341
|
to be used for future parse_fbs! See the bug in RailsUtil.
|
@@ -321,7 +348,7 @@ should be formatted by "#{app_id}|#{secret}" instead of the usual one.
|
|
321
348
|
|
322
349
|
* Thanks a lot, Andrew.
|
323
350
|
|
324
|
-
|
351
|
+
## rest-graph 1.4.1 -- 2010-08-04
|
325
352
|
|
326
353
|
* [RestGraph] Call error_handler when response contains error_code as well,
|
327
354
|
which came from FQL response. Thanks Florent.
|
@@ -341,7 +368,7 @@ should be formatted by "#{app_id}|#{secret}" instead of the usual one.
|
|
341
368
|
* [RailsUtil] Favor signed_request over session in rest_graph_setup
|
342
369
|
* [RailsUtil] Now it's possible to setup all options in rest-graph.yaml.
|
343
370
|
|
344
|
-
|
371
|
+
## rest-graph 1.4.0 -- 2010-07-15
|
345
372
|
|
346
373
|
Changes only for RailsUtil, the core (rest-graph.rb) is pretty stable for now.
|
347
374
|
|
@@ -356,7 +383,8 @@ Changes only for RailsUtil, the core (rest-graph.rb) is pretty stable for now.
|
|
356
383
|
* Now :auto_authorize_scope default to nothing.
|
357
384
|
* Now there's :write_session option to save fbs in session, default to false.
|
358
385
|
|
359
|
-
|
386
|
+
## rest-graph 1.3.0 -- 2010-06-11
|
387
|
+
|
360
388
|
* Now rest-graph is rescuing all exceptions from rest-client.
|
361
389
|
* Added RestGraph#exchange_sessions to exchange old sessions to access tokens.
|
362
390
|
|
@@ -378,7 +406,8 @@ for RailsUtil:
|
|
378
406
|
http://github.com/cardinalblue/rest-graph/tree/rest-graph-1.3.0/example
|
379
407
|
* url_for and link_to would auto pass :host option if it's inside canvas.
|
380
408
|
|
381
|
-
|
409
|
+
## rest-graph 1.2.1 -- 2010-06-02
|
410
|
+
|
382
411
|
* Deprecated RailsController, use RailsUtil instead.
|
383
412
|
* Fixed a bug that passing access_token in query string
|
384
413
|
in RestGraph#authorize_url
|
@@ -386,7 +415,8 @@ for RailsUtil:
|
|
386
415
|
Thanks betelgeuse, closes #1
|
387
416
|
http://github.com/cardinalblue/rest-graph/issues/issue/1
|
388
417
|
|
389
|
-
|
418
|
+
## rest-graph 1.2.0 -- 2010-05-27
|
419
|
+
|
390
420
|
* Add RestGraph#parse_json!
|
391
421
|
* Add RailsController to help you integrate into Rails.
|
392
422
|
* Simplify arguments checking and require dependency.
|
@@ -419,12 +449,14 @@ for RailsUtil:
|
|
419
449
|
* Add RestGraph#fql_multi to do FQL multiquery. Thanks Ethan Czahor
|
420
450
|
Usage: rg.fql_multi(:query1 => 'SELECT ...', :query2 => 'SELECT ...')
|
421
451
|
|
422
|
-
|
452
|
+
## rest-graph 1.1.1 -- 2010-05-21
|
453
|
+
|
423
454
|
* Add oauth realted utilites -- authorize_url and authorize!
|
424
455
|
* Fixed a bug that in Ruby 1.8.7-, nil =~ /regexp/ equals to false.
|
425
456
|
It is nil as expected in Ruby 1.9.1+
|
426
457
|
|
427
|
-
|
458
|
+
## rest-graph 1.1.0 -- 2010-05-13
|
459
|
+
|
428
460
|
* Main repository was moved to http://github.com/cardinalblue/rest-graph
|
429
461
|
Sorry for the inconvenience. I'll keep pushing to both repositories until
|
430
462
|
I am too lazy to do that.
|
@@ -439,20 +471,24 @@ for RailsUtil:
|
|
439
471
|
* Config could be loaded manually as well. require 'rest-graph/load_config'
|
440
472
|
and RestGraph::LoadConfig.load_config!('path/to/rest-graph.yaml', 'env')
|
441
473
|
|
442
|
-
|
474
|
+
## rest-graph 1.0.0 -- 2010-05-06
|
475
|
+
|
443
476
|
* now access_token is saved in data attributes.
|
444
477
|
* cookies related methods got renamed, and saved all data in RestGraph
|
445
478
|
* parse failed would return nil, while data is always a hash
|
446
479
|
|
447
|
-
|
480
|
+
## rest-graph 0.9.0 -- 2010-05-04
|
481
|
+
|
448
482
|
* renamed :server option to :graph_server
|
449
483
|
* added :fql_server option and fql support.
|
450
484
|
* cookies related parsing utility is now instance methods.
|
451
485
|
you'll need to pass app_id and secret when initializing
|
452
486
|
* if sig in cookies is bad, then it won't extract the access_token
|
453
487
|
|
454
|
-
|
488
|
+
## rest-graph 0.8.1 -- 2010-05-03
|
489
|
+
|
455
490
|
* added access_token parsing utility
|
456
491
|
|
457
|
-
|
492
|
+
## rest-graph 0.8.0 -- 2010-05-03
|
493
|
+
|
458
494
|
* release early, release often
|
data/Gemfile
CHANGED
@@ -1,24 +1,29 @@
|
|
1
1
|
|
2
2
|
source 'http://rubygems.org'
|
3
3
|
|
4
|
-
|
5
|
-
# pick one http client
|
6
|
-
gem 'rest-client', '>=1.6'
|
7
|
-
gem 'em-http-request'
|
4
|
+
gemspec
|
8
5
|
|
9
|
-
|
10
|
-
|
6
|
+
gem 'rake'
|
7
|
+
gem 'bacon'
|
8
|
+
gem 'rr'
|
9
|
+
gem 'webmock'
|
11
10
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
gem 'json'
|
12
|
+
gem 'json_pure'
|
13
|
+
|
14
|
+
gem 'rack'
|
15
|
+
gem 'ruby-hmac'
|
16
|
+
|
17
|
+
gem 'rest-client'
|
18
|
+
gem 'em-http-request', '<1'
|
16
19
|
|
17
|
-
|
18
|
-
gem 'ruby
|
20
|
+
platforms(:ruby) do
|
21
|
+
gem 'yajl-ruby'
|
22
|
+
end
|
19
23
|
|
20
|
-
|
21
|
-
gem '
|
22
|
-
gem 'webmock'
|
23
|
-
gem 'bacon'
|
24
|
+
platforms(:jruby) do
|
25
|
+
gem 'jruby-openssl'
|
24
26
|
end
|
27
|
+
|
28
|
+
gem 'rails', '2.3.14' if ENV['RESTGRAPH'] == 'rails2'
|
29
|
+
gem 'rails', '3.0.9' if ENV['RESTGRAPH'] == 'rails3'
|
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
# rest-graph
|
1
|
+
# rest-graph [](http://travis-ci.org/godfat/rest-graph)
|
2
|
+
|
2
3
|
by Cardinal Blue <http://cardinalblue.com>
|
3
4
|
|
4
5
|
Tutorial on setting up a sample Facebook application with Rails 3
|
@@ -11,7 +12,7 @@ an experienced Ruby programmer, you might also want to look at
|
|
11
12
|
|
12
13
|
## LINKS:
|
13
14
|
|
14
|
-
* [github](
|
15
|
+
* [github](https://ithub.com/cardinalblue/rest-graph)
|
15
16
|
* [rubygems](http://rubygems.org/gems/rest-graph)
|
16
17
|
* [rdoc](http://rdoc.info/projects/cardinalblue/rest-graph)
|
17
18
|
* [mailing list](http://groups.google.com/group/rest-graph/topics)
|
@@ -20,6 +21,14 @@ an experienced Ruby programmer, you might also want to look at
|
|
20
21
|
|
21
22
|
A lightweight Facebook Graph API client
|
22
23
|
|
24
|
+
We have moved the development from rest-graph to [rest-core][].
|
25
|
+
By now on, we would only fix bugs in rest-graph rather than adding
|
26
|
+
features, and we would only backport important changes from rest-core
|
27
|
+
once in a period. If you want the latest goodies, please see [rest-core][]
|
28
|
+
Otherwise, you can stay with rest-graph with bugs fixes.
|
29
|
+
|
30
|
+
[rest-core]: https://github.com/cardinalblue/rest-core
|
31
|
+
|
23
32
|
## FEATURES:
|
24
33
|
|
25
34
|
* Simple Graph API call
|
@@ -53,7 +62,8 @@ A lightweight Facebook Graph API client
|
|
53
62
|
|
54
63
|
Or if you want development version, put this in Gemfile:
|
55
64
|
|
56
|
-
gem 'rest-graph', :git => 'git://github.com/cardinalblue/rest-graph.git'
|
65
|
+
gem 'rest-graph', :git => 'git://github.com/cardinalblue/rest-graph.git',
|
66
|
+
:submodules => true
|
57
67
|
|
58
68
|
Or as a Rails2 plugin:
|
59
69
|
|
@@ -354,18 +364,18 @@ Takes a session key from the old REST API
|
|
354
364
|
|
355
365
|
## LICENSE:
|
356
366
|
|
357
|
-
|
367
|
+
Apache License 2.0
|
358
368
|
|
359
|
-
|
369
|
+
Copyright (c) 2010-2011, Cardinal Blue
|
360
370
|
|
361
|
-
|
362
|
-
|
363
|
-
|
371
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
372
|
+
you may not use this file except in compliance with the License.
|
373
|
+
You may obtain a copy of the License at
|
364
374
|
|
365
|
-
|
375
|
+
<http://www.apache.org/licenses/LICENSE-2.0>
|
366
376
|
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
377
|
+
Unless required by applicable law or agreed to in writing, software
|
378
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
379
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
380
|
+
See the License for the specific language governing permissions and
|
381
|
+
limitations under the License.
|
data/Rakefile
CHANGED
@@ -9,34 +9,40 @@ desc 'Generate gemspec'
|
|
9
9
|
task 'gem:spec' do
|
10
10
|
Gemgem.spec = Gemgem.create do |s|
|
11
11
|
require 'rest-graph/version'
|
12
|
-
s.name
|
13
|
-
s.version
|
14
|
-
|
12
|
+
s.name = 'rest-graph'
|
13
|
+
s.version = RestGraph::VERSION
|
14
|
+
s.homepage = 'https://github.com/cardinalblue/rest-graph'
|
15
15
|
|
16
16
|
%w[].each{ |g| s.add_runtime_dependency(g) }
|
17
|
-
%w[
|
18
|
-
webmock bacon rr].each{ |g| s.add_development_dependency(g) }
|
17
|
+
%w[].each{ |g| s.add_development_dependency(g) }
|
19
18
|
|
20
|
-
s.authors
|
21
|
-
s.email
|
19
|
+
s.authors = ['Cardinal Blue', 'Lin Jen-Shin (godfat)']
|
20
|
+
s.email = ['dev (XD) cardinalblue.com']
|
22
21
|
end
|
23
22
|
|
24
23
|
Gemgem.write
|
25
24
|
end
|
26
25
|
|
26
|
+
module Gemgem
|
27
|
+
module_function
|
28
|
+
def test_rails *rails
|
29
|
+
rails.each{ |framework|
|
30
|
+
opts = Rake.application.options
|
31
|
+
args = (opts.singleton_methods - [:rakelib, 'rakelib']).map{ |arg|
|
32
|
+
if arg.to_s !~ /=$/ && opts.send(arg)
|
33
|
+
"--#{arg}"
|
34
|
+
else
|
35
|
+
''
|
36
|
+
end
|
37
|
+
}.join(' ')
|
38
|
+
Rake.sh "cd example/#{framework}; #{Gem.ruby} -S rake test #{args}"
|
39
|
+
}
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
27
43
|
desc 'Run example tests'
|
28
|
-
task 'test:example'
|
29
|
-
|
30
|
-
opts = Rake.application.options
|
31
|
-
args = (opts.singleton_methods - [:rakelib, 'rakelib']).map{ |arg|
|
32
|
-
if arg.to_s !~ /=$/ && opts.send(arg)
|
33
|
-
"--#{arg}"
|
34
|
-
else
|
35
|
-
''
|
36
|
-
end
|
37
|
-
}.join(' ')
|
38
|
-
sh "cd example/#{framework}; #{Gem.ruby} -S rake test #{args}"
|
39
|
-
}
|
44
|
+
task 'test:example' do
|
45
|
+
Gemgem.test_rails('rails3', 'rails2')
|
40
46
|
end
|
41
47
|
|
42
48
|
desc 'Run all tests'
|
@@ -45,6 +51,14 @@ task 'test:all' => ['test', 'test:example']
|
|
45
51
|
desc 'Run different json test'
|
46
52
|
task 'test:json' do
|
47
53
|
%w[yajl json].each{ |json|
|
48
|
-
sh "#{Gem.ruby} -S rake -r #{json} test"
|
54
|
+
Rake.sh "#{Gem.ruby} -S rake -r #{json} test"
|
49
55
|
}
|
50
56
|
end
|
57
|
+
|
58
|
+
task 'test:travis' do
|
59
|
+
case ENV['RESTGRAPH']
|
60
|
+
when 'rails3'; Gemgem.test_rails('rails3')
|
61
|
+
when 'rails2'; Gemgem.test_rails('rails2')
|
62
|
+
else ; Rake::Task['test'].invoke
|
63
|
+
end
|
64
|
+
end
|
data/{TODO → TODO.md}
RENAMED
@@ -1,10 +1,12 @@
|
|
1
|
-
|
1
|
+
# TODO
|
2
|
+
|
3
|
+
## RailsUtil
|
2
4
|
|
3
|
-
== RailsUtil
|
4
5
|
* provide a :validate_access_token or so option
|
5
6
|
* test for rails util for writing cookie
|
6
7
|
|
7
|
-
|
8
|
+
## RestGraph
|
9
|
+
|
8
10
|
* error_handler can't be turned off
|
9
11
|
* more docs?
|
10
12
|
* more examples?
|
data/example/rails2/Gemfile
CHANGED