Module: FBGraphRails

Defined in:
lib/fbgraph_rails.rb,
lib/fbgraph_rails/engine.rb,
lib/fbgraph_rails/controller.rb,
lib/fbgraph_rails/fbgraph_client.rb

Overview

:nodoc: namespace

Defined Under Namespace

Modules: ControllerClassMethods, ControllerInstanceMethods, ControllerMixin Classes: Engine

Class Method Summary collapse

Class Method Details

.authorization_url(redirect_url) ⇒ Object



28
29
30
31
# File 'lib/fbgraph_rails/fbgraph_client.rb', line 28

def self.authorization_url(redirect_url)
  global_fbclient.authorization.authorize_url :redirect_uri => redirect_url,
      :scope => config['scope'].sort.join(',')
end

.configObject



5
6
7
# File 'lib/fbgraph_rails/fbgraph_client.rb', line 5

def self.config
  @config ||= config_without_caching
end

.config_without_cachingObject



9
10
11
12
# File 'lib/fbgraph_rails/fbgraph_client.rb', line 9

def self.config_without_caching
  erb_file = File.read(Rails.root.join('config', 'fbgraph.yml'))
  YAML.load Erubis::Eruby.new(erb_file).result
end

.fbclient(access_token) ⇒ Object



18
19
20
21
# File 'lib/fbgraph_rails/fbgraph_client.rb', line 18

def self.fbclient(access_token)
  FBGraph::Client.new :client_id => config['id'], :token => access_token,
                      :secret_id => config['secret'] 
end

.global_fbclientObject



14
15
16
# File 'lib/fbgraph_rails/fbgraph_client.rb', line 14

def self.global_fbclient
  @client ||= new_global_fbclient
end

.new_global_fbclientObject



23
24
25
26
# File 'lib/fbgraph_rails/fbgraph_client.rb', line 23

def self.new_global_fbclient
  FBGraph::Client.new :client_id => config['id'],
                      :secret_id => config['secret']
end