fb_graph 2.1.10 → 2.1.11

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fb_graph (2.1.9)
4
+ fb_graph (2.1.10)
5
5
  httpclient (>= 2.2.0.2)
6
6
  rack-oauth2 (>= 0.9.4)
7
7
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.1.10
1
+ 2.1.11
@@ -23,8 +23,8 @@ module FbGraph
23
23
 
24
24
  @@attributes = [
25
25
  :name,
26
+ :namespace,
26
27
  :description,
27
- :canvas_name,
28
28
  :category,
29
29
  :company,
30
30
  :icon_url,
@@ -9,6 +9,13 @@ module FbGraph
9
9
  ))
10
10
  end
11
11
  end
12
+
13
+ def friend_list!(options = {})
14
+ friend_list = post options.merge(:connection => :friendlists)
15
+ FriendList.new(friend_list[:id], options.merge(friend_list).merge(
16
+ :access_token => options[:access_token] || self.access_token
17
+ ))
18
+ end
12
19
  end
13
20
  end
14
21
  end
@@ -9,6 +9,14 @@ module FbGraph
9
9
  ))
10
10
  end
11
11
  end
12
+
13
+ def member!(user, options = {})
14
+ post options.merge(:connection => :members, :connection_scope => user.identifier)
15
+ end
16
+
17
+ def unmember!(user, options = {})
18
+ delete options.merge(:connection => :members, :connection_scope => user.identifier)
19
+ end
12
20
  end
13
21
  end
14
22
  end
@@ -2,11 +2,12 @@ module FbGraph
2
2
  class FriendList < Node
3
3
  include Connections::Members
4
4
 
5
- attr_accessor :name
5
+ attr_accessor :name, :list_type
6
6
 
7
7
  def initialize(identifier, attributes = {})
8
8
  super
9
9
  @name = attributes[:name]
10
+ @list_type = attributes[:list_type]
10
11
  end
11
12
  end
12
13
  end
data/lib/fb_graph/post.rb CHANGED
@@ -1,10 +1,11 @@
1
1
  module FbGraph
2
2
  class Post < Node
3
3
  include Connections::Comments
4
+ include Connections::Insights
4
5
  include Connections::Likes
5
6
  extend Searchable
6
7
 
7
- attr_accessor :from, :to, :message, :picture, :link, :name, :caption, :description, :source, :properties, :icon, :actions, :privacy, :type, :graph_object_id, :application, :targeting, :created_time, :updated_time
8
+ attr_accessor :from, :to, :with_tags, :message, :picture, :link, :name, :caption, :description, :source, :properties, :icon, :actions, :privacy, :type, :graph_object_id, :application, :targeting, :created_time, :updated_time
8
9
 
9
10
  def initialize(identifier, attributes = {})
10
11
  super
@@ -33,6 +34,12 @@ module FbGraph
33
34
  end
34
35
  end
35
36
  end
37
+ @with_tags = []
38
+ if attributes[:with_tags]
39
+ Collection.new(attributes[:with_tags]).each do |tagged|
40
+ @with_tags << User.new(tagged[:id], tagged)
41
+ end
42
+ end
36
43
  @message = attributes[:message]
37
44
  @picture = attributes[:picture]
38
45
  @link = attributes[:link]
@@ -1,11 +1,25 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe FbGraph::Connections::FriendLists, '#friend_lists' do
4
- it 'should return videos as FbGraph::FriendList' do
5
- mock_graph :get, 'matake/friendlists', 'users/friend_lists/matake', :access_token => 'access_token' do
6
- friend_lists = FbGraph::User.new('matake', :access_token => 'access_token').friend_lists
7
- friend_lists.each do |friend_list|
8
- friend_list.should be_instance_of(FbGraph::FriendList)
3
+ describe FbGraph::Connections::FriendLists do
4
+ describe '#friend_lists' do
5
+ it 'should return an array of FbGraph::FriendList' do
6
+ mock_graph :get, 'matake/friendlists', 'users/friend_lists/matake', :access_token => 'access_token' do
7
+ friend_lists = FbGraph::User.new('matake', :access_token => 'access_token').friend_lists
8
+ friend_lists.each do |friend_list|
9
+ friend_list.should be_instance_of(FbGraph::FriendList)
10
+ end
11
+ end
12
+ end
13
+ end
14
+
15
+ describe '#friend_list!' do
16
+ it 'should return FbGraph::FriendList' do
17
+ mock_graph :post, 'me/friendlists', 'users/friend_lists/created', :access_token => 'access_token', :params => {
18
+ :name => 'test'
19
+ } do
20
+ friend_list = FbGraph::User.me('access_token').friend_list! :name => 'test'
21
+ friend_list.should be_instance_of FbGraph::FriendList
22
+ friend_list.name.should == 'test'
9
23
  end
