Class: Facebook::GraphApi
- Inherits:
-
Object
- Object
- Facebook::GraphApi
- Defined in:
- lib/facebook/graph_api.rb
Instance Attribute Summary collapse
-
#access_token ⇒ Object
readonly
Returns the value of attribute access_token.
-
#api ⇒ Object
readonly
Returns the value of attribute api.
Instance Method Summary collapse
-
#initialize(session) ⇒ GraphApi
constructor
A new instance of GraphApi.
-
#me ⇒ Object
also see developers.facebook.com/docs/reference/fql/ The Facebook Query Language for more efficient complex queries Also enables Multi-query.
- #my_friends ⇒ Object
- #my_messages ⇒ Object
- #my_picture ⇒ Object
-
#post_on_wall(message) ⇒ Object
Post.
Constructor Details
#initialize(session) ⇒ GraphApi
Returns a new instance of GraphApi.
5 6 7 8 |
# File 'lib/facebook/graph_api.rb', line 5 def initialize session @access_token = session[:access_token] @api = Koala::Facebook::GraphAndRestAPI.new(access_token) end |
Instance Attribute Details
#access_token ⇒ Object (readonly)
Returns the value of attribute access_token.
3 4 5 |
# File 'lib/facebook/graph_api.rb', line 3 def access_token @access_token end |
#api ⇒ Object (readonly)
Returns the value of attribute api.
3 4 5 |
# File 'lib/facebook/graph_api.rb', line 3 def api @api end |
Instance Method Details
#me ⇒ Object
also see developers.facebook.com/docs/reference/fql/ The Facebook Query Language for more efficient complex queries Also enables Multi-query
14 15 16 |
# File 'lib/facebook/graph_api.rb', line 14 def me @me ||= api.me end |
#my_friends ⇒ Object
25 26 27 28 |
# File 'lib/facebook/graph_api.rb', line 25 def my_friends # or fb.me.friends me.friends end |
#my_messages ⇒ Object
34 35 36 |
# File 'lib/facebook/graph_api.rb', line 34 def api.get_object "/me/statuses", "fields"=>"message" end |
#my_picture ⇒ Object
30 31 32 |
# File 'lib/facebook/graph_api.rb', line 30 def my_picture api.get_picture my_id end |
#post_on_wall(message) ⇒ Object
Post
40 41 42 |
# File 'lib/facebook/graph_api.rb', line 40 def post_on_wall api.put_wall_post end |