Claim

The Claim namespace can be used to perform claiming actions on kits and devices.

API Methods

disruptive.Claim.claim_info(identifier, organization_id=None, **kwargs)

Get claim information for either a device or a kit by looking up an identifier.

For sensors, the identifier can be found in either the QR code or printed directly on the sensor. For kits, the identifier can be found both as text and a QR code printed on the box.

For more information, see the REST API Claim Info Documentation.

Parameters:
  • identifier (str) – Unique identifier of the target Kit or Device.

  • organization_id (str, optional) – The identifier of the organization that will claim the devices or kits.

Returns:

claim – Claim information about the requested Kit or Device.

Return type:

Claim

Raises:

TypeError – If provided identifier is not str type.

Examples

>>> # Get claim information about a kit.
>>> claim = dt.Claim.claim_info('<KIT_ID>')
>>> # Get claim information about a device.
>>> claim = dt.Claim.claim_info('<DEVICE_ID>')
disruptive.Claim.claim(target_project_id, kit_ids=None, device_ids=None, dry_run=True, **kwargs)

Claim multiple kits and/or devices to your project.

Claiming a kit/device does two things. It starts the device subscriptions, where any pre-paid period will be activated. It also adds the devices to your project.

For more information, see the REST API Claim Documentation.

Parameters:
  • target_project_id (str) – Unique identifier of project into which you wish to claim.

  • kit_ids (list[str], optional) – List of unique kit IDs to claim.

  • device_ids (list[str], optional) – List of unique device IDs to claim.

  • dry_run (bool, optional) – Default True. Test your claim request during development. No kits or devices will be claimed while True. Set to False in production or no devices will be claimed.

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

Return type:

Tuple[List[ClaimDevice], List[Exception]]

Returns:

  • devices (list[Claim.ClaimDevice]) – List of successfully claimed devices.

  • errors (list[ClaimError]) – List of errors that occured during claiming. If list is empty, all devices were claimed successfully.

Examples

>>> # Do a dry_run where you simulate claiming a kit.
>>> devices, errors = dt.Claim.claim(
...     target_project_id='<TARGET_PROJECT_ID>',
...     kit_ids=['<KIT_ID>'],
... )
>>> # Do a dry_run where you simulate claiming three devices.
>>> devices, errors = dt.Claim.claim(
...     target_project_id='<TARGET_PROJECT_ID>',
...     device_ids=[
...         '<DEVICE_ID_1>',
...         '<DEVICE_ID_2>',
...         '<DEVICE_ID_3>',
...     ],
... )
>>> # Turn off dry_run and claim 2 kits and 3 devices.
>>> # This action is not reversible.
>>> devices, errors = dt.Claim.claim(
...     target_project_id='<TARGET_PROJECT_ID>',
...     kit_ids=[
...         '<KIT_ID_1>',
...         '<KIT_ID_2>',
...     ],
...     device_ids=[
...         '<DEVICE_ID_1>',
...         '<DEVICE_ID_2>',
...         '<DEVICE_ID_3>',
...     ]
...     dry_run=False,
... )

Class

class disruptive.Claim(claim)

Namespacing for claim methods.

Variables:
  • type (str) – Whether or not the claim is for a KIT or DEVICE.

  • claimed_item (Claim.ClaimKit | Claim.ClaimDevice) – An object representing the kit or device claim.

class disruptive.Claim.ClaimKit(kit)

Namespacing type for a claimed kit.

Variables:
  • kit_id (str) – Unique kit identifier.

  • display_name (str) – Human reabable kit name.

  • devices (list[Claim.ClaimDevice]) – List of devices in the kit.

class disruptive.Claim.ClaimDevice(device)

Namespacing type for a claimed device.

Variables:
  • device_id (str) – Unique device identifier.

  • device_type (str) – Device type.

  • product_number (str) – The device product number.

  • is_claimed (bool) – Whether or not the devices has been claimed.