10
24
  end
11
25
  end
@@ -1,11 +1,56 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe FbGraph::Connections::Friends, '#friends' do
4
- it 'should return members as FbGraph::User' do
5
- mock_graph :get, 'emacs/members', 'groups/members/emacs_private', :access_token => 'access_token' do
6
- users = FbGraph::Group.new('emacs', :access_token => 'access_token').members
7
- users.each do |user|
8
- user.should be_instance_of(FbGraph::User)
3
+ describe FbGraph::Connections::Members do
4
+ let :member do
5
+ FbGraph::User.new('member_id')
6
+ end
7
+
8
+ context 'when included in FbGraph::Group' do
9
+ describe '#members' do
10
+ it 'should return members as FbGraph::User' do
11
+ mock_graph :get, 'emacs/members', 'groups/members/emacs_private', :access_token => 'access_token' do
12
+ users = FbGraph::Group.new('emacs', :access_token => 'access_token').members
13
+ users.each do |user|
14
+ user.should be_instance_of FbGraph::User
15
+ end
16
+ end
17
+ end
18
+ end
19
+
20
+ describe '#member!' do
21
+ it :NOT_SUPPORTED_YET
22
+ end
23
+
24
+ describe '#unmember!' do
25
+ it :NOT_SUPPORTED_YET
26
+ end
27
+ end
28
+
29
+ context 'when included in FbGraph::FriendList' do
30
+ describe '#members' do
31
+ it 'should return members as FbGraph::User' do
32
+ mock_graph :get, 'list_id/members', 'friend_lists/members/sample', :access_token => 'access_token' do
33
+ users = FbGraph::FriendList.new('list_id', :access_token => 'access_token').members
34
+ users.each do |user|
35
+ user.should be_instance_of FbGraph::User
36
+ end
37
+ end
38
+ end
39
+ end
40
+
41
+ describe '#member!' do
42
+ it 'should return true' do
43
+ mock_graph :post, 'list_id/members/member_id', 'true', :access_token => 'access_token' do
44
+ FbGraph::FriendList.new('list_id', :access_token => 'access_token').member!(member).should be_true
45
+ end
46
+ end
47
+ end
48
+
49
+ describe '#unmember!' do
50
+ it 'should return true' do
51
+ mock_graph :delete, 'list_id/members/member_id', 'true', :access_token => 'access_token' do
52
+ FbGraph::FriendList.new('list_id', :access_token => 'access_token').unmember!(member).should be_true
53
+ end
9
54
  end
10
55
  end
11
56
  end
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe FbGraph::FriendList, '.new' do
3
+ describe FbGraph::FriendList do
4
4
 
5
5
  it 'should setup all supported attributes' do
6
6
  attributes = {
@@ -12,4 +12,11 @@ describe FbGraph::FriendList, '.new' do
12
12
  video.name.should == 'My List'
13
13
  end
14
14
 
15
+ describe 'destroy' do
16
+ it 'should return true' do
17
+ mock_graph :delete, 'list_id', 'true', :access_token => 'access_token' do
18
+ FbGraph::FriendList.new('list_id').destroy(:access_token => 'access_token').should be_true
19
+ end
20
+ end
21
+ end
15
22
  end
@@ -9,6 +9,18 @@ describe FbGraph::Post, '.new' do
9
9
  :name => "Nov Matake",
10
10
  :id => "579612276"
11
11
  },
12
+ :to => {
13
+ :data => [{
14
+ :name => "Jr Nov",
15
+ :id => "1575327134"
16
+ }]
17
+ },
18
+ :with_tags => {
19
+ :data => [{
20
+ :name => "Jr Nov",
21
+ :id => "1575327134"
22
+ }]
23
+ },
12
24
  :icon => "http://photos-d.ak.fbcdn.net/photos-ak-snc1/v27562/23/2231777543/app_2_2231777543_9553.gif",
13
25
  :type => "status",
14
26
  :object_id => "12345",
@@ -51,6 +63,8 @@ describe FbGraph::Post, '.new' do
51
63
  post.identifier.should == '579612276_10150089741782277'
52
64
  post.message.should == 'hello'
53
65
  post.from.should == FbGraph::User.new("579612276", :name => 'Nov Matake')
66
+ post.to.first.should == FbGraph::User.new("1575327134", :name => 'Jr Nov')
67
+ post.with_tags.first.should == FbGraph::User.new("1575327134", :name => 'Jr Nov')
54
68
  post.icon.should == 'http://photos-d.ak.fbcdn.net/photos-ak-snc1/v27562/23/2231777543/app_2_2231777543_9553.gif'
55
69
  post.type.should == 'status'
56
70
  post.graph_object_id.should == '12345'
