Permalink
Browse files

added timeline support (custom and built in actions) , added fql support

  • Loading branch information...
1 parent 9760dbe commit c400cac54854cb8473b186b62fd657136ac4def5 @nsanta committed Apr 27, 2012
Showing with 50 additions and 8 deletions.
  1. +3 −0 lib/fbgraph.rb
  2. +8 −0 lib/fbgraph/client.rb
  3. +9 −0 lib/fbgraph/fql.rb
  4. +2 −8 lib/fbgraph/selection.rb
  5. +28 −0 lib/fbgraph/timeline.rb
View
@@ -17,6 +17,9 @@
require 'fbgraph/search'
require 'fbgraph/realtime'
require 'fbgraph/canvas'
+require 'fbgraph/logger'
+require 'fbgraph/fql'
+require 'fbgraph/timeline'
module FBGraph
@config = nil
View
@@ -38,6 +38,14 @@ def realtime
FBGraph::Realtime.new(self)
end
+ def fql
+ FBGraph::FQL.new(self)
+ end
+
+ def timeline
+ FBGraph::Timeline.new(self)
+ end
+
def oauth_client
OAuth2::Client.new(client_id, secret_id,
:site => { :url => facebook_uri },
View
@@ -0,0 +1,9 @@
+module FBGraph
+ class FQL < Base
+
+
+ def query(q)
+ find('fql').param(:q => q).info!
+ end
+ end
+end
View
@@ -26,8 +26,8 @@ def #{object}(object)
CONNECTION_TYPES.each do |object|
class_eval <<-METHOD
- def #{object}
- connection('#{object}')
+ def #{object}(connection_id = nil)
+ connection(['#{object}', connection_id])
self
end
METHOD
@@ -38,12 +38,6 @@ def me
find('me')
end
-
- def action(namespace,action)
- connection([namespace,action].join(':'))
- self
- end
-
def metadata
@params.merge!({:metadata => '1'})
self
View
@@ -0,0 +1,28 @@
+module FBGraph
+ class Timeline < Base
+
+ BUILT_IN_ACTIONS = {
+ :listens => :music,
+ :reads => :news,
+ :watches => :movie,
+ }
+
+
+ def action(namespace,action)
+ connection([namespace,action].join(':'))
+ self
+ end
+
+ BUILT_IN_ACTIONS.each do |action,obj|
+ class_eval <<-METHOD
+ def #{action}
+ find('me').connection("#{[obj,action].join('.')}")
+ self
+ end
+ METHOD
+ end
+
+
+
+ end
+end

0 comments on commit c400cac

Please sign in to comment.