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
# File 'lib/facebook_test_users/user.rb', line 8

def initialize(attrs)
  attrs.each do |field, value|
    instance_variable_set("@#{field}", value) if respond_to?(field)
  end
end

Instance Attribute Details

#access_tokenObject

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

#emailObject

Returns the value of attribute email.



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

def email
  @email
end

#idObject

Returns the value of attribute id.



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

def id
  @id
end

#login_urlObject

Returns the value of attribute login_url.



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

def 
  @login_url
end

#passwordObject

Returns the value of attribute password.



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

def password
  @password
end

Instance Method Details

#birthdayObject

Facebook test users all share the same birthday. Perhaps it’s the developer’s!



28
29
30
# File 'lib/facebook_test_users/user.rb', line 28

def birthday
  Date.new(1980, 8, 8)
end

#change(options = {}) ⇒ Object



14
15
16
# File 'lib/facebook_test_users/user.rb', line 14

def change(options = {})
  RestClient.post(change_url, {:access_token => access_token}.merge(options))
end

#destroyObject



22
23
24
# File 'lib/facebook_test_users/user.rb', line 22

def destroy
  RestClient.delete(destroy_url)
end

#owner_apps(app) ⇒ Object



18
19
20
# File 'lib/facebook_test_users/user.rb', line 18

def owner_apps(app)
  RestClient.get(owner_apps_url(app.access_token))
end

#send_friend_request_to(other) ⇒ Object



32
33
34
35
# File 'lib/facebook_test_users/user.rb', line 32

def send_friend_request_to(other)
  RestClient.post(friend_request_url_for(other),
    'access_token' => access_token.to_s)
end