Module: Facebooker2

Defined in:
lib/facebooker2.rb,
lib/facebooker2/rails.rb,
lib/facebooker2/rails/helpers.rb,
lib/facebooker2/rails/controller.rb,
lib/facebooker2/rails/helpers/user.rb,
lib/facebooker2/rails/helpers/javascript.rb,
lib/facebooker2/rails/helpers/request_forms.rb,
lib/facebooker2/rails/helpers/facebook_connect.rb

Defined Under Namespace

Modules: Rails Classes: NotConfigured

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.api_keyObject

Returns the value of attribute api_key.



6
7
8
# File 'lib/facebooker2.rb', line 6

def api_key
  @api_key
end

.app_idObject

Returns the value of attribute app_id.



6
7
8
# File 'lib/facebooker2.rb', line 6

def app_id
  @app_id
end

.secretObject

Returns the value of attribute secret.



6
7
8
# File 'lib/facebooker2.rb', line 6

def secret
  @secret
end

Class Method Details

.cast_to_facebook_id(object) ⇒ Object



33
34
35
36
37
38
39
40
41
# File 'lib/facebooker2.rb', line 33

def self.cast_to_facebook_id(object)
  if object.kind_of?(Mogli::Profile)
    object.id
  elsif object.respond_to?(:facebook_id)
    object.facebook_id
  else
    object
  end
end

.configuration=(hash) ⇒ Object



21
22
23
24
25
# File 'lib/facebooker2.rb', line 21

def self.configuration=(hash)
  self.api_key = hash[:api_key]
  self.secret = hash[:secret]
  self.app_id = hash[:app_id]
end

.load_facebooker_yamlObject

Raises:



27
28
29
30
31
# File 'lib/facebooker2.rb', line 27

def self.load_facebooker_yaml
  config = YAML.load(File.read(File.join(::Rails.root,"config","facebooker.yml")))[::Rails.env]
  raise NotConfigured.new("Unable to load configuration for #{::Rails.env} from facebooker.yml. Is it set up?") if config.nil?
  self.configuration = config.with_indifferent_access
end

.raise_unconfigured_exceptionObject

Raises:



17
18
19
# File 'lib/facebooker2.rb', line 17

def self.raise_unconfigured_exception
  raise NotConfigured.new("No configuration provided for Facebooker2. Either set the app_id and secret or call Facebooker2.load_facebooker_yaml in an initializer")
end