Class: Facebook::Login

Inherits:
Base
  • Object
show all
Defined in:
app/managers/facebook/login.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Login

Returns a new instance of Login.


5
6
7
8
9
# File 'app/managers/facebook/login.rb', line 5

def initialize(options={})
  super()

  @user_type = options[:user_type] || 'User'
end

Instance Attribute Details

#auth_headerObject

Returns the value of attribute auth_header.


3
4
5
# File 'app/managers/facebook/login.rb', line 3

def auth_header
  @auth_header
end

Instance Method Details

#login_with_token(token) ⇒ Object


11
12
13
14
15
16
17
18
19
# File 'app/managers/facebook/login.rb', line 11

def (token)
  @graph = Koala::Facebook::API.new(token)

  get_info()

  return false if @user_type.constantize.where(email: @info['email']).where.not(provider: :facebook).count > 0

  (@info['id'])
end