Package pamfax :: Package processors :: Class UserInfo
[hide private]
[frames] | no frames]

Class UserInfo

source code

Class encapsulating user info

Instance Methods [hide private]
 
__init__(self, api_credentials, http)
Instantiates the UserInfo class
source code
 
create_user(self, name, username, password, email, culture, externalprofile=None, campaign_id=None)
Create a new PamFax user and logs him in
source code
 
delete_user(self)
Deletes the currently logged in users account.
source code
 
get_culture_info(self)
Returns the users culture information
source code
 
get_users_avatar(self, provider=None)
Returns avatars for current user
source code
 
has_avatar(self)
Return if Avatar is available or not
source code
 
has_plan(self)
Check if the user has a Plan.
source code
 
list_expirations(self, type=None)
Returns expirations from current user
source code
 
list_inboxes(self, expired_too=None, shared_too=None)
Return the inboxes of the user with some additional data (like expiration).
source code
 
list_orders(self, current_page=None, items_per_page=None)
Returns a list of orders for this user
source code
 
list_profiles(self)
Read the full profile of the user.
source code
 
list_user_agents(self, max=None)
Returns a list of user-agents the user has used to sent faxes.
source code
 
list_wall_messages(self, count=None, data_to_list=None)
Returns a list of activities for the user
source code
 
save_user(self, user=None, profile=None)
Saves user profile
source code
 
send_message(self, body, type=None, recipient=None, subject=None)
Send a message to the user
source code
 
send_password_reset_message(self, username, user_ip=None)
Send a password reset message to a user
source code
 
set_online_storage_settings(self, provider, settings)
Sets users OnlineStorage settings.
source code
 
set_password(self, password, hashFunction=None, old_password=None)
Set a new login password for the currently logged in user.
source code
 
set_profile_properties(self, profile, properties, ignoreerrors=None)
Saves values to an extended user profile
source code
 
validate_new_username(self, username, dictionary=None)
Validate a username for a new user.
source code
Method Details [hide private]

create_user(self, name, username, password, email, culture, externalprofile=None, campaign_id=None)

source code 

Create a new PamFax user and logs him in

Arguments: name -- First and last name of the user username -- Unique username. Call will fail with bad_username error if the username already exists. Min 6 chars, max 60 chars. Can be left empty if externalprofile is given. Then the username will be generated from externalprofile. You could use UserInfo::ValidateNewUsername to create a unique username first and then pass it to this call password -- a password for the user. If left empty, a new password will be generated. Min 8 chars, max 20 chars. If length is 32, it's assumed as md5 of original password. Please then check min and max length by yourself! email -- A valid email address for this user. culture -- The culture of the user (en-US, de-DE, ...)

Keyword arguments: externalprofile -- External profile data. externalprofile["type"] is the type of data: skype. externalprofile["client_ip"] should be set to the user's ip address campaign_id -- is used to payout recommendation bonus to given user uuid. i.e if user clicked on links like http://www.pamfax.biz/?ref=b36d019d53ba, the b36d019d53ba should be passed as campaign_id

delete_user(self)

source code 

Deletes the currently logged in users account.

All assigned numbers and data will be deleted too! Warning: User will be deleted permanently without any chance to recover his data!

get_users_avatar(self, provider=None)

source code 

Returns avatars for current user

Keyword arguments: provider -- Provider to load Image from

has_plan(self)

source code 

Check if the user has a Plan.

This would NOT include other fax numbers user has access to. Will return NONE if no plan, PRO or BASIC otherwise

list_expirations(self, type=None)

source code 

Returns expirations from current user

if type==false all Expirations are Returned else CREDIT, PROPLAN and

list_inboxes(self, expired_too=None, shared_too=None)

source code 

Return the inboxes of the user with some additional data (like expiration).

Keyword arguments: expired_too -- If true, lists all expired numbers too.

list_user_agents(self, max=None)

source code 

Returns a list of user-agents the user has used to sent faxes.

List will be sorted by amount of faxes sent, so it is a top max list.

Keyword arguments: max -- How many results (5-20, default 5)

list_wall_messages(self, count=None, data_to_list=None)

source code 

Returns a list of activities for the user

This list contains report about what has been happened lately in users account (like messages sent to the user, faxes sent, faxes received, orders placed, ...)

Keyword arguments: count -- The count of items to return. Valid values are between 1 and 100 data_to_list -- Any message types you want this function to return. Allowed models are 'faxsent', 'faxin', 'faxout', 'payment', 'message' and 'news'. Leave empty to get messages of any type.

save_user(self, user=None, profile=None)

source code 

Saves user profile

Keyword arguments: user -- Users settings as associative array profile -- UserProfiles properties as associative array

send_message(self, body, type=None, recipient=None, subject=None)

source code 

Send a message to the user

Arguments: body -- The message body

Keyword arguments: type -- Type of message to send. Currently implemented: email, skypechat or sms recipient -- Recipient of the message. Might be an email address, IM username or phone number depending on the message type subject -- Optionally a subject. Not used in all message types (likely not used in SMS and chat)

send_password_reset_message(self, username, user_ip=None)

source code 

Send a password reset message to a user

Arguments: username -- PamFax username to send the message to

set_online_storage_settings(self, provider, settings)

source code 

Sets users OnlineStorage settings.

Expects the settings to be given as key-value pairs. Currently supported settings are:

  • inbox_enabled: Store incoming faxes (0|1, required)
  • inbox_path: Path to store incoming faxes to (path as string folders separated by '/', leading and trailing '/' optional, required)

Arguments: provider -- Provider store settings for (see OnlineStorageApi::ListProviders) settings -- Key-value pairs of settings.

set_password(self, password, hashFunction=None, old_password=None)

source code 

Set a new login password for the currently logged in user.

You may use md5 encrypted passwords by setting the value of hashFunction to 'md5'. Note: password values must be lower case when using a hashFunction other than 'plain'!

Arguments: password -- The new password. Needs to be between 6 and 60 chars long

Keyword arguments: hashFunction -- The function used to enrycpt the password. Allowed values: plain or md5. old_password -- The current password. This is optional for the moment but will be required in future versions. Note that the $hashFunction value applies to this argument too.

set_profile_properties(self, profile, properties, ignoreerrors=None)

source code 

Saves values to an extended user profile

Users may have different profiles. Use this method to store values in them. Profiles will be created if not present yet.

Arguments: properties -- key=>value pairs of all profiles properties to save

Keyword arguments: ignoreerrors -- If a field can not be found in the profile object, just ignore it. Otherwise returns an error

validate_new_username(self, username, dictionary=None)

source code 

Validate a username for a new user.

Returns a list of suggestions for the username if given username is already in use. Call this prior to UserInfo/CreateUser to show alternative usernames to the user if the entered username is already occupied or invalid.

Arguments: username -- Unique username to validate. Call will fail with bad_username error if the username already exists. Min 6 chars, max 60 chars.