Class: FbGraphApi::Profile
- Inherits:
-
Object
- Object
- FbGraphApi::Profile
- Defined in:
- lib/fb_graph_api/profile.rb
Overview
This module provides API requests to get facebook profile details and profile picture
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
Instance Method Summary collapse
-
#info ⇒ Object
Retrieve profile details.
-
#initialize(token = nil) ⇒ Profile
constructor
Intialize connection Reverses the contents of a String or IO object.
-
#picture(size = 'large') ⇒ Object
Retrieve facebook picture.
Constructor Details
#initialize(token = nil) ⇒ Profile
Intialize connection Reverses the contents of a String or IO object.
13 14 15 16 |
# File 'lib/fb_graph_api/profile.rb', line 13 def initialize(token = nil) client = FbGraphApi::Client.new(token) @connection = client.connection end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
8 9 10 |
# File 'lib/fb_graph_api/profile.rb', line 8 def id @id end |
Instance Method Details
#info ⇒ Object
Retrieve profile details
20 21 22 23 24 |
# File 'lib/fb_graph_api/profile.rb', line 20 def info response = @connection.get 'me' self.id = response.body["id"].to_i OpenStruct.new(response.body) end |
#picture(size = 'large') ⇒ Object
Retrieve facebook picture
30 31 32 33 34 |
# File 'lib/fb_graph_api/profile.rb', line 30 def picture(size = 'large') info unless id response = @connection.get "#{@id}/picture", {type: size} OpenStruct.new(response.env.response_headers) end |