Class: FacebookOAuth::Client
- Inherits:
-
Object
- Object
- FacebookOAuth::Client
- Defined in:
- lib/facebook_oauth/client.rb,
lib/facebook_oauth/objects.rb
Instance Method Summary collapse
- #album(id) ⇒ Object
- #authorize(options = {}) ⇒ Object
- #authorize_url(options = {}) ⇒ Object
- #event(id) ⇒ Object
- #group(id) ⇒ Object
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
- #link(id) ⇒ Object
- #me(id = 'me') ⇒ Object
- #note(id) ⇒ Object
- #page(id) ⇒ Object
- #photo(id) ⇒ Object
- #post(id) ⇒ Object
- #status(id) ⇒ Object
- #user(id) ⇒ Object
- #video(id) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
6 7 8 9 10 11 |
# File 'lib/facebook_oauth/client.rb', line 6 def initialize( = {}) @application_id = [:application_id] @application_secret = [:application_secret] @callback = [:callback] @token = [:token] end |
Instance Method Details
#album(id) ⇒ Object
8 9 10 |
# File 'lib/facebook_oauth/objects.rb', line 8 def album(id) FacebookOAuth::FacebookObject.new(id, self) end |
#authorize(options = {}) ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/facebook_oauth/client.rb', line 22 def ( = {}) @access_token ||= client.auth_code.get_token( [:code], :redirect_uri => [:callback] || @callback, :parse => :query ) @token = @access_token.token @access_token end |
#authorize_url(options = {}) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/facebook_oauth/client.rb', line 13 def ( = {}) [:scope] ||= 'offline_access,publish_stream' client.auth_code.( :client_id => @application_id, :redirect_uri => [:callback] || @callback, :scope => [:scope] ) end |
#event(id) ⇒ Object
12 13 14 |
# File 'lib/facebook_oauth/objects.rb', line 12 def event(id) FacebookOAuth::FacebookObject.new(id, self) end |
#group(id) ⇒ Object
16 17 18 |
# File 'lib/facebook_oauth/objects.rb', line 16 def group(id) FacebookOAuth::FacebookObject.new(id, self) end |
#link(id) ⇒ Object
20 21 22 |
# File 'lib/facebook_oauth/objects.rb', line 20 def link(id) FacebookOAuth::FacebookObject.new(id, self) end |
#me(id = 'me') ⇒ Object
4 5 6 |
# File 'lib/facebook_oauth/objects.rb', line 4 def me(id = 'me') FacebookOAuth::FacebookObject.new(id, self) end |
#note(id) ⇒ Object
24 25 26 |
# File 'lib/facebook_oauth/objects.rb', line 24 def note(id) FacebookOAuth::FacebookObject.new(id, self) end |
#page(id) ⇒ Object
28 29 30 |
# File 'lib/facebook_oauth/objects.rb', line 28 def page(id) FacebookOAuth::FacebookObject.new(id, self) end |
#photo(id) ⇒ Object
32 33 34 |
# File 'lib/facebook_oauth/objects.rb', line 32 def photo(id) FacebookOAuth::FacebookObject.new(id, self) end |
#post(id) ⇒ Object
36 37 38 |
# File 'lib/facebook_oauth/objects.rb', line 36 def post(id) FacebookOAuth::FacebookObject.new(id, self) end |
#status(id) ⇒ Object
40 41 42 |
# File 'lib/facebook_oauth/objects.rb', line 40 def status(id) FacebookOAuth::FacebookObject.new(id, self) end |
#user(id) ⇒ Object
44 45 46 |
# File 'lib/facebook_oauth/objects.rb', line 44 def user(id) FacebookOAuth::FacebookObject.new(id, self) end |
#video(id) ⇒ Object
48 49 50 |
# File 'lib/facebook_oauth/objects.rb', line 48 def video(id) FacebookOAuth::FacebookObject.new(id, self) end |