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