Class: FBGraph::Client
- Inherits:
-
Object
- Object
- FBGraph::Client
- Defined in:
- lib/fbgraph/client.rb
Instance Attribute Summary (collapse)
-
- (Object) access_token
Returns the value of attribute access_token.
-
- (Object) auth
Returns the value of attribute auth.
-
- (Object) client_id
Returns the value of attribute client_id.
-
- (Object) consumer
Returns the value of attribute consumer.
-
- (Object) facebook_uri
Returns the value of attribute facebook_uri.
-
- (Object) logger
Returns the value of attribute logger.
-
- (Object) secret_id
Returns the value of attribute secret_id.
Instance Method Summary (collapse)
- - (Object) authorization
- - (Object) default_ca_file
- - (Object) fql
-
- (Client) initialize(options = {})
constructor
A new instance of Client.
- - (Object) oauth_client
- - (Object) oauth_client_ssl_options
- - (Object) realtime
- - (Object) rest_client_ssl_options
- - (Object) search
- - (Object) selection
- - (Object) set_token(new_token)
- - (Object) timeline
Constructor Details
- (Client) initialize(options = {})
A new instance of Client
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/fbgraph/client.rb', line 7 def initialize( = {}) @client_id = [:client_id] || FBGraph.config[:client_id] @secret_id = [:secret_id] || FBGraph.config[:secret_id] @ca_file = [:ca_file] || FBGraph.config[:ca_file] || default_ca_file @facebook_uri = [:facebook_uri] || 'https://graph.facebook.com' @consumer = RestClient::Resource.new(@facebook_uri, ) @access_token = .fetch :token, nil @auth = OAuth2::AccessToken.new(oauth_client, @access_token) @logger = [:logger] || FBGraph::Logger return true end |
Instance Attribute Details
- (Object) access_token
Returns the value of attribute access_token
5 6 7 |
# File 'lib/fbgraph/client.rb', line 5 def access_token @access_token end |
- (Object) auth
Returns the value of attribute auth
5 6 7 |
# File 'lib/fbgraph/client.rb', line 5 def auth @auth end |
- (Object) client_id
Returns the value of attribute client_id
5 6 7 |
# File 'lib/fbgraph/client.rb', line 5 def client_id @client_id end |
- (Object) consumer
Returns the value of attribute consumer
5 6 7 |
# File 'lib/fbgraph/client.rb', line 5 def consumer @consumer end |
- (Object) facebook_uri
Returns the value of attribute facebook_uri
5 6 7 |
# File 'lib/fbgraph/client.rb', line 5 def facebook_uri @facebook_uri end |
- (Object) logger
Returns the value of attribute logger
5 6 7 |
# File 'lib/fbgraph/client.rb', line 5 def logger @logger end |
- (Object) secret_id
Returns the value of attribute secret_id
5 6 7 |
# File 'lib/fbgraph/client.rb', line 5 def secret_id @secret_id end |
Instance Method Details
- (Object) authorization
25 26 27 |
# File 'lib/fbgraph/client.rb', line 25 def FBGraph::Authorization.new(self) end |
- (Object) default_ca_file
65 66 67 |
# File 'lib/fbgraph/client.rb', line 65 def default_ca_file File.join(File.dirname(__FILE__), 'cacert.pem') end |
- (Object) fql
41 42 43 |
# File 'lib/fbgraph/client.rb', line 41 def fql FBGraph::FQL.new(self) end |
- (Object) oauth_client
49 50 51 52 53 54 55 |
# 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 => ) end |
- (Object) oauth_client_ssl_options
57 58 59 |
# File 'lib/fbgraph/client.rb', line 57 def { :ca_file => @ca_file, :verify => OpenSSL::SSL::VERIFY_PEER } end |
- (Object) realtime
37 38 39 |
# File 'lib/fbgraph/client.rb', line 37 def realtime FBGraph::Realtime.new(self) end |
- (Object) rest_client_ssl_options
61 62 63 |
# File 'lib/fbgraph/client.rb', line 61 def { :ssl_ca_file => @ca_file, :verify_ssl => OpenSSL::SSL::VERIFY_PEER } end |
- (Object) search
33 34 35 |
# File 'lib/fbgraph/client.rb', line 33 def search FBGraph::Search.new(self) end |
- (Object) selection
29 30 31 |
# File 'lib/fbgraph/client.rb', line 29 def selection FBGraph::Selection.new(self) end |
- (Object) set_token(new_token)
19 20 21 22 23 |
# 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 |
- (Object) timeline
45 46 47 |
# File 'lib/fbgraph/client.rb', line 45 def timeline FBGraph::Timeline.new(self) end |