class FBGraph::Client
Attributes
access_token[RW]
auth[RW]
client_id[RW]
consumer[RW]
facebook_uri[RW]
logger[RW]
secret_id[RW]
Public Class Methods
new(options = {})
click to toggle source
# File lib/fbgraph/client.rb, line 7 def initialize(options = {}) @client_id = options[:client_id] || FBGraph.config[:client_id] @secret_id = options[:secret_id] || FBGraph.config[:secret_id] @ca_file = options[:ca_file] || FBGraph.config[:ca_file] || default_ca_file @facebook_uri = options[:facebook_uri] || 'https://graph.facebook.com' @consumer = RestClient::Resource.new(@facebook_uri, rest_client_ssl_options) @access_token = options.fetch :token, nil @auth = OAuth2::AccessToken.new(oauth_client, @access_token) @logger = options[:logger] || FBGraph::Logger return true end
Public Instance Methods
default_ca_file()
click to toggle source
# File lib/fbgraph/client.rb, line 65 def default_ca_file File.join(File.dirname(__FILE__), 'cacert.pem') end
fql()
click to toggle source
# File lib/fbgraph/client.rb, line 41 def fql FBGraph::FQL.new(self) end
oauth_client()
click to toggle source
# File lib/fbgraph/client.rb, line 49 def oauth_client OAuth2::Client.new(client_id, secret_id, :site => { :url => facebook_uri }, :token_url => '/oauth/access_token', :authorize_url => '/oauth/authorize', :ssl => oauth_client_ssl_options) end
oauth_client_ssl_options()
click to toggle source
# File lib/fbgraph/client.rb, line 57 def oauth_client_ssl_options { :ca_file => @ca_file, :verify => OpenSSL::SSL::VERIFY_PEER } end
realtime()
click to toggle source
# File lib/fbgraph/client.rb, line 37 def realtime FBGraph::Realtime.new(self) end
rest_client_ssl_options()
click to toggle source
# File lib/fbgraph/client.rb, line 61 def rest_client_ssl_options { :ssl_ca_file => @ca_file, :verify_ssl => OpenSSL::SSL::VERIFY_PEER } end
search()
click to toggle source
# File lib/fbgraph/client.rb, line 33 def search FBGraph::Search.new(self) end
selection()
click to toggle source
# File lib/fbgraph/client.rb, line 29 def selection FBGraph::Selection.new(self) end
set_token(new_token)
click to toggle source
# File lib/fbgraph/client.rb, line 19 def set_token(new_token) @access_token = new_token @auth = OAuth2::AccessToken.new(oauth_client, @access_token) new_token end
timeline()
click to toggle source
# File lib/fbgraph/client.rb, line 45 def timeline FBGraph::Timeline.new(self) end