Class: Seam::Clients::ConnectedAccounts

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

Instance Method Summary collapse

Constructor Details

#initialize(client:, defaults:) ⇒ ConnectedAccounts

Returns a new instance of ConnectedAccounts.



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

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

Instance Method Details

#delete(connected_account_id:) ⇒ nil

Deletes a specified connected account.

Deleting a connected account triggers a connected_account.deleted event and removes the connected account and all data associated with the connected account from Seam, including devices, events, access codes, and so on. For every deleted resource, Seam sends a corresponding deleted event, but the resource is not deleted from the provider.

For example, if you delete a connected account with a device that has an access code, Seam sends a connected_account.deleted event, a device.deleted event, and an access_code.deleted event, but Seam does not remove the access code from the device.

Parameters:

  • connected_account_id

    ID of the connected account that you want to delete.

Returns:

  • (nil)

    OK



22
23
24
25
26
# File 'lib/seam/routes/connected_accounts.rb', line 22

def delete(connected_account_id:)
  @client.post("/connected_accounts/delete", {connected_account_id: }.compact)

  nil
end

#get(connected_account_id: nil, email: nil) ⇒ Seam::Resources::ConnectedAccount

Returns a specified connected account.

Parameters:

  • connected_account_id (defaults to: nil)

    ID of the connected account that you want to get.

  • email (defaults to: nil)

    Email address associated with the connected account that you want to get.

Returns:



32
33
34
35
36
# File 'lib/seam/routes/connected_accounts.rb', line 32

def get(connected_account_id: nil, email: nil)
  res = @client.post("/connected_accounts/get", {connected_account_id: , email: email}.compact)

  Seam::Resources::ConnectedAccount.load_from_response(res.body["connected_account"])
end

#list(custom_metadata_has: nil, customer_key: nil, limit: nil, page_cursor: nil, search: nil, space_id: nil, user_identifier_key: nil) ⇒ Seam::Resources::ConnectedAccount

Returns a list of all connected accounts.

Parameters:

  • custom_metadata_has (defaults to: nil)

    Custom metadata pairs by which you want to filter connected accounts. Returns connected accounts with custom_metadata that contains all of the provided key:value pairs.

  • customer_key (defaults to: nil)

    Customer key by which you want to filter connected accounts.

  • limit (defaults to: nil)

    Maximum number of records to return per page.

  • page_cursor (defaults to: nil)

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

  • search (defaults to: nil)

    String for which to search. Filters returned connected accounts to include all records that satisfy a partial match using connected_account_id, account_type, customer_key, custom_metadata, user_identifier.username, user_identifier.email or user_identifier.phone.

  • space_id (defaults to: nil)

    ID of the space by which you want to filter connected accounts.

  • user_identifier_key (defaults to: nil)

    Your user ID for the user by which you want to filter connected accounts.

Returns:



47
48
49
50
51
# File 'lib/seam/routes/connected_accounts.rb', line 47

def list(custom_metadata_has: nil, customer_key: nil, limit: nil, page_cursor: nil, search: nil, space_id: nil, user_identifier_key: nil)
  res = @client.post("/connected_accounts/list", {custom_metadata_has: , customer_key: customer_key, limit: limit, page_cursor: page_cursor, search: search, space_id: space_id, user_identifier_key: user_identifier_key}.compact)

  Seam::Resources::ConnectedAccount.load_from_response(res.body["connected_accounts"])
end

#simulateObject



11
12
13
# File 'lib/seam/routes/connected_accounts.rb', line 11

def simulate
  @simulate ||= Seam::Clients::ConnectedAccountsSimulate.new(client: @client, defaults: @defaults)
end

#sync(connected_account_id:) ⇒ nil

Request a connected account sync attempt for the specified connected_account_id.

Parameters:

  • connected_account_id

    ID of the connected account that you want to sync.

Returns:

  • (nil)

    OK



56
57
58
59
60
# File 'lib/seam/routes/connected_accounts.rb', line 56

def sync(connected_account_id:)
  @client.post("/connected_accounts/sync", {connected_account_id: }.compact)

  nil
end

#update(connected_account_id:, accepted_capabilities: nil, automatically_manage_new_devices: nil, custom_metadata: nil, customer_key: nil, display_name: nil) ⇒ nil

Updates a connected account.

Parameters:

  • connected_account_id

    ID of the connected account that you want to update.

  • accepted_capabilities (defaults to: nil)

    List of accepted device capabilities that restrict the types of devices that can be connected through this connected account. Valid values are lock, thermostat, noise_sensor, and access_control.

  • automatically_manage_new_devices (defaults to: nil)

    Indicates whether newly-added devices should appear as managed devices.

  • custom_metadata (defaults to: nil)

    Custom metadata that you want to associate with the connected account. Entirely replaces the existing custom metadata object. If a new Connect Webview contains custom metadata and is used to reconnect a connected account, the custom metadata from the Connect Webview will entirely replace the entire custom metadata object on the connected account. Supports up to 50 JSON key:value pairs. Adding custom metadata to a connected account enables you to store custom information, like customer details or internal IDs from your application. Then, you can filter connected accounts by the desired metadata.

  • customer_key (defaults to: nil)

    The customer key to associate with this connected account. If provided, the connected account and all resources under the connected account will be moved to this customer. May only be provided if the connected account is not already associated with a customer.

  • display_name (defaults to: nil)

    Human-readable name for the connected account, shown in the dashboard. For example, Booking from Airbnb House 1.

Returns:

  • (nil)

    OK



70
71
72
73
74
# File 'lib/seam/routes/connected_accounts.rb', line 70

def update(connected_account_id:, accepted_capabilities: nil, automatically_manage_new_devices: nil, custom_metadata: nil, customer_key: nil, display_name: nil)
  @client.post("/connected_accounts/update", {connected_account_id: , accepted_capabilities: accepted_capabilities, automatically_manage_new_devices: automatically_manage_new_devices, custom_metadata: , customer_key: customer_key, display_name: display_name}.compact)

  nil
end