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.



10
11
12
# File 'lib/facebooker2.rb', line 10

def api_key
  @api_key
end

.app_idObject

Returns the value of attribute app_id.



10
11
12
# File 'lib/facebooker2.rb', line 10

def app_id
  @app_id
end

Returns the value of attribute cookie_prefix.



10
11
12
# File 'lib/facebooker2.rb', line 10

def cookie_prefix
  @cookie_prefix
end

.oauth2Object

Returns the value of attribute oauth2.



10
11
12
# File 'lib/facebooker2.rb', line 10

def oauth2
  @oauth2
end

.secretObject

Returns the value of attribute secret.



10
11
12
# File 'lib/facebooker2.rb', line 10

def secret
  @secret
end

Class Method Details

.cast_to_facebook_id(object) ⇒ Object



37
38
39
40
41
42
43
44
45
# File 'lib/facebooker2.rb', line 37

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



25
26
27
28
29
# File 'lib/facebooker2.rb', line 25

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:



31
32
33
34
35
# File 'lib/facebooker2.rb', line 31

def self.load_facebooker_yaml
  config = (YAML.load(ERB.new(File.read(File.join(::Rails.root,"config","facebooker.yml"))).result)[::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:



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

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