fb_graph2 0.9.0 → 0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e431f8fe91ff5513131d0cd82e1f3680dd2ebce7
4
- data.tar.gz: 4ce43fa5d85b44bd4ad58687e0709a93944036a1
3
+ metadata.gz: 02d3fd73078b36678b448d41403a317d79a04d97
4
+ data.tar.gz: 2308ec4a9c5332e8ef7849a9433b65b2f7aae0de
5
5
  SHA512:
6
- metadata.gz: b36411dd226f0479c6da0eede7590fc6a0e2c3b39cbe8fe1f9fba91ab1f1ca2dab2c018bc12a13efbbb26ceacbbe4fb2bb8e5ea4770320121da9981483b206cd
7
- data.tar.gz: 2afd8efcfa1d85349763515fc663a6e0baa723e8b8184ac0720b3d3a739c140b06698ce47889399b15bb04b1d2a39015d4565846d8897292d50b7dc5a2e0a24a
6
+ metadata.gz: 074d72daff605881499997e72d2a4bf66d2e9bd8a9f87f1e63b78a526f68b8c285b9f5da22200e0f1a707db3987cad0d3ed079aff94d8a311b0a14d92153ce07
7
+ data.tar.gz: 0732424c4b42690745067661f04b4cfea43df05daba9dcf64ebd017df435d236e192eb04385f01bdede167b24d7fcbbea1c62bb6fa7e86c6e2e5a673d89c3e0b
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.0
1
+ 0.9.1
@@ -4,14 +4,14 @@ module FbGraph2
4
4
  def test_users(params = {})
5
5
  users = self.edge :accounts, params, edge_scope: :'test-users'
6
6
  users.collect! do |user|
7
- User.new(user[:id], user)
7
+ TestUser.new(user[:id], user)
8
8
  end
9
9
  end
10
10
 
11
11
  def test_user!(params = {})
12
12
  user = self.post params, edge: :accounts, edge_scope: :'test-users'
13
13
  params.delete(:access_token) # so as not to keep app token
14
- User.new(user[:id], user.merge(params))
14
+ TestUser.new(user[:id], user.merge(params))
15
15
  end
16
16
  end
17
17
  end
@@ -0,0 +1,14 @@
1
+ require 'fb_graph2/user'
2
+
3
+ module FbGraph2
4
+ class TestUser < User
5
+ register_attributes(
6
+ raw: [:login_url, :password]
7
+ )
8
+
9
+ def friend!(test_user)
10
+ self.post({}, edge: :friends, edge_scope: test_user.id)
11
+ test_user.post({}, edge: :friends, edge_scope: self.id)
12
+ end
13
+ end
14
+ end
@@ -5,26 +5,26 @@ describe FbGraph2::Edge::TestUsers do
5
5
  let(:app) { FbGraph2::App.app('app_token') }
6
6
 
7
7
  describe '#test_users' do
8
- it 'should return an Array of FbGraph2::User with test_user token' do
8
+ it 'should return an Array of FbGraph2::TestUser with test_user token' do
9
9
  users = mock_graph :get, 'app/accounts/test-users', 'app/test_users', access_token: 'app_token' do
10
10
  app.test_users
11
11
  end
12
12
  users.should be_instance_of FbGraph2::Edge
13
13
  users.should_not be_blank
14
14
  users.each do |user|
15
- user.should be_instance_of FbGraph2::User
15
+ user.should be_instance_of FbGraph2::TestUser
16
16
  user.access_token.should == 'test_user_token'
17
17
  end
18
18
  end
19
19
  end
20
20
 
21
21
  describe '#test_user!' do
22
- it 'should create an Object of FbGraph2::User with test_user token' do
22
+ it 'should create an Object of FbGraph2::TestUser with test_user token' do
23
23
  permissions = %w[public_profile,email,user_friends].join(',')
24
24
  user = mock_graph :post, 'app/accounts/test-users', 'post/test_users', access_token: 'app_token', permissions: permissions do
25
25
  app.test_user!
26
26
  end
27
- user.should be_instance_of FbGraph2::User
27
+ user.should be_instance_of FbGraph2::TestUser
28
28
  user.access_token.should == 'test_user_token'
29
29
  end
30
30
  end
@@ -0,0 +1,40 @@
1
+ require 'spec_helper'
2
+
3
+ describe FbGraph2::TestUser do
4
+ let(:app) { FbGraph2::App.app('app_token') }
5
+
6
+ let(:test_user) do
7
+ permissions = %w[public_profile,email,user_friends].join(',')
8
+ mock_graph :post, 'app/accounts/test-users', 'post/test_users', access_token: 'app_token', permissions: permissions do
9
+ app.test_user!
10
+ end
11
+ end
12
+
13
+ describe '#access_token' do
14
+ it 'should provide the TestUser access token' do
15
+ test_user.access_token.should == 'test_user_token'
16
+ end
17
+ end
18
+
19
+ describe '#password' do
20
+ it 'should provide the new test user password' do
21
+ test_user.password.should == 'test_user_password'
22
+ end
23
+ end
24
+
25
+ describe '#login_url' do
26
+ it 'should provide the new test user login_url' do
27
+ test_user.login_url.should == 'https://developers.facebook.com/checkpoint/test-user-login/106444709796298/'
28
+ end
29
+ end
30
+
31
+ describe '#friend!' do
32
+ let(:test_friend) { FbGraph2::TestUser.new('123456789') }
33
+
34
+ it 'should request and confirm the friendship for the given test user' do
35
+ mock_graph :post, "#{test_user.id}/friends/#{test_friend.id}", 'success_true', access_token: test_user.access_token
36
+ mock_graph :post, "#{test_friend.id}/friends/#{test_user.id}", 'success_true', access_token: test_friend.access_token
37
+ test_user.friend!(test_friend)
38
+ end
39
+ end
40
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fb_graph2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - nov matake
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-28 00:00:00.000000000 Z
11
+ date: 2017-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httpclient
@@ -304,6 +304,7 @@ files:
304
304
  - lib/fb_graph2/struct/tag.rb
305
305
  - lib/fb_graph2/struct/work.rb
306
306
  - lib/fb_graph2/tagged_profile.rb
307
+ - lib/fb_graph2/test_user.rb
307
308
  - lib/fb_graph2/thread.rb
308
309
  - lib/fb_graph2/token_metadata.rb
309
310
  - lib/fb_graph2/translation.rb
@@ -374,6 +375,7 @@ files:
374
375
  - spec/fb_graph2/struct/app_insight_spec.rb
375
376
  - spec/fb_graph2/struct/app_link_spec.rb
376
377
  - spec/fb_graph2/tagged_profile_spec.rb
378
+ - spec/fb_graph2/test_user_spec.rb
377
379
  - spec/fb_graph2/token_metadata_spec.rb
378
380
  - spec/fb_graph2/user_spec.rb
379
381
  - spec/fb_graph2/util_spec.rb