Sha256: b926278bed7749550cd2fd8ce225e51da9267eb973dde6a71f39d41804587376

Contents?: true

Size: 1.9 KB

Versions: 2

Compression:

Stored size: 1.9 KB

Contents

# frozen_string_literal: true

module Seam
  module Clients
    class Locks < BaseClient
      def get(device_id: nil, name: nil)
        request_seam_object(
          :post,
          "/locks/get",
          Seam::Device,
          "device",
          body: {device_id: device_id, name: name}.compact
        )
      end

      def list(connect_webview_id: nil, connected_account_id: nil, connected_account_ids: nil, created_before: nil, custom_metadata_has: nil, device_ids: nil, device_types: nil, exclude_if: nil, include_if: nil, limit: nil, manufacturer: nil, user_identifier_key: nil)
        request_seam_object(
          :post,
          "/locks/list",
          Seam::Device,
          "devices",
          body: {connect_webview_id: connect_webview_id, connected_account_id: connected_account_id, connected_account_ids: connected_account_ids, created_before: created_before, custom_metadata_has: custom_metadata_has, device_ids: device_ids, device_types: device_types, exclude_if: exclude_if, include_if: include_if, limit: limit, manufacturer: manufacturer, user_identifier_key: user_identifier_key}.compact
        )
      end

      def lock_door(device_id:, sync: nil, wait_for_action_attempt: nil)
        action_attempt = request_seam_object(
          :post,
          "/locks/lock_door",
          Seam::ActionAttempt,
          "action_attempt",
          body: {device_id: device_id, sync: sync}.compact
        )

        action_attempt.decide_and_wait(wait_for_action_attempt)
        action_attempt
      end

      def unlock_door(device_id:, sync: nil, wait_for_action_attempt: nil)
        action_attempt = request_seam_object(
          :post,
          "/locks/unlock_door",
          Seam::ActionAttempt,
          "action_attempt",
          body: {device_id: device_id, sync: sync}.compact
        )

        action_attempt.decide_and_wait(wait_for_action_attempt)
        action_attempt
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
seam-2.0.0a2 lib/seam/clients/locks.rb
seam-2.0.0.prerelease.1 lib/seam/clients/locks.rb