fb_graph 1.9.0 → 1.9.1
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.lock +2 -2
- data/VERSION +1 -1
- data/lib/fb_graph/node.rb +3 -1
- data/spec/fb_graph/connections/test_users_spec.rb +47 -33
- metadata +4 -4
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
fb_graph (1.
|
4
|
+
fb_graph (1.9.0)
|
5
5
|
httpclient (>= 2.2.0.2)
|
6
6
|
rack-oauth2 (>= 0.8.0)
|
7
7
|
|
@@ -17,7 +17,7 @@ GEM
|
|
17
17
|
i18n (0.6.0)
|
18
18
|
json (1.5.3)
|
19
19
|
rack (1.3.0)
|
20
|
-
rack-oauth2 (0.8.
|
20
|
+
rack-oauth2 (0.8.2)
|
21
21
|
activesupport (>= 2.3)
|
22
22
|
attr_required (>= 0.0.3)
|
23
23
|
httpclient (>= 2.2.0.2)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.9.
|
1
|
+
1.9.1
|
data/lib/fb_graph/node.rb
CHANGED
@@ -65,7 +65,9 @@ module FbGraph
|
|
65
65
|
_params_ = params.dup
|
66
66
|
_params_[:access_token] ||= self.access_token
|
67
67
|
_params_.delete_if do |k, v|
|
68
|
-
v.blank?
|
68
|
+
v.blank? &&
|
69
|
+
# NOTE: allow "key=false" in params (ex. for test user creation, it supports "installed=false")
|
70
|
+
v != false
|
69
71
|
end
|
70
72
|
_params_.each do |key, value|
|
71
73
|
if value.present? && ![Symbol, String, Numeric, Rack::OAuth2::AccessToken::Legacy, IO].any? { |klass| value.is_a? klass }
|
@@ -1,50 +1,64 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe FbGraph::Connections::TestUsers
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
describe FbGraph::Connections::TestUsers do
|
4
|
+
describe '#test_users' do
|
5
|
+
before do
|
6
|
+
@app = FbGraph::Application.new('client_id', :secret => 'secret')
|
7
|
+
end
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
context 'when access_token is not given' do
|
10
|
+
it 'should get access_token first' do
|
11
|
+
lambda do
|
12
|
+
@app.test_users
|
13
|
+
end.should request_to('oauth/access_token', :post)
|
14
|
+
end
|
13
15
|
end
|
14
|
-
end
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
17
|
+
context 'when access_token is given' do
|
18
|
+
it 'should return test_users as FbGraph::TestUser' do
|
19
|
+
mock_graph :get, 'client_id/accounts/test-users', 'applications/test_users/private', :access_token => 'access_token' do
|
20
|
+
@app.access_token = 'access_token'
|
21
|
+
test_users = @app.test_users
|
22
|
+
test_users.each do |test_user|
|
23
|
+
test_user.should be_instance_of(FbGraph::TestUser)
|
24
|
+
end
|
23
25
|
end
|
24
26
|
end
|
25
27
|
end
|
26
28
|
end
|
27
|
-
end
|
28
29
|
|
29
|
-
describe
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
describe '#test_user!' do
|
31
|
+
before do
|
32
|
+
@app = FbGraph::Application.new('client_id', :secret => 'secret')
|
33
|
+
end
|
33
34
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
35
|
+
context 'when access_token is not given' do
|
36
|
+
it 'should get access_token first' do
|
37
|
+
lambda do
|
38
|
+
@app.test_user!
|
39
|
+
end.should request_to('oauth/access_token', :post)
|
40
|
+
end
|
39
41
|
end
|
40
|
-
end
|
41
42
|
|
42
|
-
|
43
|
-
|
44
|
-
mock_graph :post, 'client_id/accounts/test-users', 'applications/test_users/created' do
|
43
|
+
context 'when access_token is given' do
|
44
|
+
before do
|
45
45
|
@app.access_token = 'access_token'
|
46
|
-
|
47
|
-
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'should return a FbGraph::TestUser' do
|
49
|
+
mock_graph :post, 'client_id/accounts/test-users', 'applications/test_users/created' do
|
50
|
+
@app.test_user!.should be_instance_of FbGraph::TestUser
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
context 'when installed=false' do
|
55
|
+
it 'should post "installed=false" as params' do
|
56
|
+
mock_graph :post, 'client_id/accounts/test-users', 'applications/test_users/created', :access_token => 'access_token', :params => {
|
57
|
+
:installed => 'false'
|
58
|
+
} do
|
59
|
+
@app.test_user!(:installed => false)
|
60
|
+
end
|
61
|
+
end
|
48
62
|
end
|
49
63
|
end
|
50
64
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fb_graph
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 49
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 9
|
9
|
-
-
|
10
|
-
version: 1.9.
|
9
|
+
- 1
|
10
|
+
version: 1.9.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- nov matake
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-06-
|
18
|
+
date: 2011-06-24 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: httpclient
|