diff --git a/lib/seam/routes/clients/access_codes.rb b/lib/seam/routes/clients/access_codes.rb index 5efc0db..33072f6 100644 --- a/lib/seam/routes/clients/access_codes.rb +++ b/lib/seam/routes/clients/access_codes.rb @@ -55,7 +55,7 @@ def list(access_code_ids: nil, device_id: nil, user_identifier_key: nil) def pull_backup_access_code(access_code_id:) res = @client.post("/access_codes/pull_backup_access_code", {access_code_id: access_code_id}.compact) - Seam::Resources::AccessCode.load_from_response(res.body["backup_access_code"]) + Seam::Resources::AccessCode.load_from_response(res.body["access_code"]) end def update(access_code_id:, allow_external_modification: nil, attempt_for_offline_device: nil, code: nil, device_id: nil, ends_at: nil, is_external_modification_allowed: nil, is_managed: nil, is_offline_access_code: nil, is_one_time_use: nil, max_time_rounding: nil, name: nil, prefer_native_scheduling: nil, preferred_code_length: nil, starts_at: nil, sync: nil, type: nil, use_backup_access_code_pool: nil, use_offline_access_code: nil) diff --git a/lib/seam/routes/clients/acs_credentials.rb b/lib/seam/routes/clients/acs_credentials.rb index 6e67436..755ceb7 100644 --- a/lib/seam/routes/clients/acs_credentials.rb +++ b/lib/seam/routes/clients/acs_credentials.rb @@ -20,6 +20,12 @@ def create(access_method:, acs_user_id:, allowed_acs_entrance_ids: nil, assa_abl Seam::Resources::AcsCredential.load_from_response(res.body["acs_credential"]) end + def create_offline_code(acs_user_id:, allowed_acs_entrance_id:, ends_at: nil, is_one_time_use: nil, starts_at: nil) + res = @client.post("/acs/credentials/create_offline_code", {acs_user_id: acs_user_id, allowed_acs_entrance_id: allowed_acs_entrance_id, ends_at: ends_at, is_one_time_use: is_one_time_use, starts_at: starts_at}.compact) + + Seam::Resources::AcsCredential.load_from_response(res.body["acs_credential"]) + end + def delete(acs_credential_id:) @client.post("/acs/credentials/delete", {acs_credential_id: acs_credential_id}.compact) diff --git a/lib/seam/routes/clients/acs_encoders.rb b/lib/seam/routes/clients/acs_encoders.rb index 955b647..9fadc91 100644 --- a/lib/seam/routes/clients/acs_encoders.rb +++ b/lib/seam/routes/clients/acs_encoders.rb @@ -24,8 +24,8 @@ def list(acs_system_id: nil, limit: nil, acs_system_ids: nil, acs_encoder_ids: n nil end - def scan_credential(acs_encoder_id:, acs_system_id:, wait_for_action_attempt: nil) - res = @client.post("/acs/encoders/scan_credential", {acs_encoder_id: acs_encoder_id, acs_system_id: acs_system_id}.compact) + def scan_credential(acs_encoder_id:, wait_for_action_attempt: nil) + res = @client.post("/acs/encoders/scan_credential", {acs_encoder_id: acs_encoder_id}.compact) wait_for_action_attempt = wait_for_action_attempt.nil? ? @defaults.wait_for_action_attempt : wait_for_action_attempt diff --git a/lib/seam/routes/clients/acs_encoders_simulate.rb b/lib/seam/routes/clients/acs_encoders_simulate.rb new file mode 100644 index 0000000..8494742 --- /dev/null +++ b/lib/seam/routes/clients/acs_encoders_simulate.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +module Seam + module Clients + class AcsEncodersSimulate + def initialize(client:, defaults:) + @client = client + @defaults = defaults + end + + def next_credential_encode_will_fail(acs_encoder_id:, error_code: nil, acs_credential_id: nil) + @client.post("/acs/encoders/simulate/next_credential_encode_will_fail", {acs_encoder_id: acs_encoder_id, error_code: error_code, acs_credential_id: acs_credential_id}.compact) + + nil + end + + def next_credential_encode_will_succeed(acs_encoder_id:, scenario: nil) + @client.post("/acs/encoders/simulate/next_credential_encode_will_succeed", {acs_encoder_id: acs_encoder_id, scenario: scenario}.compact) + + nil + end + + def next_credential_scan_will_fail(acs_encoder_id:, error_code: nil, acs_credential_id_on_seam: nil) + @client.post("/acs/encoders/simulate/next_credential_scan_will_fail", {acs_encoder_id: acs_encoder_id, error_code: error_code, acs_credential_id_on_seam: acs_credential_id_on_seam}.compact) + + nil + end + + def next_credential_scan_will_succeed(acs_encoder_id:, acs_credential_id_on_seam: nil, scenario: nil) + @client.post("/acs/encoders/simulate/next_credential_scan_will_succeed", {acs_encoder_id: acs_encoder_id, acs_credential_id_on_seam: acs_credential_id_on_seam, scenario: scenario}.compact) + + nil + end + end + end +end diff --git a/lib/seam/routes/clients/acs_users.rb b/lib/seam/routes/clients/acs_users.rb index 7533b51..fe0ab4d 100644 --- a/lib/seam/routes/clients/acs_users.rb +++ b/lib/seam/routes/clients/acs_users.rb @@ -14,8 +14,8 @@ def add_to_access_group(acs_access_group_id:, acs_user_id:) nil end - def create(acs_system_id:, access_schedule: nil, acs_access_group_ids: nil, email: nil, email_address: nil, full_name: nil, phone_number: nil, user_identity_id: nil) - res = @client.post("/acs/users/create", {acs_system_id: acs_system_id, access_schedule: access_schedule, acs_access_group_ids: acs_access_group_ids, email: email, email_address: email_address, full_name: full_name, phone_number: phone_number, user_identity_id: user_identity_id}.compact) + def create(acs_system_id:, full_name:, access_schedule: nil, acs_access_group_ids: nil, email: nil, email_address: nil, phone_number: nil, user_identity_id: nil) + res = @client.post("/acs/users/create", {acs_system_id: acs_system_id, full_name: full_name, access_schedule: access_schedule, acs_access_group_ids: acs_access_group_ids, email: email, email_address: email_address, phone_number: phone_number, user_identity_id: user_identity_id}.compact) Seam::Resources::AcsUser.load_from_response(res.body["acs_user"]) end diff --git a/lib/seam/routes/clients/index.rb b/lib/seam/routes/clients/index.rb index d08e382..f98509b 100644 --- a/lib/seam/routes/clients/index.rb +++ b/lib/seam/routes/clients/index.rb @@ -11,6 +11,7 @@ require_relative "acs_credentials" require_relative "acs_credentials_unmanaged" require_relative "acs_encoders" +require_relative "acs_encoders_simulate" require_relative "acs_entrances" require_relative "acs_systems" require_relative "acs_users" diff --git a/lib/seam/routes/resources/acs_credential.rb b/lib/seam/routes/resources/acs_credential.rb index 4cb87ac..9ce8a7a 100644 --- a/lib/seam/routes/resources/acs_credential.rb +++ b/lib/seam/routes/resources/acs_credential.rb @@ -3,7 +3,7 @@ module Seam module Resources class AcsCredential < BaseResource - attr_accessor :access_method, :acs_credential_id, :acs_credential_pool_id, :acs_system_id, :acs_user_id, :card_number, :code, :display_name, :ends_at, :external_type, :external_type_display_name, :is_issued, :is_latest_desired_state_synced_with_provider, :is_managed, :is_multi_phone_sync_credential, :parent_acs_credential_id, :starts_at, :visionline_metadata, :workspace_id + attr_accessor :access_method, :acs_credential_id, :acs_credential_pool_id, :acs_system_id, :acs_user_id, :card_number, :code, :display_name, :ends_at, :external_type, :external_type_display_name, :is_issued, :is_latest_desired_state_synced_with_provider, :is_managed, :is_multi_phone_sync_credential, :is_one_time_use, :parent_acs_credential_id, :starts_at, :visionline_metadata, :workspace_id date_accessor :created_at, :issued_at, :latest_desired_state_synced_with_provider_at diff --git a/lib/seam/routes/resources/acs_entrance.rb b/lib/seam/routes/resources/acs_entrance.rb index bf6be91..0b0549e 100644 --- a/lib/seam/routes/resources/acs_entrance.rb +++ b/lib/seam/routes/resources/acs_entrance.rb @@ -3,7 +3,7 @@ module Seam module Resources class AcsEntrance < BaseResource - attr_accessor :acs_entrance_id, :acs_system_id, :assa_abloy_vostio_metadata, :display_name, :dormakaba_community_metadata, :latch_metadata, :salto_ks_metadata, :visionline_metadata + attr_accessor :acs_entrance_id, :acs_system_id, :assa_abloy_vostio_metadata, :display_name, :dormakaba_community_metadata, :latch_metadata, :salto_ks_metadata, :salto_space_metadata, :visionline_metadata date_accessor :created_at diff --git a/lib/seam/routes/resources/client_session.rb b/lib/seam/routes/resources/client_session.rb index ff34b6b..87ae035 100644 --- a/lib/seam/routes/resources/client_session.rb +++ b/lib/seam/routes/resources/client_session.rb @@ -5,7 +5,7 @@ module Resources class ClientSession < BaseResource attr_accessor :client_session_id, :connect_webview_ids, :connected_account_ids, :device_count, :token, :user_identifier_key, :user_identity_ids, :workspace_id - date_accessor :created_at + date_accessor :created_at, :expires_at end end end diff --git a/lib/seam/routes/resources/event.rb b/lib/seam/routes/resources/event.rb index fb234af..8b32ac2 100644 --- a/lib/seam/routes/resources/event.rb +++ b/lib/seam/routes/resources/event.rb @@ -3,7 +3,7 @@ module Seam module Resources class SeamEvent < BaseResource - attr_accessor :acs_credential_id, :acs_system_id, :acs_user_id, :action_attempt_id, :client_session_id, :climate_preset_key, :cooling_set_point_celsius, :cooling_set_point_fahrenheit, :device_id, :enrollment_automation_id, :event_description, :event_id, :event_type, :fan_mode_setting, :heating_set_point_celsius, :heating_set_point_fahrenheit, :hvac_mode_setting, :is_fallback_climate_preset, :method, :thermostat_schedule_id, :workspace_id + attr_accessor :access_code_id, :connected_account_id, :device_id, :event_id, :event_type, :workspace_id, :code, :backup_access_code_id, :acs_system_id, :acs_credential_id, :acs_user_id, :acs_encoder_id, :client_session_id, :connect_webview_id, :action_attempt_id, :action_type, :status, :error_code, :battery_level, :battery_status, :minut_metadata, :noise_level_decibels, :noise_level_nrs, :noise_threshold_id, :noise_threshold_name, :noiseaware_metadata, :method, :climate_preset_key, :is_fallback_climate_preset, :thermostat_schedule_id, :cooling_set_point_celsius, :cooling_set_point_fahrenheit, :fan_mode_setting, :heating_set_point_celsius, :heating_set_point_fahrenheit, :hvac_mode_setting, :lower_limit_celsius, :lower_limit_fahrenheit, :temperature_celsius, :temperature_fahrenheit, :upper_limit_celsius, :upper_limit_fahrenheit, :enrollment_automation_id date_accessor :created_at, :occurred_at end diff --git a/package-lock.json b/package-lock.json index f5199d3..a2017bc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,9 +6,9 @@ "": { "name": "@seamapi/ruby", "devDependencies": { - "@seamapi/fake-seam-connect": "1.73.1", - "@seamapi/nextlove-sdk-generator": "1.14.12", - "@seamapi/types": "1.301.0", + "@seamapi/fake-seam-connect": "1.73.6", + "@seamapi/nextlove-sdk-generator": "1.14.17", + "@seamapi/types": "1.315.0", "del": "^7.1.0", "markdown-toc": "^1.2.0", "prettier": "^3.2.5" @@ -435,9 +435,9 @@ } }, "node_modules/@seamapi/fake-seam-connect": { - "version": "1.73.1", - "resolved": "https://registry.npmjs.org/@seamapi/fake-seam-connect/-/fake-seam-connect-1.73.1.tgz", - "integrity": "sha512-Upsil/v2NGKibZ37zmDzV+Ul/EYUbAh7Mg1q1h2Phx/zudRv9vPeVTi/naWO0yc4BTsm60S1Cs9U5fsX4Os1wA==", + "version": "1.73.6", + "resolved": "https://registry.npmjs.org/@seamapi/fake-seam-connect/-/fake-seam-connect-1.73.6.tgz", + "integrity": "sha512-N03XWVf91J73AIHgRryz4EF16liRRqGIJR4ZW8KUulW9ku0BFDZ43Hg1pNqk+sJ6jknU9HjlN0cfU4YryUQk2A==", "dev": true, "bin": { "fake-seam-connect": "dist/server.js" @@ -447,15 +447,16 @@ "npm": ">= 9.0.0" }, "optionalDependencies": { - "@seamapi/fake-devicedb": ">=1.0.0-rc.0" + "@seamapi/fake-devicedb": ">=1.0.0-rc.0", + "zustand": "^4.3.7", + "zustand-hoist": "^2.0.0" } }, "node_modules/@seamapi/nextlove-sdk-generator": { - "version": "1.14.12", - "resolved": "https://registry.npmjs.org/@seamapi/nextlove-sdk-generator/-/nextlove-sdk-generator-1.14.12.tgz", - "integrity": "sha512-1bSYQ9b8+ezkbfZbAgK6A2XyAKUK5jJrtwpNdVtZpnqzsueiOdOUBoFmoHgd4aHyUISr9uhXc5P8OzuFWsS3Gw==", + "version": "1.14.17", + "resolved": "https://registry.npmjs.org/@seamapi/nextlove-sdk-generator/-/nextlove-sdk-generator-1.14.17.tgz", + "integrity": "sha512-HMCfYT2bFplIHubvD4uWTedL1HbJZYhU6h3RsB2V6Ty902jV6iaKfAgzN4m4MBP5p+Hsn4BhIGuSNtxMad6uXg==", "dev": true, - "license": "MIT", "dependencies": { "@nodelib/fs.walk": "^2.0.0", "axios": "^1.5.0", @@ -473,9 +474,9 @@ } }, "node_modules/@seamapi/types": { - "version": "1.301.0", - "resolved": "https://registry.npmjs.org/@seamapi/types/-/types-1.301.0.tgz", - "integrity": "sha512-EJPYQIJR/1j0+kGitwo0ZXfagRwpkWJwii0senlBS65gHoyJXUdbxL14b7kV1hdhfZbE3N/r+vR2rbh7wNZn3A==", + "version": "1.315.0", + "resolved": "https://registry.npmjs.org/@seamapi/types/-/types-1.315.0.tgz", + "integrity": "sha512-/j+5WmOWD2QdHLvaXIZihfQdc+RilxPUCVhY1xwoqTmQ0jvies0TDNhDmVEqGmsxp6e7YA7vqdmRVwDkE/aZbQ==", "dev": true, "engines": { "node": ">=18.12.0", diff --git a/package.json b/package.json index ee3ce9a..b3f7d01 100644 --- a/package.json +++ b/package.json @@ -10,9 +10,9 @@ "start": "fake-seam-connect --seed" }, "devDependencies": { - "@seamapi/fake-seam-connect": "1.73.1", - "@seamapi/nextlove-sdk-generator": "1.14.12", - "@seamapi/types": "1.301.0", + "@seamapi/fake-seam-connect": "1.73.6", + "@seamapi/nextlove-sdk-generator": "1.14.17", + "@seamapi/types": "1.315.0", "del": "^7.1.0", "markdown-toc": "^1.2.0", "prettier": "^3.2.5"