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

Class FaxJob

source code

Class encapsulating a specific fax job

Instance Methods [hide private]
 
__init__(self, api_credentials, http)
Instantiates the FaxJob class
source code
 
add_file(self, filename, origin=None)
Adds a file to the current fax.
source code
 
add_file_from_online_storage(self, provider, uuid)
Add a file identified by an online storage identifier.
source code
 
add_recipient(self, number, name=None)
Adds a recipient to the current fax.
source code
 
add_recipients(self, numbers, names=None)
Adds recipients to the current fax.
source code
 
add_remote_file(self, url)
Add a remote file to the fax.
source code
 
cancel(self, uuid, siblings_too=None)
Cancels fax sending for a fax recipient or a whole fax job.
source code
 
clone_fax(self, uuid, user_ip='192.168.1.3', user_agent='dynaptico-pamfax')
Clones an already sent fax in the API backend and returns it.
source code
 
create(self, user_ip='192.168.1.3', user_agent='dynaptico-pamfax', origin='script')
Creates a new fax in the API backend and returns it.
source code
 
get_fax_state(self)
Returns the state of the current fax.
source code
 
get_preview(self)
Returns the states of all preview pages.
source code
 
list_available_covers(self)
Returns a list of all coverpages the user may use.
source code
 
list_fax_files(self)
Get all uploaded files for the current fax
source code
 
list_recipients(self, current_page=None, items_per_page=None)
Returns the recipients for the current fax.
source code
 
remove_all_files(self)
Remove all uploaded files from the current fax
source code
 
remove_all_recipients(self)
Removes all recipients for the current fax.
source code
 
remove_cover(self)
Removes the cover from fax
source code
 
remove_file(self, file_uuid)
Remove a file from the current fax.
source code
 
remove_recipient(self, number)
Removes a recipient from the current fax
source code
 
send(self, send_at=None)
Start the fax sending.
source code
 
send_delayed_fax_now(self, uuid)
Send a previously delayed fax now.
source code
 
send_later(self, send_at=None)
Put the fax in the unpaid faxes queue.
source code
 
send_unpaid(self)
DEPRECATED! Use SendUnpaidFaxes instead
source code
 
send_unpaid_faxes(self, uuids)
Send unpaid faxes
source code
 
set_cover(self, template_id, text=None)
Sets the cover template for the current fax.
source code
 
set_notifications(self, notifications, group_notification=None, error_notification=None, save_defaults=None)
Sets the notification options for the current fax.
source code
 
set_recipients(self, numbers, names=None)
Creates recipients for the current fax.
source code
 
start_preview_creation(self)
Starts creating the preview for this fax.
source code
Method Details [hide private]

add_file(self, filename, origin=None)

source code 

Adds a file to the current fax.

Requires the file to be uploaded as POST paramter named 'file' as a standard HTTP upload. This could be either Content-type: multipart/form-data with file content as base64-encoded data or as Content-type: application/octet-stream with just the binary data. See http://www.faqs.org/rfcs/rfc1867.html for documentation on file uploads.

Arguments: filename -- Name of the file. You can also use the same file name for each file (i.e "fax.pdf")

Keyword arguments: origin -- Optional file origin (ex: photo, scan,... - maximum length is 20 characters).

add_file_from_online_storage(self, provider, uuid)

source code 

Add a file identified by an online storage identifier.

You'll have to use the OnlineStorageApi to identify a user for an online storage provider first and then get listings of his files. These will contain the file identifiers used by this method.

Arguments: provider -- Identifies the provider used (see OnlineStorageApi) uuid -- Identifies the file to be added (see OnlineStorageApi)

add_recipients(self, numbers, names=None)

source code 

Adds recipients to the current fax. The given recipients will be added to current recipients.

add_remote_file(self, url)

source code 

Add a remote file to the fax. url may contain username:password for basic http auth, but this is the only supported authentication method. URL Examples: http://myusername:andpassord

cancel(self, uuid, siblings_too=None)

source code 

Cancels fax sending for a fax recipient or a whole fax job. If siblings_too is true will cancel all faxes in the job the fax with uuid belongs to.

clone_fax(self, uuid, user_ip='192.168.1.3', user_agent='dynaptico-pamfax')

source code 

Clones an already sent fax in the API backend and returns it.

Arguments: uuid -- The uuid of the source fax

Keyword arguments: user_ip -- The IP address of the client (if available). Put your own IP address otherwise. user_agent -- User agent string of the client device. If not available, put something descriptive (like "iPhone OS 2.2")

create(self, user_ip='192.168.1.3', user_agent='dynaptico-pamfax', origin='script')

source code 

Creates a new fax in the API backend and returns it.

If a fax job is currently in edit mode in this session, this fax job is returned instead. Note: This is not an error. It provides you with the possibility to continue with the fax.

Keyword arguments: user_ip -- The IP address of the client (if available). Put your own IP address otherwise. user_agent -- User agent string of the client device. If not available, put something descriptive (like "iPhone OS 2.2") origin -- From where was this fax started? i.e. "printer", "desktop", "home", ... For reporting and analysis purposes.

list_available_covers(self)

source code 

Returns a list of all coverpages the user may use. Result includes the "no cover" if the fax job already contains a file as in that case there's no need to add a cover.

list_recipients(self, current_page=None, items_per_page=None)

source code 

Returns the recipients for the current fax.

Keyword arguments: current_page -- The page which should be shown items_per_page -- How many items are shown per page

send(self, send_at=None)

source code 

Start the fax sending.

Only successful if all necessary data is set to the fax: at least 1 recipient and a cover page or a file uploaded. Will only work if user has enough credit to pay for the fax. You may pass in a datetime when the fax shall be sent. This must be a string formatted in the users chosen culture (so exactly as you would show it to him) and may not be in the past nor be greater than 'now + 14days'.

send_delayed_fax_now(self, uuid)

source code 

Send a previously delayed fax now.

Use this method if you want to send a fax right now that was initially delayed (by giving a send_at value into Send).

send_later(self, send_at=None)

source code 

Put the fax in the unpaid faxes queue.

Only possible if user has NOT enough credit to send this fax directly. You may pass in a datetime when the fax shall be sent. This must be a string formatted in the users chosen culture (so exactly as you would show it to him) and may not be in the past nor be greater than 'now + 14days'.

send_unpaid_faxes(self, uuids)

source code 

Send unpaid faxes

Will work until credit reaches zero. Will return two lists: SentFaxes and UnpaidFaxes that contain the faxes that could or not be sent.

set_notifications(self, notifications, group_notification=None, error_notification=None, save_defaults=None)

source code 

Sets the notification options for the current fax.

Notification options that are not in the array will not be changed/resetted. Note: defaults for notification settings will be taken from users account, so potentially not need to call this on every fax.

Keyword arguments: save_defaults -- Save Notification-Settings to user's Profile

set_recipients(self, numbers, names=None)

source code 

Creates recipients for the current fax.

All recipients are replaced with the given ones!

start_preview_creation(self)

source code 

Starts creating the preview for this fax.

Call after fax is ready (GetFaxState returns FAX_READY_TO_SEND)