Package s3 :: Package sync_adapter :: Module wrike :: Class S3SyncAdapter
[frames] | no frames]

Class S3SyncAdapter

source code

              object --+    
                       |    
s3sync.S3SyncBaseAdapter --+
                           |
                          S3SyncAdapter

Wrike® Synchronization Adapter

http://www.wrike.com/wiki/dev/api3

Instance Methods
 
__init__(self, repository)
Constructor
source code
 
register(self)
Register at the repository, in Wrike: use client ID and the authorization code (site key), alternatively username and password to obtain the refresh_token and store it in the repository config.
source code
 
login(self)
Login to the repository, in Wrike: use the client ID (username), the client secret (password) and the refresh token to obtain the access token for subsequent requests.
source code
 
pull(self, task, onconflict=None)
Pull updates from this repository
source code
 
push(self, task)
Push data for a task
source code
 
fetch_accounts(self, root)
Get all accessible accounts
source code
 
fetch_folders(self, root, account_id)
Fetch folders from a Wrike account and add them to the data tree
source code
 
fetch_tasks(self, root, folder_id, deleted=False, msince=None)
Fetch all tasks in a folder
source code
 
update_refresh_token(self)
Store the current refresh token in the db, also invalidated the site_key (authorization code) because it can not be used again.
source code

Inherited from s3sync.S3SyncBaseAdapter: receive, send

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Methods
 
add_details(cls, task, data, keys)
Recursively convert the nested task details dicts into SubElements
source code
Properties

Inherited from object: __class__

Method Details

__init__(self, repository)
(Constructor)

source code 

Constructor

Parameters:
  • repository - the repository (S3Repository instance)
Overrides: object.__init__

register(self)

source code 

Register at the repository, in Wrike: use client ID and the authorization code (site key), alternatively username and password to obtain the refresh_token and store it in the repository config.

Returns:
True if successful, otherwise False
Overrides: s3sync.S3SyncBaseAdapter.register

Note: this invalidates the authorization code (if any), so it will be set to None regardless whether this operation succeeds or not

login(self)

source code 

Login to the repository, in Wrike: use the client ID (username), the client secret (password) and the refresh token to obtain the access token for subsequent requests.

Returns:
None if successful, otherwise error message
Overrides: s3sync.S3SyncBaseAdapter.login

pull(self, task, onconflict=None)

source code 

Pull updates from this repository

Parameters:
  • task - the task Row
  • onconflict - synchronization conflict resolver
Returns:
tuple (error, mtime), with error=None if successful, else error=message, and mtime=modification timestamp of the youngest record received
Overrides: s3sync.S3SyncBaseAdapter.pull

push(self, task)

source code 

Push data for a task

Parameters:
  • task - the task Row
Returns:
tuple (error, mtime), with error=None if successful, else error=message, and mtime=modification timestamp of the youngest record sent
Overrides: s3sync.S3SyncBaseAdapter.push

fetch_accounts(self, root)

source code 

Get all accessible accounts

Returns:
dict {account_id: (rootFolderId, recycleBinId)}

fetch_folders(self, root, account_id)

source code 

Fetch folders from a Wrike account and add them to the data tree

Parameters:
  • root - the root element of the data tree
  • account_id - the Wrike account ID

fetch_tasks(self, root, folder_id, deleted=False, msince=None)

source code 

Fetch all tasks in a folder

Parameters:
  • root - the root element of the data tree
  • folder_id - the ID of the folder to read from
  • deleted - mark the tasks as deleted in the data tree (when reading tasks from a recycle bin)
  • msince - only retrieve tasks that have been modified after this date/time (ISO-formatted string)

add_details(cls, task, data, keys)
Class Method

source code 

Recursively convert the nested task details dicts into SubElements

Parameters:
  • task - the task Element
  • data - the nested dict
  • keys - the mapping of dict keys to SubElement names

update_refresh_token(self)

source code 

Store the current refresh token in the db, also invalidated the site_key (authorization code) because it can not be used again.