fb_graph 1.8.2 → 1.8.3

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fb_graph (1.8.1)
4
+ fb_graph (1.8.2)
5
5
  httpclient (>= 2.2.0.2)
6
6
  rack-oauth2 (>= 0.8.0)
7
7
 
@@ -14,7 +14,7 @@ GEM
14
14
  crack (0.1.8)
15
15
  diff-lcs (1.1.2)
16
16
  httpclient (2.2.0.2)
17
- i18n (0.5.0)
17
+ i18n (0.6.0)
18
18
  json (1.5.1)
19
19
  rack (1.2.2)
20
20
  rack-oauth2 (0.8.0)
data/README.rdoc CHANGED
@@ -17,9 +17,9 @@ A full-stack Facebook Graph API wrapper in Ruby.
17
17
  == Examples
18
18
 
19
19
  Now FbGraph supports all objects listed here: http://developers.facebook.com/docs/reference/api/
20
- Almost all connections for each object are also supported. (Private message connections are not supported yet)
20
+ Almost all connections for each object are also supported. ("attachments" and "shares" connections of message object are not supported yet)
21
21
 
22
- Plus, you can play an Rails sample app here. http://fbgraphsample.heroku.com/
22
+ You can also play with a Rails sample app here. http://fbgraphsample.heroku.com/
23
23
 
24
24
  === GET
25
25
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.8.2
1
+ 1.8.3
@@ -1,7 +1,7 @@
1
1
  module FbGraph
2
2
  module Connections
3
- module Threads
4
- def threads(options = {})
3
+ module Inbox
4
+ def inbox(options = {})
5
5
  threads = self.connection(:threads, options)
6
6
  threads.map! do |thread|
