rest-graph 1.1.1 → 1.2.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/CHANGES +33 -0
- data/README.rdoc +50 -11
- data/TODO +3 -15
- data/example/rails/README +4 -0
- data/example/rails/Rakefile +10 -0
- data/example/rails/app/controllers/application_controller.rb +20 -0
- data/example/rails/app/views/rest-graph.erb +16 -0
- data/example/rails/config/boot.rb +110 -0
- data/example/rails/config/environment.rb +43 -0
- data/example/rails/config/environments/development.rb +17 -0
- data/example/rails/config/environments/production.rb +28 -0
- data/example/rails/config/environments/test.rb +28 -0
- data/example/rails/config/initializers/cookie_verification_secret.rb +7 -0
- data/example/rails/config/initializers/new_rails_defaults.rb +21 -0
- data/example/rails/config/initializers/session_store.rb +15 -0
- data/example/rails/config/rest-graph.yaml +5 -0
- data/example/rails/config/routes.rb +43 -0
- data/example/rails/script/console +3 -0
- data/example/rails/script/server +3 -0
- data/init.rb +1 -0
- data/lib/rest-graph.rb +75 -35
- data/lib/rest-graph/load_config.rb +33 -34
- data/lib/rest-graph/rails_controller.rb +100 -0
- data/lib/rest-graph/version.rb +1 -3
- data/rest-graph.gemspec +22 -20
- data/test/common.rb +7 -1
- data/test/test_default.rb +31 -0
- data/test/test_fql.rb +60 -0
- data/test/test_handler.rb +56 -0
- data/test/test_load_config.rb +4 -0
- data/test/test_parse.rb +70 -0
- data/test/test_rest-graph.rb +4 -80
- metadata +40 -10
data/lib/rest-graph/version.rb
CHANGED
data/rest-graph.gemspec
CHANGED
@@ -2,51 +2,53 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{rest-graph}
|
5
|
-
s.version = "1.
|
5
|
+
s.version = "1.2.0"
|
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-05-
|
10
|
-
s.description = %q{ super simple
|
11
|
-
|
12
|
-
|
13
|
-
s.
|
9
|
+
s.date = %q{2010-05-28}
|
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].}
|
13
|
+
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/rails_controller.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"]
|
14
16
|
s.homepage = %q{http://github.com/cardinalblue/rest-graph}
|
15
|
-
s.rdoc_options = ["--main", "README"]
|
17
|
+
s.rdoc_options = ["--main", "README.rdoc"]
|
16
18
|
s.require_paths = ["lib"]
|
17
19
|
s.rubyforge_project = %q{rest-graph}
|
18
|
-
s.rubygems_version = %q{1.3.
|
19
|
-
s.summary = %q{super simple
|
20
|
-
s.test_files = ["test/test_load_config.rb", "test/test_rest-graph.rb"]
|
20
|
+
s.rubygems_version = %q{1.3.7}
|
21
|
+
s.summary = %q{A super simple Facebook Open Graph API client If you feel SYNOPSIS is so hard to understand, please read {examples}[http://github}
|
22
|
+
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"]
|
21
23
|
|
22
24
|
if s.respond_to? :specification_version then
|
23
25
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
24
26
|
s.specification_version = 3
|
25
27
|
|
26
|
-
if Gem::Version.new(Gem::
|
27
|
-
s.add_runtime_dependency(%q<rest-client>, [">= 1.5.
|
28
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
29
|
+
s.add_runtime_dependency(%q<rest-client>, [">= 1.5.1"])
|
28
30
|
s.add_development_dependency(%q<json>, [">= 1.4.3"])
|
29
31
|
s.add_development_dependency(%q<rack>, [">= 1.1.0"])
|
30
32
|
s.add_development_dependency(%q<rr>, [">= 0.10.11"])
|
31
|
-
s.add_development_dependency(%q<webmock>, [">= 1.
|
33
|
+
s.add_development_dependency(%q<webmock>, [">= 1.2.2"])
|
32
34
|
s.add_development_dependency(%q<bacon>, [">= 1.1.0"])
|
33
|
-
s.add_development_dependency(%q<bones>, [">= 3.4.
|
35
|
+
s.add_development_dependency(%q<bones>, [">= 3.4.3"])
|
34
36
|
else
|
35
|
-
s.add_dependency(%q<rest-client>, [">= 1.5.
|
37
|
+
s.add_dependency(%q<rest-client>, [">= 1.5.1"])
|
36
38
|
s.add_dependency(%q<json>, [">= 1.4.3"])
|
37
39
|
s.add_dependency(%q<rack>, [">= 1.1.0"])
|
38
40
|
s.add_dependency(%q<rr>, [">= 0.10.11"])
|
39
|
-
s.add_dependency(%q<webmock>, [">= 1.
|
41
|
+
s.add_dependency(%q<webmock>, [">= 1.2.2"])
|
40
42
|
s.add_dependency(%q<bacon>, [">= 1.1.0"])
|
41
|
-
s.add_dependency(%q<bones>, [">= 3.4.
|
43
|
+
s.add_dependency(%q<bones>, [">= 3.4.3"])
|
42
44
|
end
|
43
45
|
else
|
44
|
-
s.add_dependency(%q<rest-client>, [">= 1.5.
|
46
|
+
s.add_dependency(%q<rest-client>, [">= 1.5.1"])
|
45
47
|
s.add_dependency(%q<json>, [">= 1.4.3"])
|
46
48
|
s.add_dependency(%q<rack>, [">= 1.1.0"])
|
47
49
|
s.add_dependency(%q<rr>, [">= 0.10.11"])
|
48
|
-
s.add_dependency(%q<webmock>, [">= 1.
|
50
|
+
s.add_dependency(%q<webmock>, [">= 1.2.2"])
|
49
51
|
s.add_dependency(%q<bacon>, [">= 1.1.0"])
|
50
|
-
s.add_dependency(%q<bones>, [">= 3.4.
|
52
|
+
s.add_dependency(%q<bones>, [">= 3.4.3"])
|
51
53
|
end
|
52
54
|
end
|
data/test/common.rb
CHANGED
@@ -20,7 +20,7 @@ module TestHelper
|
|
20
20
|
ensure # the defaults should remain the same!
|
21
21
|
RestGraph.send(:extend, RestGraph::DefaultAttributes.dup)
|
22
22
|
|
23
|
-
|
23
|
+
TestHelper.attrs_no_callback.each{ |name|
|
24
24
|
RestGraph.new.send(name).should ==
|
25
25
|
RestGraph::DefaultAttributes.send("default_#{name}")
|
26
26
|
}
|
@@ -33,4 +33,10 @@ module TestHelper
|
|
33
33
|
def normalize_url url
|
34
34
|
url.sub(/\?.+/){ |query| TestHelper.normalize_query(query) }
|
35
35
|
end
|
36
|
+
|
37
|
+
def attrs_no_callback
|
38
|
+
RestGraph::Attributes.reject{ |attr|
|
39
|
+
attr.to_s =~ /_handler/
|
40
|
+
}
|
41
|
+
end
|
36
42
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
|
2
|
+
if respond_to?(:require_relative, true)
|
3
|
+
require_relative 'common'
|
4
|
+
else
|
5
|
+
require File.dirname(__FILE__) + '/common'
|
6
|
+
end
|
7
|
+
|
8
|
+
describe RestGraph do
|
9
|
+
it 'would honor default attributes' do
|
10
|
+
TestHelper.attrs_no_callback.each{ |name|
|
11
|
+
RestGraph.new.send(name).should ==
|
12
|
+
RestGraph.send("default_#{name}")
|
13
|
+
|
14
|
+
RestGraph.new.send(name).should ==
|
15
|
+
RestGraph::DefaultAttributes.send("default_#{name}")
|
16
|
+
}
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'could use module to override default attributes' do
|
20
|
+
module BlahAttributes
|
21
|
+
def default_app_id
|
22
|
+
'1829'
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
TestHelper.ensure_rollback{
|
27
|
+
RestGraph.send(:extend, BlahAttributes)
|
28
|
+
RestGraph.default_app_id.should == '1829'
|
29
|
+
}
|
30
|
+
end
|
31
|
+
end
|
data/test/test_fql.rb
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
|
2
|
+
if respond_to?(:require_relative, true)
|
3
|
+
require_relative 'common'
|
4
|
+
else
|
5
|
+
require File.dirname(__FILE__) + '/common'
|
6
|
+
end
|
7
|
+
|
8
|
+
describe RestGraph do
|
9
|
+
before do
|
10
|
+
reset_webmock
|
11
|
+
end
|
12
|
+
|
13
|
+
after do
|
14
|
+
RR.verify
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'would do fql query with/without access_token' do
|
18
|
+
fql = 'SELECT name FROM likes where id="123"'
|
19
|
+
query = "format=json&query=#{CGI.escape(fql)}"
|
20
|
+
stub_request(:get, "https://api.facebook.com/method/fql.query?#{query}").
|
21
|
+
to_return(:body => '[]')
|
22
|
+
|
23
|
+
RestGraph.new.fql(fql).should == []
|
24
|
+
|
25
|
+
token = 'token'.reverse
|
26
|
+
stub_request(:get, "https://api.facebook.com/method/fql.query?#{query}" \
|
27
|
+
"&access_token=#{token}").
|
28
|
+
to_return(:body => '[]')
|
29
|
+
|
30
|
+
RestGraph.new(:access_token => token).fql(fql).should == []
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'would do fql.mutilquery correctly' do
|
34
|
+
f0 = 'SELECT display_name FROM application WHERE app_id="233082465238"'
|
35
|
+
f1 = 'SELECT display_name FROM application WHERE app_id="110225210740"'
|
36
|
+
f0q, f1q = "\"#{f0.gsub('"', '\\"')}\"", "\"#{f1.gsub('"', '\\"')}\""
|
37
|
+
q = "format=json&queries=#{CGI.escape("{\"f0\":#{f0q},\"f1\":#{f1q}}")}"
|
38
|
+
|
39
|
+
stub_multi = lambda{
|
40
|
+
stub_request(:get,
|
41
|
+
"https://api.facebook.com/method/fql.multiquery?#{q}").
|
42
|
+
to_return(:body => '[]')
|
43
|
+
}
|
44
|
+
|
45
|
+
stub_multi.call
|
46
|
+
|
47
|
+
queries = {:f0 => f0, :f1 => f1}
|
48
|
+
RestGraph.new.fql_multi(queries).should == []
|
49
|
+
|
50
|
+
# FIXME: didn't work
|
51
|
+
# mock(queries).respond_to?(:json){ false }
|
52
|
+
# mock.proxy(queries).inject
|
53
|
+
def queries.respond_to? msg
|
54
|
+
msg == :to_json ? false : super(msg)
|
55
|
+
end
|
56
|
+
|
57
|
+
stub_multi.call
|
58
|
+
RestGraph.new.fql_multi(queries).should == []
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
|
2
|
+
if respond_to?(:require_relative, true)
|
3
|
+
require_relative 'common'
|
4
|
+
else
|
5
|
+
require File.dirname(__FILE__) + '/common'
|
6
|
+
end
|
7
|
+
|
8
|
+
require 'json'
|
9
|
+
|
10
|
+
describe RestGraph do
|
11
|
+
before do
|
12
|
+
@id = lambda{ |obj| obj }
|
13
|
+
@error = '{"error":{"type":"Exception","message":"(#2500)"}}'
|
14
|
+
@error_hash = JSON.parse(@error)
|
15
|
+
|
16
|
+
reset_webmock
|
17
|
+
stub_request(:get, 'https://graph.facebook.com/me').
|
18
|
+
to_return(:body => @error)
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'would call error_handler if error occurred' do
|
22
|
+
RestGraph.new(:error_handler => @id).get('me').should == @error_hash
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'would raise ::RestGraph::Error in default error_handler' do
|
26
|
+
begin
|
27
|
+
RestGraph.new.get('me')
|
28
|
+
rescue ::RestGraph::Error => e
|
29
|
+
e.message.should == @error_hash
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe RestGraph do
|
35
|
+
before do
|
36
|
+
reset_webmock
|
37
|
+
end
|
38
|
+
|
39
|
+
after do
|
40
|
+
RR.verify
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'would log whenever doing network request' do
|
44
|
+
stub_request(:get, 'https://graph.facebook.com/me').
|
45
|
+
to_return(:body => '{}')
|
46
|
+
|
47
|
+
mock(Time).now{ 666 }
|
48
|
+
mock(Time).now{ 999 }
|
49
|
+
|
50
|
+
logger = []
|
51
|
+
rg = RestGraph.new(:log_handler => lambda{ |d, u| logger << [d, u] })
|
52
|
+
rg.get('me')
|
53
|
+
|
54
|
+
logger.last.should == [333, 'https://graph.facebook.com/me']
|
55
|
+
end
|
56
|
+
end
|
data/test/test_load_config.rb
CHANGED
data/test/test_parse.rb
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
|
2
|
+
if respond_to?(:require_relative, true)
|
3
|
+
require_relative 'common'
|
4
|
+
else
|
5
|
+
require File.dirname(__FILE__) + '/common'
|
6
|
+
end
|
7
|
+
|
8
|
+
describe RestGraph do
|
9
|
+
|
10
|
+
it 'would return nil if parse error, but not when call data directly' do
|
11
|
+
rg = RestGraph.new
|
12
|
+
rg.parse_cookies!({}).should == nil
|
13
|
+
rg.data .should == {}
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'would extract correct access_token or fail checking sig' do
|
17
|
+
access_token = '1|2-5|f.'
|
18
|
+
app_id = '1829'
|
19
|
+
secret = app_id.reverse
|
20
|
+
sig = '398262caea8442bd8801e8fba7c55c8a'
|
21
|
+
fbs = "\"access_token=#{CGI.escape(access_token)}&expires=0&" \
|
22
|
+
"secret=abc&session_key=def-456&sig=#{sig}&uid=3\""
|
23
|
+
|
24
|
+
check = lambda{ |token|
|
25
|
+
http_cookie =
|
26
|
+
"__utma=123; __utmz=456.utmcsr=(d)|utmccn=(d)|utmcmd=(n); " \
|
27
|
+
"fbs_#{app_id}=#{fbs}"
|
28
|
+
|
29
|
+
rg = RestGraph.new(:app_id => app_id, :secret => secret)
|
30
|
+
rg.parse_rack_env!('HTTP_COOKIE' => http_cookie).
|
31
|
+
should.kind_of?(token ? Hash : NilClass)
|
32
|
+
rg.access_token.should == token
|
33
|
+
|
34
|
+
rg.parse_rack_env!('HTTP_COOKIE' => nil).should == nil
|
35
|
+
rg.data.should == {}
|
36
|
+
|
37
|
+
rg.parse_cookies!({"fbs_#{app_id}" => fbs}).
|
38
|
+
should.kind_of?(token ? Hash : NilClass)
|
39
|
+
rg.access_token.should == token
|
40
|
+
|
41
|
+
rg.parse_fbs!(fbs).
|
42
|
+
should.kind_of?(token ? Hash : NilClass)
|
43
|
+
rg.access_token.should == token
|
44
|
+
}
|
45
|
+
check.call(access_token)
|
46
|
+
fbs.chop!
|
47
|
+
fbs += '&inject=evil"'
|
48
|
+
check.call(nil)
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'would not pass if there is no secret, prevent from forgery' do
|
52
|
+
rg = RestGraph.new
|
53
|
+
rg.parse_fbs!('"feed=me&sig=bddd192cf27f22c05f61c8bea24fa4b7"').
|
54
|
+
should == nil
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'would parse json correctly' do
|
58
|
+
rg = RestGraph.new
|
59
|
+
|
60
|
+
rg.parse_json!('bad json').should == nil
|
61
|
+
rg.parse_json!('{"no":"sig"}').should == nil
|
62
|
+
rg.parse_json!('{"feed":"me","sig":"bddd192cf27f22c05f61c8bea24fa4b7"}').
|
63
|
+
should == nil
|
64
|
+
|
65
|
+
rg = RestGraph.new(:secret => 'bread')
|
66
|
+
rg.parse_json!('{"feed":"me","sig":"20393e7823730308938a86ecf1c88b14"}').
|
67
|
+
should == {'feed' => 'me', 'sig' => "20393e7823730308938a86ecf1c88b14"}
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
data/test/test_rest-graph.rb
CHANGED
@@ -10,6 +10,10 @@ describe RestGraph do
|
|
10
10
|
reset_webmock
|
11
11
|
end
|
12
12
|
|
13
|
+
after do
|
14
|
+
RR.verify
|
15
|
+
end
|
16
|
+
|
13
17
|
it 'would build correct headers' do
|
14
18
|
rg = RestGraph.new(:accept => 'text/html',
|
15
19
|
:lang => 'zh-tw')
|
@@ -87,95 +91,15 @@ describe RestGraph do
|
|
87
91
|
RestGraph.new.delete('123').should == []
|
88
92
|
end
|
89
93
|
|
90
|
-
it 'would extract correct access_token or fail checking sig' do
|
91
|
-
access_token = '1|2-5|f.'
|
92
|
-
app_id = '1829'
|
93
|
-
secret = app_id.reverse
|
94
|
-
sig = '398262caea8442bd8801e8fba7c55c8a'
|
95
|
-
fbs = "\"access_token=#{CGI.escape(access_token)}&expires=0&" \
|
96
|
-
"secret=abc&session_key=def-456&sig=#{sig}&uid=3\""
|
97
|
-
|
98
|
-
check = lambda{ |token|
|
99
|
-
http_cookie =
|
100
|
-
"__utma=123; __utmz=456.utmcsr=(d)|utmccn=(d)|utmcmd=(n); " \
|
101
|
-
"fbs_#{app_id}=#{fbs}"
|
102
|
-
|
103
|
-
rg = RestGraph.new(:app_id => app_id, :secret => secret)
|
104
|
-
rg.parse_rack_env!('HTTP_COOKIE' => http_cookie).
|
105
|
-
should.kind_of?(token ? Hash : NilClass)
|
106
|
-
rg.access_token.should == token
|
107
|
-
|
108
|
-
rg.parse_rack_env!('HTTP_COOKIE' => nil).should == nil
|
109
|
-
rg.data.should == {}
|
110
|
-
|
111
|
-
rg.parse_cookies!({"fbs_#{app_id}" => fbs}).
|
112
|
-
should.kind_of?(token ? Hash : NilClass)
|
113
|
-
rg.access_token.should == token
|
114
|
-
|
115
|
-
rg.parse_fbs!(fbs).
|
116
|
-
should.kind_of?(token ? Hash : NilClass)
|
117
|
-
rg.access_token.should == token
|
118
|
-
}
|
119
|
-
check.call(access_token)
|
120
|
-
fbs.chop!
|
121
|
-
fbs += '&inject=evil"'
|
122
|
-
check.call(nil)
|
123
|
-
end
|
124
|
-
|
125
94
|
it 'would return true in authorized? if there is an access_token' do
|
126
95
|
RestGraph.new(:access_token => '1').authorized?.should == true
|
127
96
|
RestGraph.new(:access_token => nil).authorized?.should == false
|
128
97
|
end
|
129
98
|
|
130
|
-
it 'would return nil if parse error, but not when call data directly' do
|
131
|
-
rg = RestGraph.new
|
132
|
-
rg.parse_cookies!({}).should == nil
|
133
|
-
rg.data .should == {}
|
134
|
-
end
|
135
|
-
|
136
|
-
it 'would do fql query with/without access_token' do
|
137
|
-
fql = 'SELECT name FROM likes where id="123"'
|
138
|
-
query = "format=json&query=#{CGI.escape(fql)}"
|
139
|
-
stub_request(:get, "https://api.facebook.com/method/fql.query?#{query}").
|
140
|
-
to_return(:body => '[]')
|
141
|
-
|
142
|
-
RestGraph.new.fql(fql).should == []
|
143
|
-
|
144
|
-
token = 'token'.reverse
|
145
|
-
stub_request(:get, "https://api.facebook.com/method/fql.query?#{query}" \
|
146
|
-
"&access_token=#{token}").
|
147
|
-
to_return(:body => '[]')
|
148
|
-
|
149
|
-
RestGraph.new(:access_token => token).fql(fql).should == []
|
150
|
-
end
|
151
|
-
|
152
|
-
it 'would honor default attributes' do
|
153
|
-
RestGraph::Attributes.each{ |name|
|
154
|
-
RestGraph.new.send(name).should ==
|
155
|
-
RestGraph.send("default_#{name}")
|
156
|
-
|
157
|
-
RestGraph.new.send(name).should ==
|
158
|
-
RestGraph::DefaultAttributes.send("default_#{name}")
|
159
|
-
}
|
160
|
-
end
|
161
|
-
|
162
99
|
it 'would convert query to string' do
|
163
100
|
mock(o = Object.new).to_s{ 'i am mock' }
|
164
101
|
stub_request(:get, "https://graph.facebook.com/search?q=i%20am%20mock").
|
165
102
|
to_return(:body => 'ok')
|
166
103
|
RestGraph.new(:auto_decode => false).get('search', :q => o).should == 'ok'
|
167
104
|
end
|
168
|
-
|
169
|
-
it 'could use module to override default attributes' do
|
170
|
-
module BlahAttributes
|
171
|
-
def default_app_id
|
172
|
-
'1829'
|
173
|
-
end
|
174
|
-
end
|
175
|
-
|
176
|
-
TestHelper.ensure_rollback{
|
177
|
-
RestGraph.send(:extend, BlahAttributes)
|
178
|
-
RestGraph.default_app_id.should == '1829'
|
179
|
-
}
|
180
|
-
end
|
181
105
|
end
|
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: 31
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 1.
|
8
|
+
- 2
|
9
|
+
- 0
|
10
|
+
version: 1.2.0
|
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-05-
|
19
|
+
date: 2010-05-28 00:00:00 +08:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -91,12 +91,12 @@ dependencies:
|
|
91
91
|
requirements:
|
92
92
|
- - ">="
|
93
93
|
- !ruby/object:Gem::Version
|
94
|
-
hash:
|
94
|
+
hash: 27
|
95
95
|
segments:
|
96
96
|
- 1
|
97
97
|
- 2
|
98
|
-
-
|
99
|
-
version: 1.2.
|
98
|
+
- 2
|
99
|
+
version: 1.2.2
|
100
100
|
type: :development
|
101
101
|
version_requirements: *id005
|
102
102
|
- !ruby/object:Gem::Dependency
|
@@ -131,7 +131,7 @@ dependencies:
|
|
131
131
|
version: 3.4.3
|
132
132
|
type: :development
|
133
133
|
version_requirements: *id007
|
134
|
-
description: " super simple
|
134
|
+
description: " A super simple Facebook Open Graph API client"
|
135
135
|
email: dev (XD) cardinalblue.com
|
136
136
|
executables: []
|
137
137
|
|
@@ -141,6 +141,11 @@ extra_rdoc_files:
|
|
141
141
|
- CHANGES
|
142
142
|
- LICENSE
|
143
143
|
- TODO
|
144
|
+
- example/rails/README
|
145
|
+
- example/rails/app/views/rest-graph.erb
|
146
|
+
- example/rails/config/rest-graph.yaml
|
147
|
+
- example/rails/script/console
|
148
|
+
- example/rails/script/server
|
144
149
|
- rest-graph.gemspec
|
145
150
|
files:
|
146
151
|
- CHANGES
|
@@ -148,16 +153,37 @@ files:
|
|
148
153
|
- README.rdoc
|
149
154
|
- Rakefile
|
150
155
|
- TODO
|
156
|
+
- example/rails/README
|
157
|
+
- example/rails/Rakefile
|
158
|
+
- example/rails/app/controllers/application_controller.rb
|
159
|
+
- example/rails/app/views/rest-graph.erb
|
160
|
+
- example/rails/config/boot.rb
|
161
|
+
- example/rails/config/environment.rb
|
162
|
+
- example/rails/config/environments/development.rb
|
163
|
+
- example/rails/config/environments/production.rb
|
164
|
+
- example/rails/config/environments/test.rb
|
165
|
+
- example/rails/config/initializers/cookie_verification_secret.rb
|
166
|
+
- example/rails/config/initializers/new_rails_defaults.rb
|
167
|
+
- example/rails/config/initializers/session_store.rb
|
168
|
+
- example/rails/config/rest-graph.yaml
|
169
|
+
- example/rails/config/routes.rb
|
170
|
+
- example/rails/script/console
|
171
|
+
- example/rails/script/server
|
151
172
|
- init.rb
|
152
173
|
- lib/rest-graph.rb
|
153
174
|
- lib/rest-graph/auto_load.rb
|
154
175
|
- lib/rest-graph/load_config.rb
|
176
|
+
- lib/rest-graph/rails_controller.rb
|
155
177
|
- lib/rest-graph/version.rb
|
156
178
|
- rest-graph.gemspec
|
157
179
|
- test/common.rb
|
158
180
|
- test/config/rest-graph.yaml
|
181
|
+
- test/test_default.rb
|
182
|
+
- test/test_fql.rb
|
183
|
+
- test/test_handler.rb
|
159
184
|
- test/test_load_config.rb
|
160
185
|
- test/test_oauth.rb
|
186
|
+
- test/test_parse.rb
|
161
187
|
- test/test_rest-graph.rb
|
162
188
|
has_rdoc: true
|
163
189
|
homepage: http://github.com/cardinalblue/rest-graph
|
@@ -193,8 +219,12 @@ rubyforge_project: rest-graph
|
|
193
219
|
rubygems_version: 1.3.7
|
194
220
|
signing_key:
|
195
221
|
specification_version: 3
|
196
|
-
summary: super simple
|
222
|
+
summary: A super simple Facebook Open Graph API client
|
197
223
|
test_files:
|
224
|
+
- test/test_default.rb
|
225
|
+
- test/test_fql.rb
|
226
|
+
- test/test_handler.rb
|
198
227
|
- test/test_load_config.rb
|
199
228
|
- test/test_oauth.rb
|
229
|
+
- test/test_parse.rb
|
200
230
|
- test/test_rest-graph.rb
|