Class: FacebookTestUsers::User

Inherits:
Object
  • Object
show all
Defined in:
lib/facebook_test_users/user.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_tokenObject (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

#idObject (readonly)

Returns the value of attribute id.



6
7
8
# File 'lib/facebook_test_users/user.rb', line 6

def id
  @id
end

#login_urlObject (readonly)

Returns the value of attribute login_url.



6
7
8
# File 'lib/facebook_test_users/user.rb', line 6

def 
  @login_url
end

Instance Method Details

#destroyObject



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