class FbGraphApi::Profile
This module provides API requests to get facebook profile details and profile picture
Attributes
id[RW]
Public Class Methods
new(token = nil)
click to toggle source
Intialize connection Reverses the contents of a String or IO object. @param token [String]
# File lib/fb_graph_api/profile.rb, line 13 def initialize(token = nil) client = FbGraphApi::Client.new(token) @connection = client.connection end
Public Instance Methods
info()
click to toggle source
Retrieve profile details @return Object of facebook profile details
# 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')
click to toggle source
Retrieve facebook picture @param size [String] @return Object of facebook picture
# 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