Class: FacebookOAuth::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/facebook_oauth/client.rb,
lib/facebook_oauth/objects.rb

Instance Method Summary (collapse)

Constructor Details

- (Client) initialize(options = {})

A new instance of Client



6
7
8
9
10
11
# File 'lib/facebook_oauth/client.rb', line 6

def initialize(options = {})
  @application_id = options[:application_id]
  @application_secret = options[:application_secret]
  @callback = options[:callback]
  @token = options[:token]
end

Instance Method Details

- (Object) album(id)



8
9
10
# File 'lib/facebook_oauth/objects.rb', line 8

def album(id)
  FacebookOAuth::FacebookObject.new(id, self)
end

- (Object) authorize(options = {})



21
22
23
24
25
26
27
28
# File 'lib/facebook_oauth/client.rb', line 21

def authorize(options = {})
  @access_token ||= consumer.web_server.get_access_token(
    options[:code],
    :redirect_uri => options[:callback] || @callback
  )
  @token = @access_token.token
  @access_token
end

- (Object) authorize_url(options = {})



13
14
15
16
17
18
19
# File 'lib/facebook_oauth/client.rb', line 13

def authorize_url(options = {})
  options[:scope] ||= 'offline_access,publish_stream'
  consumer.web_server.authorize_url(
    :redirect_uri => options[:callback] || @callback,
    :scope => options[:scope]
  )
end

- (Object) event(id)



12
13
14
# File 'lib/facebook_oauth/objects.rb', line 12

def event(id)
  FacebookOAuth::FacebookObject.new(id, self)
end

- (Object) group(id)



16
17
18
# File 'lib/facebook_oauth/objects.rb', line 16

def group(id)
  FacebookOAuth::FacebookObject.new(id, self)
end


20
21
22
# File 'lib/facebook_oauth/objects.rb', line 20

def link(id)
  FacebookOAuth::FacebookObject.new(id, self)
end

- (Object) me(id = 'me'))



4
5
6
# File 'lib/facebook_oauth/objects.rb', line 4

def me(id = 'me')
  FacebookOAuth::FacebookObject.new(id, self)
end

- (Object) note(id)



24
25
26
# File 'lib/facebook_oauth/objects.rb', line 24

def note(id)
  FacebookOAuth::FacebookObject.new(id, self)
end

- (Object) page(id)



28
29
30
# File 'lib/facebook_oauth/objects.rb', line 28

def page(id)
  FacebookOAuth::FacebookObject.new(id, self)
end

- (Object) photo(id)



32
33
34
# File 'lib/facebook_oauth/objects.rb', line 32

def photo(id)
  FacebookOAuth::FacebookObject.new(id, self)
end

- (Object) post(id)



36
37
38
# File 'lib/facebook_oauth/objects.rb', line 36

def post(id)
  FacebookOAuth::FacebookObject.new(id, self)
end

- (Object) status(id)



40
41
42
# File 'lib/facebook_oauth/objects.rb', line 40

def status(id)
  FacebookOAuth::FacebookObject.new(id, self)
end

- (Object) user(id)



44
45
46
# File 'lib/facebook_oauth/objects.rb', line 44

def user(id)
  FacebookOAuth::FacebookObject.new(id, self)
end

- (Object) video(id)



48
49
50
# File 'lib/facebook_oauth/objects.rb', line 48

def video(id)
  FacebookOAuth::FacebookObject.new(id, self)
end