Class: Seam::Clients::DevicesUnmanaged

Inherits:
Object
  • Object
show all
Defined in:
lib/seam/routes/devices_unmanaged.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:, defaults:) ⇒ DevicesUnmanaged

Returns a new instance of DevicesUnmanaged.



6
7
8
9
# File 'lib/seam/routes/devices_unmanaged.rb', line 6

def initialize(client:, defaults:)
  @client = client
  @defaults = defaults
end

Instance Method Details

#get(device_id: nil, name: nil) ⇒ Seam::Resources::UnmanagedDevice

Returns a specified unmanaged device.

An unmanaged device has a limited set of visible properties and a subset of supported events. You cannot control an unmanaged device. Any access codes on an unmanaged device are unmanaged. To control an unmanaged device with Seam, convert it to a managed device.

You must specify either device_id or name.

Parameters:

  • device_id (String, nil) (defaults to: nil)

    ID of the unmanaged device that you want to get.

  • name (String, nil) (defaults to: nil)

    Name of the unmanaged device that you want to get.

Returns:



19
20
21
22
23
24
25
26
27
# File 'lib/seam/routes/devices_unmanaged.rb', line 19

def get(device_id: nil, name: nil)
  if device_id.nil? && name.nil?
    raise TypeError, "At least one parameter is required for /devices/unmanaged/get"
  end

  res = @client.get("/devices/unmanaged/get", {device_id: device_id, name: name}.compact)

  Seam::Resources::UnmanagedDevice.load_from_response(res.body["device"])
end

#list(connect_webview_id: nil, connected_account_id: nil, connected_account_ids: nil, created_before: nil, customer_key: nil, device_ids: nil, device_type: nil, device_types: nil, limit: nil, manufacturer: nil, page_cursor: nil, search: nil) ⇒ Seam::Resources::UnmanagedDevice

Returns a list of all unmanaged devices.

An unmanaged device has a limited set of visible properties and a subset of supported events. You cannot control an unmanaged device. Any access codes on an unmanaged device are unmanaged. To control an unmanaged device with Seam, convert it to a managed device.

Parameters:

  • connect_webview_id (String, nil) (defaults to: nil)

    ID of the Connect Webview for which you want to list devices.

  • connected_account_id (String, nil) (defaults to: nil)

    ID of the connected account for which you want to list devices.

  • connected_account_ids (Array<String>, nil) (defaults to: nil)

    Array of IDs of the connected accounts for which you want to list devices.

  • created_before (Time, nil) (defaults to: nil)

    Timestamp by which to limit returned devices. Returns devices created before this timestamp.

  • customer_key (String, nil) (defaults to: nil)

    Customer key for which you want to list devices.

  • device_ids (Array<String>, nil) (defaults to: nil)

    Array of device IDs for which you want to list devices.

  • device_type (String, nil) (defaults to: nil)

    Device type for which you want to list devices.

  • device_types (Array<String>, nil) (defaults to: nil)

    Array of device types for which you want to list devices.

  • limit (Float, nil) (defaults to: nil)

    Numerical limit on the number of devices to return.

  • manufacturer (String, nil) (defaults to: nil)

    Manufacturer for which you want to list devices.

  • page_cursor (String, Seam::Null, nil) (defaults to: nil)

    Identifies the specific page of results to return, obtained from the previous page's next_page_cursor.

  • search (String, nil) (defaults to: nil)

    String for which to search. Filters returned devices to include all records that satisfy a partial match using device_id (full or partial UUID prefix, minimum 4 characters), connected_account_id, display_name, custom_metadata or location.location_name.

Returns:



45
46
47
48
49
# File 'lib/seam/routes/devices_unmanaged.rb', line 45

def list(connect_webview_id: nil, connected_account_id: nil, connected_account_ids: nil, created_before: nil, customer_key: nil, device_ids: nil, device_type: nil, device_types: nil, limit: nil, manufacturer: nil, page_cursor: nil, search: nil)
  res = @client.post("/devices/unmanaged/list", {connect_webview_id: connect_webview_id, connected_account_id: , connected_account_ids: , created_before: created_before, customer_key: customer_key, device_ids: device_ids, device_type: device_type, device_types: device_types, limit: limit, manufacturer: manufacturer, page_cursor: page_cursor, search: search}.compact)

  Seam::Resources::UnmanagedDevice.load_from_response(res.body["devices"])
end

#update(device_id:, custom_metadata: nil, is_managed: nil) ⇒ nil

Updates a specified unmanaged device. To convert an unmanaged device to managed, set is_managed to true.

An unmanaged device has a limited set of visible properties and a subset of supported events. You cannot control an unmanaged device. Any access codes on an unmanaged device are unmanaged. To control an unmanaged device with Seam, convert it to a managed device.

Parameters:

  • device_id (String)

    ID of the unmanaged device that you want to update.

  • custom_metadata (Hash, nil) (defaults to: nil)

    Custom metadata that you want to associate with the device. Supports up to 50 JSON key:value pairs.

  • is_managed (Boolean, nil) (defaults to: nil)

    Indicates whether the device is managed. Set this parameter to true to convert an unmanaged device to managed.

Returns:

  • (nil)

    OK



58
59
60
61
62
# File 'lib/seam/routes/devices_unmanaged.rb', line 58

def update(device_id:, custom_metadata: nil, is_managed: nil)
  @client.patch("/devices/unmanaged/update", {device_id: device_id, custom_metadata: , is_managed: is_managed}.compact)

  nil
end