Class: FacebookTestUsers::User
- Inherits:
-
Object
- Object
- FacebookTestUsers::User
- Defined in:
- lib/facebook_test_users/user.rb
Instance Attribute Summary collapse
-
#access_token ⇒ Object
readonly
Returns the value of attribute access_token.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#login_url ⇒ Object
readonly
Returns the value of attribute login_url.
Instance Method Summary collapse
- #destroy ⇒ Object
-
#initialize(attrs) ⇒ User
constructor
A new instance of User.
- #send_friend_request_to(other) ⇒ Object
Constructor Details
#initialize(attrs) ⇒ User
Returns a new instance of User.
8 9 10 11 12 13 14 |
# File 'lib/facebook_test_users/user.rb', line 8 def initialize(attrs) # Hacky, but it allows for use of symbol keys, which are nice in # a console. @id, @access_token, @login_url = %w[id access_token login_url].map do |field| attrs[field.to_s] || attrs[field.to_sym] end end |
Instance Attribute Details
#access_token ⇒ Object (readonly)
Returns the value of attribute access_token.
6 7 8 |
# File 'lib/facebook_test_users/user.rb', line 6 def access_token @access_token end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
6 7 8 |
# File 'lib/facebook_test_users/user.rb', line 6 def id @id end |
#login_url ⇒ Object (readonly)
Returns the value of attribute login_url.
6 7 8 |
# File 'lib/facebook_test_users/user.rb', line 6 def login_url @login_url end |
Instance Method Details
#destroy ⇒ Object
16 17 18 |
# File 'lib/facebook_test_users/user.rb', line 16 def destroy RestClient.delete(destroy_url) end |
#send_friend_request_to(other) ⇒ Object
20 21 22 23 |
# File 'lib/facebook_test_users/user.rb', line 20 def send_friend_request_to(other) RestClient.post(friend_request_url_for(other), 'access_token' => access_token.to_s) end |