Class: Fb::Auth

Inherits:
Object
  • Object
show all
Defined in:
lib/fb/auth.rb,
lib/fb/auth/version.rb

Overview

Provides methods to authenticate a user with the Facebook OAuth flow.

Constant Summary collapse

VERSION =

Returns the SemVer-compatible gem version.

See Also:

'1.0.0.alpha4'

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Auth

Returns a new instance of Auth.


16
17
18
19
20
21
# File 'lib/fb/auth.rb', line 16

def initialize(options = {})
  @redirect_uri = options[:redirect_uri]
  @code = options[:code]
  @refresh_token = options[:refresh_token]
  @scope = options[:scope]
end

Instance Method Details

#access_tokenString


34
35
36
37
38
39
40
# File 'lib/fb/auth.rb', line 34

def access_token
  params = {redirect_uri: @redirect_uri, code: @code}
  temp_token = fetch_access_token_with params

  params = {grant_type: :fb_exchange_token, fb_exchange_token: temp_token}
  fetch_access_token_with params
end

#revokeBoolean


24
25
26
# File 'lib/fb/auth.rb', line 24

def revoke
  !!HTTPRequest.new(revoke_options).run
end

#urlString


29
30
31
# File 'lib/fb/auth.rb', line 29

def url
  HTTPRequest.new(url_options).url
end