Class: Mogli::TestUser
- Defined in:
- lib/mogli/test_user.rb
Overview
Support for Facebook test users, as described here:
developers.facebook.com/docs/test_users/
Test user creation/listing requires an app access token and an app id.
Example usage:
Mogli::TestUser.all({}, Mogli::AppClient.new(‘access_token’, ‘app_id’))
Constant Summary
Constants inherited from User
User::ALL_EXTENDED_PERMISSIONS
Instance Attribute Summary
Attributes inherited from User
Attributes inherited from Model
Attributes included from Model::Search
Class Method Summary collapse
- .all(app_client) ⇒ Object
-
.create(test_user_params, app_client) ⇒ Object
test_user_params can include:.
Instance Method Summary collapse
Methods inherited from User
#has_permission?, recognize?, #revoke_permission
Methods inherited from Profile
#image_url, #large_image_url, #normal_image_url, #sized_image_url, #small_image_url, #square_image_url
Methods inherited from Model
#==, add_creation_method, #client, #client=, creation_keys, creation_properties, define_properties, #destroy, #fetch, find, fql_mapping, has_association, hash_populating_accessor, included, #initialize, #merge!, #method_missing, #post_params, property, recognize?, #warn_about_invalid_property
Methods included from Model::Search
Constructor Details
This class inherits a constructor from Mogli::Model
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Mogli::Model
Class Method Details
.all(app_client) ⇒ Object
36 37 38 |
# File 'lib/mogli/test_user.rb', line 36 def self.all(app_client) app_client.get_and_map("#{app_client.application_id}/accounts/test-users", self, {}) end |
.create(test_user_params, app_client) ⇒ Object
test_user_params can include:
installed: This is a Boolean parameter to specify whether your app should be installed for the test user at the time of creation. It is true by default.
name: this is an optional string parameter. You can specify a name for the test user you create. The specified name will also be used in the email address assigned to the test user.
permissions: This is a comma-separated list of extended permissions. Your app is granted these permissions for the new test user if installed is true.
Example usage:
Mogli::TestUser.create(=> false, :name => ‘Zark Muckerberg’, :permissions => ‘user_events,create_event’, client)
32 33 34 |
# File 'lib/mogli/test_user.rb', line 32 def self.create(test_user_params, app_client) app_client.post("accounts/test-users", self, test_user_params) end |
Instance Method Details
#to_s ⇒ Object
40 41 42 43 |
# File 'lib/mogli/test_user.rb', line 40 def to_s # name is nil by default, so use id id.to_s end |