Sha256: 7beca2d8bf1a66b4d7feae4577d43c8df838d356a8693c75dd5ff15f593492a2

Contents?: true

Size: 1.09 KB

Versions: 5

Compression:

Stored size: 1.09 KB

Contents

module FBGraph
  
  class Client

    attr_accessor :client_id , :secret_id , :facebook_uri , :access_token , :consumer , :auth
      
    def initialize(options = {})
      @client_id, @secret_id = options[:client_id] || FBGraph.config[:client_id], options[:secret_id] || FBGraph.config[:secret_id]
      @facebook_uri = options[:facebook_uri] ||= 'https://graph.facebook.com'
      @consumer = RestClient::Resource.new(@facebook_uri)
      @access_token = options.fetch :token, nil
      @auth = OAuth2::AccessToken.new(oauth_client , @access_token)
      return true
    end
    
    def set_token(new_token)
      @access_token = new_token
      @auth = OAuth2::AccessToken.new(oauth_client , @access_token)
      new_token
    end

    def authorization
      FBGraph::Authorization.new(self)
    end
    
    def selection
      FBGraph::Selection.new(self)
    end
    
    def search
      FBGraph::Search.new(self)
    end
    
    def realtime
      FBGraph::Realtime.new(self)
    end
    
    def oauth_client
      OAuth2::Client.new(client_id, secret_id, :site => facebook_uri)
    end
    
  end  
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
fbgraph-1.7.1 lib/fbgraph/client.rb
fbgraph-1.7.0 lib/fbgraph/client.rb
fbgraph-1.6.0 lib/fbgraph/client.rb
fbgraph-1.5.4 lib/fbgraph/client.rb
fbgraph-1.5.2 lib/fbgraph/client.rb