Organization

The Organization resource can be used to interact with organizations. Various tasks can be performed by using the API Methods included in the class.

Each organization fetched by an API Method is represented by an instance of the Organization class that is returned to the user.

API Methods

disruptive.Organization.get_organization(organization_id, **kwargs)

Gets the current state of a single organization.

Parameters:
  • organization_id (str) – Unique organization ID.

  • **kwargs – Arbitrary keyword arguments. See the Configuration page.

Returns:

organization – Object representing the specified organization.

Return type:

Organization

Examples

>>> # Fetch information about a specific organization.
>>> org = disruptive.Organization.get_organization('<ORGANIZATION_ID>')
disruptive.Organization.list_organizations(**kwargs)

Gets a list of the current state of all available organizations.

Parameters:

**kwargs – Arbitrary keyword arguments. See the Configuration page.

Returns:

organizations – List of objects each representing an organization.

Return type:

list[Organization]

Examples

>>> # Fetch information about all available organizations.
>>> orgs = disruptive.Organization.list_organizations()
disruptive.Organization.list_members(organization_id, **kwargs)

Gets a list of the current state of all members in an organization.

Parameters:
  • organization_id (str) – Unique ID of the organization to get members from.

  • **kwargs – Arbitrary keyword arguments. See the Configuration page.

Returns:

members – List of objects each representing a member.

Return type:

list[Member]

Examples

>>> # Fetch information about all members in an organization.
>>> members = disruptive.Organization.list_members('<ORGANIZATION_ID>')
disruptive.Organization.add_member(organization_id, email, roles, **kwargs)

Add a new member to the specified organization.

Parameters:
  • organization_id (str) – Unique ID of the organization to add a member to.

  • email (str) – Email of the user or Service Account to be added.

  • roles ({["organization.admin"]} list[str]) – The role(s) to provide the new member in the organization. Currently only supports organization.admin.

  • **kwargs – Arbitrary keyword arguments. See the Configuration page.

Returns:

member – Object representing the newly added member.

Return type:

Member

Examples

>>> # Add a new member to an organization.
>>> member = disruptive.Organization.add_member(
...     organization_id='<ORGANIZATION_ID>',
...     email='<EMAIL_ADDRESS>',
...     roles=[disruptive.Role.ORGANIZATION_ADMIN],
... )
disruptive.Organization.get_member(member_id, organization_id, **kwargs)

Get a member from the specified organization.

Parameters:
  • member_id (str) – Unique ID of the member to get. For Service Account members, this is the Service Account ID. For User members, this is the unique User ID.

  • organization_id (str) – Unique ID of the organization to get a member from.

  • **kwargs – Arbitrary keyword arguments. See the Configuration page.

Returns:

member – Object representing the member.

Return type:

Member

Examples

>>> # Fetch information about a specific member in an organization.
>>> org = disruptive.Organization.get_organization(
...     member_id='<MEMBER_ID>',
...     organization_id='<ORGANIZATION_ID>',
... )
disruptive.Organization.remove_member(member_id, organization_id, **kwargs)

Revoke a member’s membership in the specified organization.

Parameters:
  • member_id (str) – Unique ID of the member to get. For Service Account members, this is the Service Account ID. For User members, this is the unique User ID.

  • organization_id (str) – Unique ID of the organization to remove a member from.

  • **kwargs – Arbitrary keyword arguments. See the Configuration page.

Examples

>>> # Revoke the membership of a member in an organization.
>>> org = disruptive.Organization.remove_member(
...     member_id='<MEMBER_ID>',
...     organization_id='<ORGANIZATION_ID>',
... )
Return type:

None

disruptive.Organization.get_member_invite_url(member_id, organization_id, **kwargs)

Get the invite URL for a member with pending invite.

This will only work if the invite is still pending. If the invite has already been accepted, an error is raised.

Parameters:
  • member_id (str) – Unique ID of the member to get. For Service Account members, this is the Service Account ID. For User members, this is the unique User ID.

  • organization_id (str) – Unique ID of the organization of the member to get the URL from.

  • **kwargs – Arbitrary keyword arguments. See the Configuration page.

Raises:

BadRequest – If the invite has already been accepted.

Examples

>>> # Fetch the pending invite URL for a member.
>>> org = disruptive.Organization.get_member_invite_url(
...     member_id='<MEMBER_ID>',
...     organization_id='<ORGANIZATION_ID>',
... )
Return type:

str

disruptive.Organization.list_permissions(organization_id, **kwargs)

List permissions available in the specified organization.

Parameters:
  • organization_id (str) – Unique ID of the organization to list permissions in.

  • **kwargs – Arbitrary keyword arguments. See the Configuration page.

Returns:

permissions – List of available permissions.

Return type:

list[str]

Examples

>>> # List all available permissions in an organization.
>>> org = disruptive.Organization.list_permissions(
...     organization_id='<ORGANIZATION_ID>',
... )

Class

class disruptive.Organization(organization)

Represents an organization.

When an organization response is received, the content is unpacked and the related attributes updated.

Variables:
  • organization_id (str) – Unique organization ID.

  • display_name (str) – The provided display name.