@@ -0,0 +1,82 @@
1
+ {
2
+ "data": [{
3
+ "id": "10734185",
4
+ "name": "Mel Ok"
5
+ },
6
+ {
7
+ "id": "504199374",
8
+ "name": "Tadashi Sawada"
9
+ },
10
+ {
11
+ "id": "560247626",
12
+ "name": "Takashi Shitamichi"
13
+ },
14
+ {
15
+ "id": "570661842",
16
+ "name": "Russell Moench"
17
+ },
18
+ {
19
+ "id": "580839773",
20
+ "name": "Daisuke Hojo"
21
+ },
22
+ {
23
+ "id": "581259565",
24
+ "name": "Hiroumi Mitani"
25
+ },
26
+ {
27
+ "id": "593955561",
28
+ "name": "Andrew Smith Lewis"
29
+ },
30
+ {
31
+ "id": "619217309",
32
+ "name": "Daichi Morifuji"
33
+ },
34
+ {
35
+ "id": "674648134",
36
+ "name": "Hiroshi Sasaki"
37
+ },
38
+ {
39
+ "id": "701866760",
40
+ "name": "Genki Takiuchi"
41
+ },
42
+ {
43
+ "id": "727276664",
44
+ "name": "Hiroki Itoh"
45
+ },
46
+ {
47
+ "id": "788861822",
48
+ "name": "Kim Ahlstr\u00f6m"
49
+ },
50
+ {
51
+ "id": "1065572597",
52
+ "name": "Birkir A Barkarson"
53
+ },
54
+ {
55
+ "id": "1160375293",
56
+ "name": "Fuyuko Ito Matsumura"
57
+ },
58
+ {
59
+ "id": "1185203299",
60
+ "name": "Taizo Matsuoka"
61
+ },
62
+ {
63
+ "id": "1272049161",
64
+ "name": "Hironori Nishihara"
65
+ },
66
+ {
67
+ "id": "1378327790",
68
+ "name": "Hiroki Hirao"
69
+ },
70
+ {
71
+ "id": "1625266113",
72
+ "name": "Hiroko Yoshii"
73
+ },
74
+ {
75
+ "id": "100000010792825",
76
+ "name": "Toshihiko Fushimi"
77
+ },
78
+ {
79
+ "id": "100000523665522",
80
+ "name": "Natsuko Iketani"
81
+ }]
82
+ }
@@ -0,0 +1 @@
1
+ {"id":"12345"}
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: 31
4
+ hash: 29
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
8
  - 1
9
- - 10
10
- version: 2.1.10
9
+ - 11
10
+ version: 2.1.11
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-10-05 00:00:00 Z
18
+ date: 2011-10-24 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: httpclient
@@ -449,6 +449,7 @@ files:
449
449
  - spec/mock_json/events/noreply/smartday_private.json
450
450
  - spec/mock_json/exchange_sessions_null_response.json
451
451
  - spec/mock_json/exchange_sessions_response.json
452
+ - spec/mock_json/friend_lists/members/sample.json
452
453
  - spec/mock_json/groups/docs/private.json
453
454
  - spec/mock_json/groups/members/emacs_private.json
454
455
  - spec/mock_json/pages/admins/blank.json
@@ -531,6 +532,7 @@ files:
531
532
  - spec/mock_json/users/feed/post_with_invalid_access_token.json
532
533
  - spec/mock_json/users/feed/post_with_valid_access_token.json
533
534
  - spec/mock_json/users/feed/post_without_access_token.json
535
+ - spec/mock_json/users/friend_lists/created.json
534
536
  - spec/mock_json/users/friend_lists/matake.json
535
537
  - spec/mock_json/users/friend_requests/sample.json
536
538
  - spec/mock_json/users/friends/arjun_private.json
@@ -774,6 +776,7 @@ test_files:
774
776
  - spec/mock_json/events/noreply/smartday_private.json
775
777
  - spec/mock_json/exchange_sessions_null_response.json
776
778
  - spec/mock_json/exchange_sessions_response.json
779
+ - spec/mock_json/friend_lists/members/sample.json
777
780
  - spec/mock_json/groups/docs/private.json
778
781
  - spec/mock_json/groups/members/emacs_private.json
779
782
  - spec/mock_json/pages/admins/blank.json
@@ -856,6 +859,7 @@ test_files:
856
859
  - spec/mock_json/users/feed/post_with_invalid_access_token.json
857
860
  - spec/mock_json/users/feed/post_with_valid_access_token.json
858
861
  - spec/mock_json/users/feed/post_without_access_token.json
862
+ - spec/mock_json/users/friend_lists/created.json
859
863
  - spec/mock_json/users/friend_lists/matake.json
860
864
  - spec/mock_json/users/friend_requests/sample.json
861
865
  - spec/mock_json/users/friends/arjun_private.json