MambuPy.rest.mambubranch

Mambu Branches objects.

MambuBranch holds a branch.

MambuBranches holds a list of branches.

Uses mambugeturl.getbranchesurl as default urlfunc

Classes

MambuBranch([urlfunc, entid])

A Branch from Mambu.

MambuBranches([urlfunc, entid])

A list of Branches from Mambu.

class MambuPy.rest.mambubranch.MambuBranch(urlfunc=<function getbranchesurl>, entid='', *args, **kwargs)[source]

Bases: MambuStruct

A Branch from Mambu.

With the default urlfunc, entid argument must be the ID of the branch you wish to retrieve.

__init__(urlfunc=<function getbranchesurl>, entid='', *args, **kwargs)[source]

Tasks done here:

Just initializes the MambuStruct.

__module__ = 'MambuPy.rest.mambubranch'
setUsers(*args, **kwargs)[source]

Adds the active users for this branch to a ‘users’ field.

Returns the number of requests done to Mambu.

Todo

since pagination logic was added, is not always true that just 1 request was done. It may be more! But since request counter singleton holds true information about how many requests were done to Mambu, in fact this return value may be obsolete

class MambuPy.rest.mambubranch.MambuBranches(urlfunc=<function getbranchesurl>, entid='', *args, **kwargs)[source]

Bases: MambuStruct

A list of Branches from Mambu.

With the default urlfunc, entid argument must be empty at instantiation time to retrieve all the branches according to any other filter you send to the urlfunc.

__init__(urlfunc=<function getbranchesurl>, entid='', *args, **kwargs)[source]

By default, entid argument is empty. That makes perfect sense: you want several branches, not just one

__iter__()[source]
__module__ = 'MambuPy.rest.mambubranch'
convert_dict_to_attrs(*args, **kwargs)[source]

The trick for iterable Mambu Objects comes here:

You iterate over each element of the responded List from Mambu, and create a Mambu Branch object for each one, initializing them one at a time, and changing the attrs attribute (which just holds a list of plain dictionaries) with a MambuBranch just created.

Todo

pass a valid (perhaps default) urlfunc, and its corresponding id to entid to each MambuBranch, telling MambuStruct not to connect() by default. It’s desirable to connect at any other further moment to refresh some element in the list.