Class: FacebookGraph
- Inherits:
-
Object
- Object
- FacebookGraph
- Includes:
- FacebookHttp
- Defined in:
- lib/fbauth/graph.rb
Constant Summary collapse
- FB_GRAPH_URL =
"https://graph.facebook.com"
Instance Method Summary collapse
-
#call(path, options = {}) ⇒ Object
Generic Graph call to lookup data for any path.
-
#initialize(access_token = nil, options = {}) ⇒ FacebookGraph
constructor
A new instance of FacebookGraph.
-
#publish_to_member_feed(uid, options) ⇒ Object
Post item to member’s wall Available options: message, picture, link, name, caption, description.
Methods included from FacebookHttp
#build_get_url, #build_query_string, #caching_enabled?, #get, #has_access_token?, #logger, #merged_options, #post
Constructor Details
#initialize(access_token = nil, options = {}) ⇒ FacebookGraph
Returns a new instance of FacebookGraph.
9 10 11 |
# File 'lib/fbauth/graph.rb', line 9 def initialize(access_token = nil, = {}) @options = .merge({ :access_token => access_token }) end |
Instance Method Details
#call(path, options = {}) ⇒ Object
Generic Graph call to lookup data for any path
14 15 16 |
# File 'lib/fbauth/graph.rb', line 14 def call(path, = {}) get "#{FB_GRAPH_URL}/#{path}", () end |
#publish_to_member_feed(uid, options) ⇒ Object
Post item to member’s wall
Available options: message, picture, link, name, caption, description
20 21 22 23 24 25 |
# File 'lib/fbauth/graph.rb', line 20 def publish_to_member_feed(uid, ) raise "access_token required" unless has_access_token?() if %w{staging production}.include? Rails.env post "#{FB_GRAPH_URL}/#{uid}/feed", () end end |