Class: FbRails::Connect
- Inherits:
-
Object
- Object
- FbRails::Connect
- Defined in:
- lib/fb_rails/connect.rb
Instance Attribute Summary collapse
-
#cookies ⇒ Object
readonly
Returns the value of attribute cookies.
Class Method Summary collapse
Instance Method Summary collapse
- #access_token ⇒ Object
- #connected? ⇒ Boolean
- #cookie ⇒ Object
-
#initialize(cookies) ⇒ Connect
constructor
A new instance of Connect.
- #uid ⇒ Object
- #user ⇒ Object
Constructor Details
#initialize(cookies) ⇒ Connect
Returns a new instance of Connect.
10 11 12 |
# File 'lib/fb_rails/connect.rb', line 10 def initialize() @cookies = end |
Instance Attribute Details
#cookies ⇒ Object (readonly)
Returns the value of attribute cookies.
9 10 11 |
# File 'lib/fb_rails/connect.rb', line 9 def @cookies end |
Class Method Details
Instance Method Details
#access_token ⇒ Object
26 27 28 |
# File 'lib/fb_rails/connect.rb', line 26 def access_token connected? ? ['access_token'] : nil end |
#connected? ⇒ Boolean
18 19 20 |
# File 'lib/fb_rails/connect.rb', line 18 def connected? .present? end |
#cookie ⇒ Object
14 15 16 |
# File 'lib/fb_rails/connect.rb', line 14 def @cookie ||= FbRails::Cookie.decode([self.class.], FbRails::Config.secret) end |
#uid ⇒ Object
22 23 24 |
# File 'lib/fb_rails/connect.rb', line 22 def uid connected? ? ['uid'].to_i : nil end |
#user ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/fb_rails/connect.rb', line 30 def user if connected? @user ||= begin record = FbRails::Config.user_class.find_or_initialize_by_fb_uid(uid) record.access_token = access_token record end end end |