7
7
  Thread.new(thread[:id], thread.merge(
@@ -0,0 +1,17 @@
1
+ module FbGraph
2
+ module Connections
3
+ module Tags
4
+ def tags(options = {})
5
+ tags = if @_tags_ && options.blank?
6
+ self.connection(:tags, options.merge(:cached_collection => @_tags_))
7
+ else
8
+ self.connection(:tags, options)
9
+ end
10
+ tags.map! do |tag|
11
+ tag[:access_token] ||= options[:access_token] || self.access_token
12
+ Tag.new(tag)
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -3,6 +3,7 @@ module FbGraph
3
3
  # TODO:
4
4
  # include Connections::Attachments
5
5
  # include Connections::Shares
6
+ include Connections::Tags
6
7
 
7
8
  attr_accessor :subject, :message, :from, :to, :tags, :created_time
8
9
 
@@ -28,6 +29,9 @@ module FbGraph
28
29
  if attributes[:created_time]
29
30
  @created_time = Time.parse(attributes[:created_time]).utc
30
31
  end
32
+
33
+ # cached connection
34
+ @_tags_ = Collection.new(attributes[:tags])
31
35
  end
32
36
  end
33
37
  end
@@ -4,21 +4,16 @@ module FbGraph
4
4
  include Connections::Participants
5
5
  include Connections::FormerParticipants
6
6
  include Connections::Senders
7
+ include Connections::Tags
7
8
 
8
- attr_accessor :subject, :snippet, :message_count, :unread_count, :tags, :updated_time
9
+ attr_accessor :subject, :snippet, :message_count, :unread_count, :updated_time
9
10
 
10
11
  def initialize(identifier, attributes = {})
11
12
  super
12
- @subject = attributes[:subject] # NOTE: Probably obsolete
13
+ @subject = attributes[:subject] # NOTE: New Facebook Message platform will make this field blank.
13
14
  @snippet = attributes[:snippet]
14
15
  @message_count = attributes[:message_count]
15
16
  @unread_count = attributes[:unread_count].to_i
16
- @tags = []
17
- if attributes[:tags]
18
- Collection.new(attributes[:tags]).each do |tag|
19
- @tags << Tag.new(tag)
20
- end
21
- end
22
17
  if attributes[:updated_time]
23
18
  @updated_time = Time.parse(attributes[:updated_time]).utc
24
19
  end
@@ -28,6 +23,7 @@ module FbGraph
28
23
  @_participants_ = Collection.new(attributes[:participants])
29
24
  @_former_participants_ = Collection.new(attributes[:former_articipants])
30
25
  @_senders_ = Collection.new(attributes[:senders])
26
+ @_tags_ = Collection.new(attributes[:tags])
31
27
  end
32
28
  end
33
29
  end
data/lib/fb_graph/user.rb CHANGED
@@ -14,6 +14,7 @@ module FbGraph
14
14
  include Connections::Games
15
15
  include Connections::Groups
16
16
  include Connections::Home
17
+ include Connections::Inbox
17
18
  include Connections::Interests
18
19
  include Connections::Likes
19
20
  include Connections::Links
@@ -28,7 +29,6 @@ module FbGraph
28
29
  include Connections::Statuses
29
30
  include Connections::Tagged
30
31
  include Connections::Television
31
- include Connections::Threads
32
32
  include Connections::Videos
33
33
  extend Searchable
34
34
 
@@ -0,0 +1,12 @@
1
+ require 'spec_helper'
2
+
3
+ describe FbGraph::Connections::Inbox, '#inbox' do
4
+ it 'should return threads as FbGraph::Thread' do
5
+ mock_graph :get, 'me/threads', 'users/inbox/me_private', :access_token => 'access_token' do
6
+ threads = FbGraph::User.me('access_token').inbox
7
+ threads.each do |thread|
8
+ thread.should be_instance_of(FbGraph::Thread)
9
+ end
10
+ end
11
+ end
12
+ end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: fb_graph
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.8.2
5
+ version: 1.8.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - nov matake
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-05-22 00:00:00 Z
13
+ date: 2011-05-23 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: httpclient
@@ -138,6 +138,7 @@ files:
138
138
  - lib/fb_graph/connections/games.rb
139
139
  - lib/fb_graph/connections/groups.rb
140
140
  - lib/fb_graph/connections/home.rb
141
+ - lib/fb_graph/connections/inbox.rb
141
142
  - lib/fb_graph/connections/insights.rb
142
143
  - lib/fb_graph/connections/interests.rb
143
144
  - lib/fb_graph/connections/invited.rb
@@ -160,9 +161,9 @@ files:
160
161
  - lib/fb_graph/connections/statuses.rb
161
162
  - lib/fb_graph/connections/subscriptions.rb
162
163
  - lib/fb_graph/connections/tagged.rb
164
+ - lib/fb_graph/connections/tags.rb
163
165
  - lib/fb_graph/connections/television.rb
164
166
  - lib/fb_graph/connections/test_users.rb
165
- - lib/fb_graph/connections/threads.rb
166
167
  - lib/fb_graph/connections/videos.rb
167
168
  - lib/fb_graph/education.rb
168
169
  - lib/fb_graph/event.rb
@@ -225,6 +226,7 @@ files:
225
226
  - spec/fb_graph/connections/games_spec.rb
226
227
  - spec/fb_graph/connections/groups_spec.rb
227
228
  - spec/fb_graph/connections/home_spec.rb
229
+ - spec/fb_graph/connections/inbox_spec.rb
228
230
  - spec/fb_graph/connections/insights_spec.rb
229
231
  - spec/fb_graph/connections/interests_spec.rb
230
232
  - spec/fb_graph/connections/invited_spec.rb
@@ -248,7 +250,6 @@ files:
248
250
  - spec/fb_graph/connections/tagged_spec.rb
249
251
  - spec/fb_graph/connections/television_spec.rb
250
252
  - spec/fb_graph/connections/test_users_spec.rb
251
- - spec/fb_graph/connections/threads_spec.rb
252
253
  - spec/fb_graph/connections/videos_spec.rb
253
254
  - spec/fb_graph/education_spec.rb
254
255
  - spec/fb_graph/event_spec.rb
@@ -383,6 +384,7 @@ files:
383
384
  - spec/mock_json/users/home/me_private_next.json
384
385
  - spec/mock_json/users/home/me_private_previous.json
385
386
  - spec/mock_json/users/home/me_public.json
387
+ - spec/mock_json/users/inbox/me_private.json
386
388
  - spec/mock_json/users/interests/matake_private.json
387
389
  - spec/mock_json/users/likes/arjun_private.json
388
390
  - spec/mock_json/users/likes/arjun_public.json
@@ -401,7 +403,6 @@ files:
401
403
  - spec/mock_json/users/tagged/arjun_private.json
402
404
  - spec/mock_json/users/tagged/arjun_public.json
403
405
  - spec/mock_json/users/television/matake_private.json
404
- - spec/mock_json/users/threads/me_private.json
405
406
  - spec/mock_json/users/videos/kirk_private.json
406
407
  - spec/spec_helper.rb
407
408
  homepage: http://github.com/nov/fb_graph
@@ -460,6 +461,7 @@ test_files:
460
461
  - spec/fb_graph/connections/games_spec.rb
461
462
  - spec/fb_graph/connections/groups_spec.rb
462
463
  - spec/fb_graph/connections/home_spec.rb
464
+ - spec/fb_graph/connections/inbox_spec.rb
463
465
  - spec/fb_graph/connections/insights_spec.rb
464
466
  - spec/fb_graph/connections/interests_spec.rb
465
467
  - spec/fb_graph/connections/invited_spec.rb
@@ -483,7 +485,6 @@ test_files:
483
485
  - spec/fb_graph/connections/tagged_spec.rb
484
486
  - spec/fb_graph/connections/television_spec.rb
485
487
  - spec/fb_graph/connections/test_users_spec.rb
486
- - spec/fb_graph/connections/threads_spec.rb
487
488
  - spec/fb_graph/connections/videos_spec.rb
488
489
  - spec/fb_graph/education_spec.rb
489
490
  - spec/fb_graph/event_spec.rb
@@ -618,6 +619,7 @@ test_files:
618
619
  - spec/mock_json/users/home/me_private_next.json
619
620
  - spec/mock_json/users/home/me_private_previous.json
620
621
  - spec/mock_json/users/home/me_public.json
622
+ - spec/mock_json/users/inbox/me_private.json
621
623
  - spec/mock_json/users/interests/matake_private.json
622
624
  - spec/mock_json/users/likes/arjun_private.json
623
625
  - spec/mock_json/users/likes/arjun_public.json
@@ -636,6 +638,5 @@ test_files:
636
638
  - spec/mock_json/users/tagged/arjun_private.json
637
639
  - spec/mock_json/users/tagged/arjun_public.json
638
640
  - spec/mock_json/users/television/matake_private.json
639
- - spec/mock_json/users/threads/me_private.json
640
641
  - spec/mock_json/users/videos/kirk_private.json
641
642
  - spec/spec_helper.rb
@@ -1,12 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe FbGraph::Connections::Threads, '#threads' do
4
- it 'should return threads as FbGraph::Thread' do
5
- mock_graph :get, 'me/threads', 'users/threads/me_private', :access_token => 'access_token' do
6
- threads = FbGraph::User.me('access_token').threads
7
- threads.each do |thread|
8
- thread.should be_instance_of(FbGraph::Thread)
9
- end
10
- end
11
- end
12
- end