diff --git a/codegen/layouts/partials/client-method.hbs b/codegen/layouts/partials/client-method.hbs index 8e7155a..3775fd5 100644 --- a/codegen/layouts/partials/client-method.hbs +++ b/codegen/layouts/partials/client-method.hbs @@ -14,7 +14,7 @@ raise TypeError, "At least one parameter is required for {{path}}" end -{{/if}} {{#if usesRes}}res = {{/if}}@client.post("{{path}}"{{#if hasParams}}, {{bodyParams}}.compact{{/if}}) +{{/if}} {{#if usesRes}}res = {{/if}}@client.{{httpMethod}}("{{path}}"{{#if hasParams}}, {{bodyParams}}.compact{{/if}}) {{#if isResource}} Seam::Resources::{{returnResource}}.load_from_response(res.body["{{returnPath}}"]) diff --git a/codegen/lib/layouts/client.ts b/codegen/lib/layouts/client.ts index 94504cb..21134c2 100644 --- a/codegen/lib/layouts/client.ts +++ b/codegen/lib/layouts/client.ts @@ -25,6 +25,7 @@ export interface ClientMethodLayoutContext { isResource: boolean isPoll: boolean isNil: boolean + httpMethod: string returnResource: string returnPath: string } @@ -39,7 +40,14 @@ export interface ClientLayoutContext { const getMethodLayoutContext = ( method: ClientMethod, ): ClientMethodLayoutContext => { - const { methodName, path, parameters, returnResource, returnPath } = method + const { + methodName, + path, + parameters, + returnResource, + returnPath, + httpMethod, + } = method const hasReturnValue = returnResource != null && returnPath !== '' const canPollActionAttempt = returnPath === 'action_attempt' @@ -73,6 +81,7 @@ const getMethodLayoutContext = ( hasParams, bodyParams, path, + httpMethod: httpMethod.toLowerCase(), usesRes: isResource || isPoll, isResource, isPoll, diff --git a/codegen/lib/routes.ts b/codegen/lib/routes.ts index e938056..4d8cf10 100644 --- a/codegen/lib/routes.ts +++ b/codegen/lib/routes.ts @@ -208,6 +208,7 @@ const createClientMethod = (endpoint: Endpoint): ClientMethod => { return { methodName: endpoint.name, + httpMethod: endpoint.request.preferredMethod, description: endpoint.description, isDeprecated: endpoint.isDeprecated, deprecationMessage: endpoint.deprecationMessage, diff --git a/codegen/lib/ruby-client.ts b/codegen/lib/ruby-client.ts index ab05a5b..f0263de 100644 --- a/codegen/lib/ruby-client.ts +++ b/codegen/lib/ruby-client.ts @@ -14,6 +14,7 @@ export interface ClientMethodParameter { export interface ClientMethod { methodName: string + httpMethod: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' description: string isDeprecated: boolean deprecationMessage: string diff --git a/lib/seam/routes/access_codes.rb b/lib/seam/routes/access_codes.rb index c4dfce6..3e7dab2 100644 --- a/lib/seam/routes/access_codes.rb +++ b/lib/seam/routes/access_codes.rb @@ -78,7 +78,7 @@ def create(device_id:, allow_external_modification: nil, attempt_for_offline_dev # @param use_backup_access_code_pool [Boolean, nil] Indicates whether to use a [backup access code pool](https://docs.seam.co/low-level-apis/smart-locks/access-codes/backup-access-codes) provided by Seam. If `true`, you can use [`/access_codes/pull_backup_access_code`](https://docs.seam.co/api/access_codes/pull_backup_access_code). # @return [Seam::Resources::AccessCode] OK def create_multiple(device_ids:, allow_external_modification: nil, attempt_for_offline_device: nil, behavior_when_code_cannot_be_shared: nil, code: nil, ends_at: nil, is_external_modification_allowed: nil, name: nil, prefer_native_scheduling: nil, preferred_code_length: nil, starts_at: nil, use_backup_access_code_pool: nil) - res = @client.post("/access_codes/create_multiple", {device_ids: device_ids, allow_external_modification: allow_external_modification, attempt_for_offline_device: attempt_for_offline_device, behavior_when_code_cannot_be_shared: behavior_when_code_cannot_be_shared, code: code, ends_at: ends_at, is_external_modification_allowed: is_external_modification_allowed, name: name, prefer_native_scheduling: prefer_native_scheduling, preferred_code_length: preferred_code_length, starts_at: starts_at, use_backup_access_code_pool: use_backup_access_code_pool}.compact) + res = @client.put("/access_codes/create_multiple", {device_ids: device_ids, allow_external_modification: allow_external_modification, attempt_for_offline_device: attempt_for_offline_device, behavior_when_code_cannot_be_shared: behavior_when_code_cannot_be_shared, code: code, ends_at: ends_at, is_external_modification_allowed: is_external_modification_allowed, name: name, prefer_native_scheduling: prefer_native_scheduling, preferred_code_length: preferred_code_length, starts_at: starts_at, use_backup_access_code_pool: use_backup_access_code_pool}.compact) Seam::Resources::AccessCode.load_from_response(res.body["access_codes"]) end @@ -88,7 +88,7 @@ def create_multiple(device_ids:, allow_external_modification: nil, attempt_for_o # @param device_id [String, nil] ID of the device for which you want to delete the access code. # @return [nil] OK def delete(access_code_id:, device_id: nil) - @client.post("/access_codes/delete", {access_code_id: access_code_id, device_id: device_id}.compact) + @client.delete("/access_codes/delete", {access_code_id: access_code_id, device_id: device_id}.compact) nil end @@ -97,7 +97,7 @@ def delete(access_code_id:, device_id: nil) # @param device_id [String] ID of the device for which you want to generate a code. # @return [Seam::Resources::AccessCode] OK def generate_code(device_id:) - res = @client.post("/access_codes/generate_code", {device_id: device_id}.compact) + res = @client.get("/access_codes/generate_code", {device_id: device_id}.compact) Seam::Resources::AccessCode.load_from_response(res.body["generated_code"]) end @@ -114,7 +114,7 @@ def get(access_code_id: nil, code: nil, device_id: nil) raise TypeError, "At least one parameter is required for /access_codes/get" end - res = @client.post("/access_codes/get", {access_code_id: access_code_id, code: code, device_id: device_id}.compact) + res = @client.get("/access_codes/get", {access_code_id: access_code_id, code: code, device_id: device_id}.compact) Seam::Resources::AccessCode.load_from_response(res.body["access_code"]) end @@ -196,7 +196,7 @@ def report_device_constraints(device_id:, max_code_length: nil, min_code_length: # @param type [String, nil] Type to which you want to convert the access code. To convert a time-bound access code to an ongoing access code, set `type` to `ongoing`. See also [Changing a time-bound access code to permanent access](https://docs.seam.co/low-level-apis/smart-locks/access-codes/modifying-access-codes#special-case-2-changing-a-time-bound-access-code-to-permanent-access). # @return [nil] OK 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, name: nil, starts_at: nil, type: nil) - @client.post("/access_codes/update", {access_code_id: access_code_id, allow_external_modification: allow_external_modification, attempt_for_offline_device: attempt_for_offline_device, code: code, device_id: device_id, ends_at: ends_at, is_external_modification_allowed: is_external_modification_allowed, is_managed: is_managed, name: name, starts_at: starts_at, type: type}.compact) + @client.put("/access_codes/update", {access_code_id: access_code_id, allow_external_modification: allow_external_modification, attempt_for_offline_device: attempt_for_offline_device, code: code, device_id: device_id, ends_at: ends_at, is_external_modification_allowed: is_external_modification_allowed, is_managed: is_managed, name: name, starts_at: starts_at, type: type}.compact) nil end @@ -218,7 +218,7 @@ def update(access_code_id:, allow_external_modification: nil, attempt_for_offlin # @param starts_at [String, nil] Date and time at which the validity of the new access code starts, in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. # @return [nil] OK def update_multiple(common_code_key:, ends_at: nil, name: nil, starts_at: nil) - @client.post("/access_codes/update_multiple", {common_code_key: common_code_key, ends_at: ends_at, name: name, starts_at: starts_at}.compact) + @client.patch("/access_codes/update_multiple", {common_code_key: common_code_key, ends_at: ends_at, name: name, starts_at: starts_at}.compact) nil end diff --git a/lib/seam/routes/access_codes_unmanaged.rb b/lib/seam/routes/access_codes_unmanaged.rb index bfb092f..3ef9469 100644 --- a/lib/seam/routes/access_codes_unmanaged.rb +++ b/lib/seam/routes/access_codes_unmanaged.rb @@ -19,7 +19,7 @@ def initialize(client:, defaults:) # @param is_external_modification_allowed [Boolean, nil] Indicates whether [external modification](https://docs.seam.co/low-level-apis/smart-locks/access-codes#external-modification) of the access code is allowed. # @return [nil] OK def convert_to_managed(access_code_id:, allow_external_modification: nil, force: nil, is_external_modification_allowed: nil) - @client.post("/access_codes/unmanaged/convert_to_managed", {access_code_id: access_code_id, allow_external_modification: allow_external_modification, force: force, is_external_modification_allowed: is_external_modification_allowed}.compact) + @client.patch("/access_codes/unmanaged/convert_to_managed", {access_code_id: access_code_id, allow_external_modification: allow_external_modification, force: force, is_external_modification_allowed: is_external_modification_allowed}.compact) nil end @@ -28,7 +28,7 @@ def convert_to_managed(access_code_id:, allow_external_modification: nil, force: # @param access_code_id [String] ID of the unmanaged access code that you want to delete. # @return [nil] OK def delete(access_code_id:) - @client.post("/access_codes/unmanaged/delete", {access_code_id: access_code_id}.compact) + @client.delete("/access_codes/unmanaged/delete", {access_code_id: access_code_id}.compact) nil end @@ -45,7 +45,7 @@ def get(access_code_id: nil, code: nil, device_id: nil) raise TypeError, "At least one parameter is required for /access_codes/unmanaged/get" end - res = @client.post("/access_codes/unmanaged/get", {access_code_id: access_code_id, code: code, device_id: device_id}.compact) + res = @client.get("/access_codes/unmanaged/get", {access_code_id: access_code_id, code: code, device_id: device_id}.compact) Seam::Resources::UnmanagedAccessCode.load_from_response(res.body["access_code"]) end @@ -58,7 +58,7 @@ def get(access_code_id: nil, code: nil, device_id: nil) # @param user_identifier_key [String, nil] Your user ID for the user by which to filter unmanaged access codes. # @return [Seam::Resources::UnmanagedAccessCode] OK def list(device_id:, limit: nil, page_cursor: nil, search: nil, user_identifier_key: nil) - res = @client.post("/access_codes/unmanaged/list", {device_id: device_id, limit: limit, page_cursor: page_cursor, search: search, user_identifier_key: user_identifier_key}.compact) + res = @client.get("/access_codes/unmanaged/list", {device_id: device_id, limit: limit, page_cursor: page_cursor, search: search, user_identifier_key: user_identifier_key}.compact) Seam::Resources::UnmanagedAccessCode.load_from_response(res.body["access_codes"]) end @@ -71,7 +71,7 @@ def list(device_id:, limit: nil, page_cursor: nil, search: nil, user_identifier_ # @param is_external_modification_allowed [Boolean, nil] Indicates whether [external modification](https://docs.seam.co/low-level-apis/smart-locks/access-codes#external-modification) of the code is allowed. # @return [nil] OK def update(access_code_id:, is_managed:, allow_external_modification: nil, force: nil, is_external_modification_allowed: nil) - @client.post("/access_codes/unmanaged/update", {access_code_id: access_code_id, is_managed: is_managed, allow_external_modification: allow_external_modification, force: force, is_external_modification_allowed: is_external_modification_allowed}.compact) + @client.patch("/access_codes/unmanaged/update", {access_code_id: access_code_id, is_managed: is_managed, allow_external_modification: allow_external_modification, force: force, is_external_modification_allowed: is_external_modification_allowed}.compact) nil end diff --git a/lib/seam/routes/access_grants.rb b/lib/seam/routes/access_grants.rb index f942ae9..f0a1061 100644 --- a/lib/seam/routes/access_grants.rb +++ b/lib/seam/routes/access_grants.rb @@ -41,7 +41,7 @@ def create(requested_access_methods:, user_identity_id: nil, user_identity: nil, # @param access_grant_id [String] ID of Access Grant to delete. # @return [nil] OK def delete(access_grant_id:) - @client.post("/access_grants/delete", {access_grant_id: access_grant_id}.compact) + @client.delete("/access_grants/delete", {access_grant_id: access_grant_id}.compact) nil end @@ -55,7 +55,7 @@ def get(access_grant_id: nil, access_grant_key: nil) raise TypeError, "At least one parameter is required for /access_grants/get" end - res = @client.post("/access_grants/get", {access_grant_id: access_grant_id, access_grant_key: access_grant_key}.compact) + res = @client.get("/access_grants/get", {access_grant_id: access_grant_id, access_grant_key: access_grant_key}.compact) Seam::Resources::AccessGrant.load_from_response(res.body["access_grant"]) end @@ -120,7 +120,7 @@ def update(access_grant_id: nil, access_grant_key: nil, ends_at: nil, name: nil, raise TypeError, "At least one parameter is required for /access_grants/update" end - @client.post("/access_grants/update", {access_grant_id: access_grant_id, access_grant_key: access_grant_key, ends_at: ends_at, name: name, starts_at: starts_at}.compact) + @client.patch("/access_grants/update", {access_grant_id: access_grant_id, access_grant_key: access_grant_key, ends_at: ends_at, name: name, starts_at: starts_at}.compact) nil end diff --git a/lib/seam/routes/access_grants_unmanaged.rb b/lib/seam/routes/access_grants_unmanaged.rb index 906d03c..52742a0 100644 --- a/lib/seam/routes/access_grants_unmanaged.rb +++ b/lib/seam/routes/access_grants_unmanaged.rb @@ -12,7 +12,7 @@ def initialize(client:, defaults:) # @param access_grant_id [String] ID of unmanaged Access Grant to get. # @return [Seam::Resources::UnmanagedAccessGrant] OK def get(access_grant_id:) - res = @client.post("/access_grants/unmanaged/get", {access_grant_id: access_grant_id}.compact) + res = @client.get("/access_grants/unmanaged/get", {access_grant_id: access_grant_id}.compact) Seam::Resources::UnmanagedAccessGrant.load_from_response(res.body["access_grant"]) end @@ -26,7 +26,7 @@ def get(access_grant_id:) # @param user_identity_id [String, nil] ID of user identity by which you want to filter the list of unmanaged Access Grants. # @return [Seam::Resources::UnmanagedAccessGrant] OK def list(acs_entrance_id: nil, acs_system_id: nil, limit: nil, page_cursor: nil, reservation_key: nil, user_identity_id: nil) - res = @client.post("/access_grants/unmanaged/list", {acs_entrance_id: acs_entrance_id, acs_system_id: acs_system_id, limit: limit, page_cursor: page_cursor, reservation_key: reservation_key, user_identity_id: user_identity_id}.compact) + res = @client.get("/access_grants/unmanaged/list", {acs_entrance_id: acs_entrance_id, acs_system_id: acs_system_id, limit: limit, page_cursor: page_cursor, reservation_key: reservation_key, user_identity_id: user_identity_id}.compact) Seam::Resources::UnmanagedAccessGrant.load_from_response(res.body["access_grants"]) end @@ -41,7 +41,7 @@ def list(acs_entrance_id: nil, acs_system_id: nil, limit: nil, page_cursor: nil, # @param access_grant_key [String, nil] Unique key for the access grant. If not provided, the existing key will be preserved. # @return [nil] OK def update(access_grant_id:, is_managed:, access_grant_key: nil) - @client.post("/access_grants/unmanaged/update", {access_grant_id: access_grant_id, is_managed: is_managed, access_grant_key: access_grant_key}.compact) + @client.patch("/access_grants/unmanaged/update", {access_grant_id: access_grant_id, is_managed: is_managed, access_grant_key: access_grant_key}.compact) nil end diff --git a/lib/seam/routes/access_methods.rb b/lib/seam/routes/access_methods.rb index 320f336..3c01c5d 100644 --- a/lib/seam/routes/access_methods.rb +++ b/lib/seam/routes/access_methods.rb @@ -36,7 +36,7 @@ def delete(access_method_id: nil, access_grant_id: nil, reservation_key: nil) raise TypeError, "At least one parameter is required for /access_methods/delete" end - @client.post("/access_methods/delete", {access_method_id: access_method_id, access_grant_id: access_grant_id, reservation_key: reservation_key}.compact) + @client.delete("/access_methods/delete", {access_method_id: access_method_id, access_grant_id: access_grant_id, reservation_key: reservation_key}.compact) nil end @@ -57,7 +57,7 @@ def encode(access_method_id:, acs_encoder_id:, wait_for_action_attempt: nil) # @param access_method_id [String] ID of access method to get. # @return [Seam::Resources::AccessMethod] OK def get(access_method_id:) - res = @client.post("/access_methods/get", {access_method_id: access_method_id}.compact) + res = @client.get("/access_methods/get", {access_method_id: access_method_id}.compact) Seam::Resources::AccessMethod.load_from_response(res.body["access_method"]) end @@ -88,7 +88,7 @@ def list(access_code_id: nil, access_grant_id: nil, access_grant_key: nil, acs_e raise TypeError, "At least one parameter is required for /access_methods/list" end - res = @client.post("/access_methods/list", {access_code_id: access_code_id, access_grant_id: access_grant_id, access_grant_key: access_grant_key, acs_entrance_id: acs_entrance_id, device_id: device_id, limit: limit, page_cursor: page_cursor, space_id: space_id}.compact) + res = @client.get("/access_methods/list", {access_code_id: access_code_id, access_grant_id: access_grant_id, access_grant_key: access_grant_key, acs_entrance_id: acs_entrance_id, device_id: device_id, limit: limit, page_cursor: page_cursor, space_id: space_id}.compact) Seam::Resources::AccessMethod.load_from_response(res.body["access_methods"]) end diff --git a/lib/seam/routes/access_methods_unmanaged.rb b/lib/seam/routes/access_methods_unmanaged.rb index f556cee..b63fc07 100644 --- a/lib/seam/routes/access_methods_unmanaged.rb +++ b/lib/seam/routes/access_methods_unmanaged.rb @@ -12,7 +12,7 @@ def initialize(client:, defaults:) # @param access_method_id [String] ID of unmanaged access method to get. # @return [Seam::Resources::UnmanagedAccessMethod] OK def get(access_method_id:) - res = @client.post("/access_methods/unmanaged/get", {access_method_id: access_method_id}.compact) + res = @client.get("/access_methods/unmanaged/get", {access_method_id: access_method_id}.compact) Seam::Resources::UnmanagedAccessMethod.load_from_response(res.body["access_method"]) end @@ -24,7 +24,7 @@ def get(access_method_id:) # @param space_id [String, nil] ID of the space for which you want to retrieve all unmanaged access methods. # @return [Seam::Resources::UnmanagedAccessMethod] OK def list(access_grant_id:, acs_entrance_id: nil, device_id: nil, space_id: nil) - res = @client.post("/access_methods/unmanaged/list", {access_grant_id: access_grant_id, acs_entrance_id: acs_entrance_id, device_id: device_id, space_id: space_id}.compact) + res = @client.get("/access_methods/unmanaged/list", {access_grant_id: access_grant_id, acs_entrance_id: acs_entrance_id, device_id: device_id, space_id: space_id}.compact) Seam::Resources::UnmanagedAccessMethod.load_from_response(res.body["access_methods"]) end diff --git a/lib/seam/routes/acs_access_groups.rb b/lib/seam/routes/acs_access_groups.rb index e8bd64d..2de3d13 100644 --- a/lib/seam/routes/acs_access_groups.rb +++ b/lib/seam/routes/acs_access_groups.rb @@ -14,7 +14,7 @@ def initialize(client:, defaults:) # @param user_identity_id [String, nil] ID of the desired user identity that you want to add to an access group. You can only provide one of acs_user_id or user_identity_id. If the ACS system contains an ACS user with the same `email_address` or `phone_number` as the user identity that you specify, they are linked, and the access group membership belongs to the ACS user. If the ACS system does not have a corresponding ACS user, one is created. # @return [nil] OK def add_user(acs_access_group_id:, acs_user_id: nil, user_identity_id: nil) - @client.post("/acs/access_groups/add_user", {acs_access_group_id: acs_access_group_id, acs_user_id: acs_user_id, user_identity_id: user_identity_id}.compact) + @client.put("/acs/access_groups/add_user", {acs_access_group_id: acs_access_group_id, acs_user_id: acs_user_id, user_identity_id: user_identity_id}.compact) nil end @@ -23,7 +23,7 @@ def add_user(acs_access_group_id:, acs_user_id: nil, user_identity_id: nil) # @param acs_access_group_id [String] ID of the access group that you want to delete. # @return [nil] OK def delete(acs_access_group_id:) - @client.post("/acs/access_groups/delete", {acs_access_group_id: acs_access_group_id}.compact) + @client.delete("/acs/access_groups/delete", {acs_access_group_id: acs_access_group_id}.compact) nil end @@ -32,7 +32,7 @@ def delete(acs_access_group_id:) # @param acs_access_group_id [String] ID of the access group that you want to get. # @return [Seam::Resources::AcsAccessGroup] OK def get(acs_access_group_id:) - res = @client.post("/acs/access_groups/get", {acs_access_group_id: acs_access_group_id}.compact) + res = @client.get("/acs/access_groups/get", {acs_access_group_id: acs_access_group_id}.compact) Seam::Resources::AcsAccessGroup.load_from_response(res.body["acs_access_group"]) end @@ -44,7 +44,7 @@ def get(acs_access_group_id:) # @param user_identity_id [String, nil] ID of the user identity for which you want to retrieve all access groups. # @return [Seam::Resources::AcsAccessGroup] OK def list(acs_system_id: nil, acs_user_id: nil, search: nil, user_identity_id: nil) - res = @client.post("/acs/access_groups/list", {acs_system_id: acs_system_id, acs_user_id: acs_user_id, search: search, user_identity_id: user_identity_id}.compact) + res = @client.get("/acs/access_groups/list", {acs_system_id: acs_system_id, acs_user_id: acs_user_id, search: search, user_identity_id: user_identity_id}.compact) Seam::Resources::AcsAccessGroup.load_from_response(res.body["acs_access_groups"]) end @@ -53,7 +53,7 @@ def list(acs_system_id: nil, acs_user_id: nil, search: nil, user_identity_id: ni # @param acs_access_group_id [String] ID of the access group for which you want to retrieve all accessible entrances. # @return [Seam::Resources::AcsEntrance] OK def list_accessible_entrances(acs_access_group_id:) - res = @client.post("/acs/access_groups/list_accessible_entrances", {acs_access_group_id: acs_access_group_id}.compact) + res = @client.get("/acs/access_groups/list_accessible_entrances", {acs_access_group_id: acs_access_group_id}.compact) Seam::Resources::AcsEntrance.load_from_response(res.body["acs_entrances"]) end @@ -62,7 +62,7 @@ def list_accessible_entrances(acs_access_group_id:) # @param acs_access_group_id [String] ID of the access group for which you want to retrieve all access system users. # @return [Seam::Resources::AcsUser] OK def list_users(acs_access_group_id:) - res = @client.post("/acs/access_groups/list_users", {acs_access_group_id: acs_access_group_id}.compact) + res = @client.get("/acs/access_groups/list_users", {acs_access_group_id: acs_access_group_id}.compact) Seam::Resources::AcsUser.load_from_response(res.body["acs_users"]) end @@ -73,7 +73,7 @@ def list_users(acs_access_group_id:) # @param user_identity_id [String, nil] ID of the user identity associated with the user that you want to remove from an access group. # @return [nil] OK def remove_user(acs_access_group_id:, acs_user_id: nil, user_identity_id: nil) - @client.post("/acs/access_groups/remove_user", {acs_access_group_id: acs_access_group_id, acs_user_id: acs_user_id, user_identity_id: user_identity_id}.compact) + @client.delete("/acs/access_groups/remove_user", {acs_access_group_id: acs_access_group_id, acs_user_id: acs_user_id, user_identity_id: user_identity_id}.compact) nil end diff --git a/lib/seam/routes/acs_credentials.rb b/lib/seam/routes/acs_credentials.rb index 0ad1dee..a66f248 100644 --- a/lib/seam/routes/acs_credentials.rb +++ b/lib/seam/routes/acs_credentials.rb @@ -14,7 +14,7 @@ def initialize(client:, defaults:) # @param user_identity_id [String, nil] ID of the user identity to whom you want to assign a credential. You can only provide one of acs_user_id or user_identity_id. If the ACS system contains an ACS user with the same `email_address` or `phone_number` as the user identity that you specify, they are linked, and the credential belongs to the ACS user. If the ACS system does not have a corresponding ACS user, one is created. # @return [nil] OK def assign(acs_credential_id:, acs_user_id: nil, user_identity_id: nil) - @client.post("/acs/credentials/assign", {acs_credential_id: acs_credential_id, acs_user_id: acs_user_id, user_identity_id: user_identity_id}.compact) + @client.patch("/acs/credentials/assign", {acs_credential_id: acs_credential_id, acs_user_id: acs_user_id, user_identity_id: user_identity_id}.compact) nil end @@ -44,7 +44,7 @@ def create(access_method:, acs_system_id: nil, acs_user_id: nil, allowed_acs_ent # @param acs_credential_id [String] ID of the credential that you want to delete. # @return [nil] OK def delete(acs_credential_id:) - @client.post("/acs/credentials/delete", {acs_credential_id: acs_credential_id}.compact) + @client.delete("/acs/credentials/delete", {acs_credential_id: acs_credential_id}.compact) nil end @@ -53,7 +53,7 @@ def delete(acs_credential_id:) # @param acs_credential_id [String] ID of the credential that you want to get. # @return [Seam::Resources::AcsCredential] OK def get(acs_credential_id:) - res = @client.post("/acs/credentials/get", {acs_credential_id: acs_credential_id}.compact) + res = @client.get("/acs/credentials/get", {acs_credential_id: acs_credential_id}.compact) Seam::Resources::AcsCredential.load_from_response(res.body["acs_credential"]) end @@ -69,7 +69,7 @@ def get(acs_credential_id:) # @param search [String, nil] String for which to search. Filters returned credentials to include all records that satisfy a partial match using `display_name`, `code`, `card_number`, `acs_user_id` or `acs_credential_id`. # @return [Seam::Resources::AcsCredential] OK def list(acs_user_id: nil, acs_system_id: nil, user_identity_id: nil, created_before: nil, is_multi_phone_sync_credential: nil, limit: nil, page_cursor: nil, search: nil) - res = @client.post("/acs/credentials/list", {acs_user_id: acs_user_id, acs_system_id: acs_system_id, user_identity_id: user_identity_id, created_before: created_before, is_multi_phone_sync_credential: is_multi_phone_sync_credential, limit: limit, page_cursor: page_cursor, search: search}.compact) + res = @client.get("/acs/credentials/list", {acs_user_id: acs_user_id, acs_system_id: acs_system_id, user_identity_id: user_identity_id, created_before: created_before, is_multi_phone_sync_credential: is_multi_phone_sync_credential, limit: limit, page_cursor: page_cursor, search: search}.compact) Seam::Resources::AcsCredential.load_from_response(res.body["acs_credentials"]) end @@ -78,7 +78,7 @@ def list(acs_user_id: nil, acs_system_id: nil, user_identity_id: nil, created_be # @param acs_credential_id [String] ID of the credential for which you want to retrieve all entrances to which the credential grants access. # @return [Seam::Resources::AcsEntrance] OK def list_accessible_entrances(acs_credential_id:) - res = @client.post("/acs/credentials/list_accessible_entrances", {acs_credential_id: acs_credential_id}.compact) + res = @client.get("/acs/credentials/list_accessible_entrances", {acs_credential_id: acs_credential_id}.compact) Seam::Resources::AcsEntrance.load_from_response(res.body["acs_entrances"]) end @@ -89,7 +89,7 @@ def list_accessible_entrances(acs_credential_id:) # @param user_identity_id [String, nil] ID of the user identity from which you want to unassign a credential. You can only provide one of acs_user_id or user_identity_id. # @return [nil] OK def unassign(acs_credential_id:, acs_user_id: nil, user_identity_id: nil) - @client.post("/acs/credentials/unassign", {acs_credential_id: acs_credential_id, acs_user_id: acs_user_id, user_identity_id: user_identity_id}.compact) + @client.patch("/acs/credentials/unassign", {acs_credential_id: acs_credential_id, acs_user_id: acs_user_id, user_identity_id: user_identity_id}.compact) nil end @@ -100,7 +100,7 @@ def unassign(acs_credential_id:, acs_user_id: nil, user_identity_id: nil) # @param ends_at [Time, nil] Replacement date and time at which the validity of the credential ends, in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Must be a time in the future and after the `starts_at` value that you set when creating the credential. # @return [nil] OK def update(acs_credential_id:, code: nil, ends_at: nil) - @client.post("/acs/credentials/update", {acs_credential_id: acs_credential_id, code: code, ends_at: ends_at}.compact) + @client.patch("/acs/credentials/update", {acs_credential_id: acs_credential_id, code: code, ends_at: ends_at}.compact) nil end diff --git a/lib/seam/routes/acs_encoders.rb b/lib/seam/routes/acs_encoders.rb index ca907bc..7da5c6b 100644 --- a/lib/seam/routes/acs_encoders.rb +++ b/lib/seam/routes/acs_encoders.rb @@ -31,7 +31,7 @@ def encode_credential(acs_encoder_id:, access_method_id: nil, acs_credential_id: # @param acs_encoder_id [String] ID of the encoder that you want to get. # @return [Seam::Resources::AcsEncoder] OK def get(acs_encoder_id:) - res = @client.post("/acs/encoders/get", {acs_encoder_id: acs_encoder_id}.compact) + res = @client.get("/acs/encoders/get", {acs_encoder_id: acs_encoder_id}.compact) Seam::Resources::AcsEncoder.load_from_response(res.body["acs_encoder"]) end diff --git a/lib/seam/routes/acs_entrances.rb b/lib/seam/routes/acs_entrances.rb index dd0c686..5043518 100644 --- a/lib/seam/routes/acs_entrances.rb +++ b/lib/seam/routes/acs_entrances.rb @@ -14,7 +14,7 @@ def initialize(client:, defaults:) # @param acs_entrance_id [String] ID of the entrance that you want to get. # @return [Seam::Resources::AcsEntrance] OK def get(acs_entrance_id:) - res = @client.post("/acs/entrances/get", {acs_entrance_id: acs_entrance_id}.compact) + res = @client.get("/acs/entrances/get", {acs_entrance_id: acs_entrance_id}.compact) Seam::Resources::AcsEntrance.load_from_response(res.body["acs_entrance"]) end diff --git a/lib/seam/routes/acs_systems.rb b/lib/seam/routes/acs_systems.rb index bfc4e7d..0d247ae 100644 --- a/lib/seam/routes/acs_systems.rb +++ b/lib/seam/routes/acs_systems.rb @@ -12,7 +12,7 @@ def initialize(client:, defaults:) # @param acs_system_id [String] ID of the access system that you want to get. # @return [Seam::Resources::AcsSystem] OK def get(acs_system_id:) - res = @client.post("/acs/systems/get", {acs_system_id: acs_system_id}.compact) + res = @client.get("/acs/systems/get", {acs_system_id: acs_system_id}.compact) Seam::Resources::AcsSystem.load_from_response(res.body["acs_system"]) end @@ -25,7 +25,7 @@ def get(acs_system_id:) # @param search [String, nil] String for which to search. Filters returned access systems to include all records that satisfy a partial match using `name` or `acs_system_id`. # @return [Seam::Resources::AcsSystem] OK def list(connected_account_id: nil, customer_key: nil, search: nil) - res = @client.post("/acs/systems/list", {connected_account_id: connected_account_id, customer_key: customer_key, search: search}.compact) + res = @client.get("/acs/systems/list", {connected_account_id: connected_account_id, customer_key: customer_key, search: search}.compact) Seam::Resources::AcsSystem.load_from_response(res.body["acs_systems"]) end @@ -36,7 +36,7 @@ def list(connected_account_id: nil, customer_key: nil, search: nil) # @param acs_system_id [String] ID of the access system for which you want to retrieve all compatible credential manager systems. # @return [Seam::Resources::AcsSystem] OK def list_compatible_credential_manager_acs_systems(acs_system_id:) - res = @client.post("/acs/systems/list_compatible_credential_manager_acs_systems", {acs_system_id: acs_system_id}.compact) + res = @client.get("/acs/systems/list_compatible_credential_manager_acs_systems", {acs_system_id: acs_system_id}.compact) Seam::Resources::AcsSystem.load_from_response(res.body["acs_systems"]) end diff --git a/lib/seam/routes/acs_users.rb b/lib/seam/routes/acs_users.rb index b68596a..a8d9f0b 100644 --- a/lib/seam/routes/acs_users.rb +++ b/lib/seam/routes/acs_users.rb @@ -13,7 +13,7 @@ def initialize(client:, defaults:) # @param acs_user_id [String] ID of the access system user that you want to add to an access group. # @return [nil] OK def add_to_access_group(acs_access_group_id:, acs_user_id:) - @client.post("/acs/users/add_to_access_group", {acs_access_group_id: acs_access_group_id, acs_user_id: acs_user_id}.compact) + @client.put("/acs/users/add_to_access_group", {acs_access_group_id: acs_access_group_id, acs_user_id: acs_user_id}.compact) nil end @@ -45,7 +45,7 @@ def delete(acs_system_id: nil, acs_user_id: nil, user_identity_id: nil) raise TypeError, "At least one parameter is required for /acs/users/delete" end - @client.post("/acs/users/delete", {acs_system_id: acs_system_id, acs_user_id: acs_user_id, user_identity_id: user_identity_id}.compact) + @client.delete("/acs/users/delete", {acs_system_id: acs_system_id, acs_user_id: acs_user_id, user_identity_id: user_identity_id}.compact) nil end @@ -60,7 +60,7 @@ def get(acs_user_id: nil, acs_system_id: nil, user_identity_id: nil) raise TypeError, "At least one parameter is required for /acs/users/get" end - res = @client.post("/acs/users/get", {acs_user_id: acs_user_id, acs_system_id: acs_system_id, user_identity_id: user_identity_id}.compact) + res = @client.get("/acs/users/get", {acs_user_id: acs_user_id, acs_system_id: acs_system_id, user_identity_id: user_identity_id}.compact) Seam::Resources::AcsUser.load_from_response(res.body["acs_user"]) end @@ -76,7 +76,7 @@ def get(acs_user_id: nil, acs_system_id: nil, user_identity_id: nil) # @param user_identity_phone_number [String, nil] Phone number of the user identity for which you want to retrieve all access system users, in [E.164 format](https://www.itu.int/rec/T-REC-E.164/en) (for example, `+15555550100`). # @return [Seam::Resources::AcsUser] OK def list(acs_system_id: nil, created_before: nil, limit: nil, page_cursor: nil, search: nil, user_identity_email_address: nil, user_identity_id: nil, user_identity_phone_number: nil) - res = @client.post("/acs/users/list", {acs_system_id: acs_system_id, created_before: created_before, limit: limit, page_cursor: page_cursor, search: search, user_identity_email_address: user_identity_email_address, user_identity_id: user_identity_id, user_identity_phone_number: user_identity_phone_number}.compact) + res = @client.get("/acs/users/list", {acs_system_id: acs_system_id, created_before: created_before, limit: limit, page_cursor: page_cursor, search: search, user_identity_email_address: user_identity_email_address, user_identity_id: user_identity_id, user_identity_phone_number: user_identity_phone_number}.compact) Seam::Resources::AcsUser.load_from_response(res.body["acs_users"]) end @@ -91,7 +91,7 @@ def list_accessible_entrances(acs_system_id: nil, acs_user_id: nil, user_identit raise TypeError, "At least one parameter is required for /acs/users/list_accessible_entrances" end - res = @client.post("/acs/users/list_accessible_entrances", {acs_system_id: acs_system_id, acs_user_id: acs_user_id, user_identity_id: user_identity_id}.compact) + res = @client.get("/acs/users/list_accessible_entrances", {acs_system_id: acs_system_id, acs_user_id: acs_user_id, user_identity_id: user_identity_id}.compact) Seam::Resources::AcsEntrance.load_from_response(res.body["acs_entrances"]) end @@ -102,7 +102,7 @@ def list_accessible_entrances(acs_system_id: nil, acs_user_id: nil, user_identit # @param user_identity_id [String, nil] ID of the user identity that you want to remove from an access group. You can only provide acs_user_id or user_identity_id. # @return [nil] OK def remove_from_access_group(acs_access_group_id:, acs_user_id: nil, user_identity_id: nil) - @client.post("/acs/users/remove_from_access_group", {acs_access_group_id: acs_access_group_id, acs_user_id: acs_user_id, user_identity_id: user_identity_id}.compact) + @client.delete("/acs/users/remove_from_access_group", {acs_access_group_id: acs_access_group_id, acs_user_id: acs_user_id, user_identity_id: user_identity_id}.compact) nil end @@ -169,7 +169,7 @@ def update(access_schedule: nil, acs_system_id: nil, acs_user_id: nil, email: ni raise TypeError, "At least one parameter is required for /acs/users/update" end - @client.post("/acs/users/update", {access_schedule: access_schedule, acs_system_id: acs_system_id, acs_user_id: acs_user_id, email: email, email_address: email_address, full_name: full_name, hid_acs_system_id: hid_acs_system_id, phone_number: phone_number, user_identity_id: user_identity_id}.compact) + @client.patch("/acs/users/update", {access_schedule: access_schedule, acs_system_id: acs_system_id, acs_user_id: acs_user_id, email: email, email_address: email_address, full_name: full_name, hid_acs_system_id: hid_acs_system_id, phone_number: phone_number, user_identity_id: user_identity_id}.compact) nil end diff --git a/lib/seam/routes/action_attempts.rb b/lib/seam/routes/action_attempts.rb index 881d594..31cc10d 100644 --- a/lib/seam/routes/action_attempts.rb +++ b/lib/seam/routes/action_attempts.rb @@ -14,7 +14,7 @@ def initialize(client:, defaults:) # @param action_attempt_id [String] ID of the action attempt that you want to get. # @return [Seam::Resources::ActionAttempt] OK def get(action_attempt_id:, wait_for_action_attempt: nil) - res = @client.post("/action_attempts/get", {action_attempt_id: action_attempt_id}.compact) + res = @client.get("/action_attempts/get", {action_attempt_id: action_attempt_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/client_sessions.rb b/lib/seam/routes/client_sessions.rb index c729514..177cb54 100644 --- a/lib/seam/routes/client_sessions.rb +++ b/lib/seam/routes/client_sessions.rb @@ -20,7 +20,7 @@ def initialize(client:, defaults:) # @deprecated user_identity_ids: Use `user_identity_id` instead. # @return [Seam::Resources::ClientSession] OK def create(connect_webview_ids: nil, connected_account_ids: nil, customer_id: nil, customer_key: nil, expires_at: nil, user_identifier_key: nil, user_identity_id: nil, user_identity_ids: nil) - res = @client.post("/client_sessions/create", {connect_webview_ids: connect_webview_ids, connected_account_ids: connected_account_ids, customer_id: customer_id, customer_key: customer_key, expires_at: expires_at, user_identifier_key: user_identifier_key, user_identity_id: user_identity_id, user_identity_ids: user_identity_ids}.compact) + res = @client.put("/client_sessions/create", {connect_webview_ids: connect_webview_ids, connected_account_ids: connected_account_ids, customer_id: customer_id, customer_key: customer_key, expires_at: expires_at, user_identifier_key: user_identifier_key, user_identity_id: user_identity_id, user_identity_ids: user_identity_ids}.compact) Seam::Resources::ClientSession.load_from_response(res.body["client_session"]) end @@ -29,7 +29,7 @@ def create(connect_webview_ids: nil, connected_account_ids: nil, customer_id: ni # @param client_session_id [String] ID of the client session that you want to delete. # @return [nil] OK def delete(client_session_id:) - @client.post("/client_sessions/delete", {client_session_id: client_session_id}.compact) + @client.delete("/client_sessions/delete", {client_session_id: client_session_id}.compact) nil end @@ -39,7 +39,7 @@ def delete(client_session_id:) # @param user_identifier_key [String, nil] User identifier key associated with the client session that you want to get. # @return [Seam::Resources::ClientSession] OK def get(client_session_id: nil, user_identifier_key: nil) - res = @client.post("/client_sessions/get", {client_session_id: client_session_id, user_identifier_key: user_identifier_key}.compact) + res = @client.get("/client_sessions/get", {client_session_id: client_session_id, user_identifier_key: user_identifier_key}.compact) Seam::Resources::ClientSession.load_from_response(res.body["client_session"]) end @@ -73,7 +73,7 @@ def grant_access(client_session_id: nil, connect_webview_ids: nil, connected_acc raise TypeError, "At least one parameter is required for /client_sessions/grant_access" end - @client.post("/client_sessions/grant_access", {client_session_id: client_session_id, connect_webview_ids: connect_webview_ids, connected_account_ids: connected_account_ids, user_identifier_key: user_identifier_key, user_identity_id: user_identity_id, user_identity_ids: user_identity_ids}.compact) + @client.patch("/client_sessions/grant_access", {client_session_id: client_session_id, connect_webview_ids: connect_webview_ids, connected_account_ids: connected_account_ids, user_identifier_key: user_identifier_key, user_identity_id: user_identity_id, user_identity_ids: user_identity_ids}.compact) nil end @@ -86,7 +86,7 @@ def grant_access(client_session_id: nil, connect_webview_ids: nil, connected_acc # @param without_user_identifier_key [Boolean, nil] Indicates whether to retrieve only client sessions without associated user identifier keys. # @return [Seam::Resources::ClientSession] OK def list(client_session_id: nil, connect_webview_id: nil, user_identifier_key: nil, user_identity_id: nil, without_user_identifier_key: nil) - res = @client.post("/client_sessions/list", {client_session_id: client_session_id, connect_webview_id: connect_webview_id, user_identifier_key: user_identifier_key, user_identity_id: user_identity_id, without_user_identifier_key: without_user_identifier_key}.compact) + res = @client.get("/client_sessions/list", {client_session_id: client_session_id, connect_webview_id: connect_webview_id, user_identifier_key: user_identifier_key, user_identity_id: user_identity_id, without_user_identifier_key: without_user_identifier_key}.compact) Seam::Resources::ClientSession.load_from_response(res.body["client_sessions"]) end diff --git a/lib/seam/routes/connect_webviews.rb b/lib/seam/routes/connect_webviews.rb index 5e079b5..cff03d2 100644 --- a/lib/seam/routes/connect_webviews.rb +++ b/lib/seam/routes/connect_webviews.rb @@ -38,7 +38,7 @@ def create(accepted_capabilities: nil, accepted_providers: nil, automatically_ma # @param connect_webview_id [String] ID of the Connect Webview that you want to delete. # @return [nil] OK def delete(connect_webview_id:) - @client.post("/connect_webviews/delete", {connect_webview_id: connect_webview_id}.compact) + @client.delete("/connect_webviews/delete", {connect_webview_id: connect_webview_id}.compact) nil end @@ -49,7 +49,7 @@ def delete(connect_webview_id:) # @param connect_webview_id [String] ID of the Connect Webview that you want to get. # @return [Seam::Resources::ConnectWebview] OK def get(connect_webview_id:) - res = @client.post("/connect_webviews/get", {connect_webview_id: connect_webview_id}.compact) + res = @client.get("/connect_webviews/get", {connect_webview_id: connect_webview_id}.compact) Seam::Resources::ConnectWebview.load_from_response(res.body["connect_webview"]) end diff --git a/lib/seam/routes/connected_accounts.rb b/lib/seam/routes/connected_accounts.rb index 5f52ae7..273256d 100644 --- a/lib/seam/routes/connected_accounts.rb +++ b/lib/seam/routes/connected_accounts.rb @@ -20,7 +20,7 @@ def simulate # @param connected_account_id [String] ID of the connected account that you want to delete. # @return [nil] OK def delete(connected_account_id:) - @client.post("/connected_accounts/delete", {connected_account_id: connected_account_id}.compact) + @client.delete("/connected_accounts/delete", {connected_account_id: connected_account_id}.compact) nil end @@ -34,7 +34,7 @@ def get(connected_account_id: nil, email: nil) raise TypeError, "At least one parameter is required for /connected_accounts/get" end - res = @client.post("/connected_accounts/get", {connected_account_id: connected_account_id, email: email}.compact) + res = @client.get("/connected_accounts/get", {connected_account_id: connected_account_id, email: email}.compact) Seam::Resources::ConnectedAccount.load_from_response(res.body["connected_account"]) end @@ -72,7 +72,7 @@ def sync(connected_account_id:) # @param display_name [String, nil] Human-readable name for the connected account, shown in the dashboard. For example, `Booking from Airbnb House 1`. # @return [nil] OK 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: connected_account_id, accepted_capabilities: accepted_capabilities, automatically_manage_new_devices: automatically_manage_new_devices, custom_metadata: custom_metadata, customer_key: customer_key, display_name: display_name}.compact) + @client.patch("/connected_accounts/update", {connected_account_id: connected_account_id, accepted_capabilities: accepted_capabilities, automatically_manage_new_devices: automatically_manage_new_devices, custom_metadata: custom_metadata, customer_key: customer_key, display_name: display_name}.compact) nil end diff --git a/lib/seam/routes/devices.rb b/lib/seam/routes/devices.rb index b3baf79..1d64d41 100644 --- a/lib/seam/routes/devices.rb +++ b/lib/seam/routes/devices.rb @@ -27,7 +27,7 @@ def get(device_id: nil, name: nil) raise TypeError, "At least one parameter is required for /devices/get" end - res = @client.post("/devices/get", {device_id: device_id, name: name}.compact) + res = @client.get("/devices/get", {device_id: device_id, name: name}.compact) Seam::Resources::Device.load_from_response(res.body["device"]) end @@ -65,7 +65,7 @@ def list(connect_webview_id: nil, connected_account_id: nil, connected_account_i # @param provider_category [String, nil] Category for which you want to list providers. # @return [Seam::Resources::DeviceProvider] OK def list_device_providers(provider_category: nil) - res = @client.post("/devices/list_device_providers", {provider_category: provider_category}.compact) + res = @client.get("/devices/list_device_providers", {provider_category: provider_category}.compact) Seam::Resources::DeviceProvider.load_from_response(res.body["device_providers"]) end @@ -90,7 +90,7 @@ def report_provider_metadata(devices:) # @param properties [Hash, nil] # @return [nil] OK def update(device_id:, backup_access_code_pool_enabled: nil, custom_metadata: nil, is_managed: nil, name: nil, properties: nil) - @client.post("/devices/update", {device_id: device_id, backup_access_code_pool_enabled: backup_access_code_pool_enabled, custom_metadata: custom_metadata, is_managed: is_managed, name: name, properties: properties}.compact) + @client.patch("/devices/update", {device_id: device_id, backup_access_code_pool_enabled: backup_access_code_pool_enabled, custom_metadata: custom_metadata, is_managed: is_managed, name: name, properties: properties}.compact) nil end diff --git a/lib/seam/routes/devices_unmanaged.rb b/lib/seam/routes/devices_unmanaged.rb index 752a5d5..8f61a77 100644 --- a/lib/seam/routes/devices_unmanaged.rb +++ b/lib/seam/routes/devices_unmanaged.rb @@ -21,7 +21,7 @@ def get(device_id: nil, name: nil) raise TypeError, "At least one parameter is required for /devices/unmanaged/get" end - res = @client.post("/devices/unmanaged/get", {device_id: device_id, name: name}.compact) + res = @client.get("/devices/unmanaged/get", {device_id: device_id, name: name}.compact) Seam::Resources::UnmanagedDevice.load_from_response(res.body["device"]) end @@ -56,7 +56,7 @@ def list(connect_webview_id: nil, connected_account_id: nil, connected_account_i # @param is_managed [Boolean, nil] Indicates whether the device is managed. Set this parameter to `true` to convert an unmanaged device to managed. # @return [nil] OK def update(device_id:, custom_metadata: nil, is_managed: nil) - @client.post("/devices/unmanaged/update", {device_id: device_id, custom_metadata: custom_metadata, is_managed: is_managed}.compact) + @client.patch("/devices/unmanaged/update", {device_id: device_id, custom_metadata: custom_metadata, is_managed: is_managed}.compact) nil end diff --git a/lib/seam/routes/events.rb b/lib/seam/routes/events.rb index 068e0cb..9c64c13 100644 --- a/lib/seam/routes/events.rb +++ b/lib/seam/routes/events.rb @@ -18,7 +18,7 @@ def get(event_id: nil, device_id: nil, event_type: nil) raise TypeError, "At least one parameter is required for /events/get" end - res = @client.post("/events/get", {event_id: event_id, device_id: device_id, event_type: event_type}.compact) + res = @client.get("/events/get", {event_id: event_id, device_id: device_id, event_type: event_type}.compact) Seam::Resources::SeamEvent.load_from_response(res.body["event"]) end diff --git a/lib/seam/routes/instant_keys.rb b/lib/seam/routes/instant_keys.rb index dc7c2a1..ade6b51 100644 --- a/lib/seam/routes/instant_keys.rb +++ b/lib/seam/routes/instant_keys.rb @@ -12,7 +12,7 @@ def initialize(client:, defaults:) # @param instant_key_id [String] ID of the Instant Key that you want to delete. # @return [nil] OK def delete(instant_key_id:) - @client.post("/instant_keys/delete", {instant_key_id: instant_key_id}.compact) + @client.delete("/instant_keys/delete", {instant_key_id: instant_key_id}.compact) nil end @@ -26,7 +26,7 @@ def get(instant_key_id: nil, instant_key_url: nil) raise TypeError, "At least one parameter is required for /instant_keys/get" end - res = @client.post("/instant_keys/get", {instant_key_id: instant_key_id, instant_key_url: instant_key_url}.compact) + res = @client.get("/instant_keys/get", {instant_key_id: instant_key_id, instant_key_url: instant_key_url}.compact) Seam::Resources::InstantKey.load_from_response(res.body["instant_key"]) end @@ -35,7 +35,7 @@ def get(instant_key_id: nil, instant_key_url: nil) # @param user_identity_id [String, nil] ID of the user identity by which you want to filter the list of Instant Keys. # @return [Seam::Resources::InstantKey] OK def list(user_identity_id: nil) - res = @client.post("/instant_keys/list", {user_identity_id: user_identity_id}.compact) + res = @client.get("/instant_keys/list", {user_identity_id: user_identity_id}.compact) Seam::Resources::InstantKey.load_from_response(res.body["instant_keys"]) end diff --git a/lib/seam/routes/locks.rb b/lib/seam/routes/locks.rb index 9eac657..8af05f4 100644 --- a/lib/seam/routes/locks.rb +++ b/lib/seam/routes/locks.rb @@ -37,7 +37,7 @@ def get(device_id: nil, name: nil) raise TypeError, "At least one parameter is required for /locks/get" end - res = @client.post("/locks/get", {device_id: device_id, name: name}.compact) + res = @client.get("/locks/get", {device_id: device_id, name: name}.compact) Seam::Resources::Device.load_from_response(res.body["device"]) end diff --git a/lib/seam/routes/noise_sensors_noise_thresholds.rb b/lib/seam/routes/noise_sensors_noise_thresholds.rb index 1ad4194..b74ce5c 100644 --- a/lib/seam/routes/noise_sensors_noise_thresholds.rb +++ b/lib/seam/routes/noise_sensors_noise_thresholds.rb @@ -27,7 +27,7 @@ def create(device_id:, ends_daily_at:, starts_daily_at:, name: nil, noise_thresh # @param noise_threshold_id [String] ID of the noise threshold that you want to delete. # @return [nil] OK def delete(device_id:, noise_threshold_id:) - @client.post("/noise_sensors/noise_thresholds/delete", {device_id: device_id, noise_threshold_id: noise_threshold_id}.compact) + @client.delete("/noise_sensors/noise_thresholds/delete", {device_id: device_id, noise_threshold_id: noise_threshold_id}.compact) nil end @@ -36,7 +36,7 @@ def delete(device_id:, noise_threshold_id:) # @param noise_threshold_id [String] ID of the noise threshold that you want to get. # @return [Seam::Resources::NoiseThreshold] OK def get(noise_threshold_id:) - res = @client.post("/noise_sensors/noise_thresholds/get", {noise_threshold_id: noise_threshold_id}.compact) + res = @client.get("/noise_sensors/noise_thresholds/get", {noise_threshold_id: noise_threshold_id}.compact) Seam::Resources::NoiseThreshold.load_from_response(res.body["noise_threshold"]) end @@ -45,7 +45,7 @@ def get(noise_threshold_id:) # @param device_id [String] ID of the device for which you want to list noise thresholds. # @return [Seam::Resources::NoiseThreshold] OK def list(device_id:) - res = @client.post("/noise_sensors/noise_thresholds/list", {device_id: device_id}.compact) + res = @client.get("/noise_sensors/noise_thresholds/list", {device_id: device_id}.compact) Seam::Resources::NoiseThreshold.load_from_response(res.body["noise_thresholds"]) end @@ -60,7 +60,7 @@ def list(device_id:) # @param starts_daily_at [String, nil] Time at which the noise threshold should become active daily. # @return [nil] OK def update(device_id:, noise_threshold_id:, ends_daily_at: nil, name: nil, noise_threshold_decibels: nil, noise_threshold_nrs: nil, starts_daily_at: nil) - @client.post("/noise_sensors/noise_thresholds/update", {device_id: device_id, noise_threshold_id: noise_threshold_id, ends_daily_at: ends_daily_at, name: name, noise_threshold_decibels: noise_threshold_decibels, noise_threshold_nrs: noise_threshold_nrs, starts_daily_at: starts_daily_at}.compact) + @client.put("/noise_sensors/noise_thresholds/update", {device_id: device_id, noise_threshold_id: noise_threshold_id, ends_daily_at: ends_daily_at, name: name, noise_threshold_decibels: noise_threshold_decibels, noise_threshold_nrs: noise_threshold_nrs, starts_daily_at: starts_daily_at}.compact) nil end diff --git a/lib/seam/routes/phones.rb b/lib/seam/routes/phones.rb index 3ac50a8..1f3ea4c 100644 --- a/lib/seam/routes/phones.rb +++ b/lib/seam/routes/phones.rb @@ -16,7 +16,7 @@ def simulate # @param device_id [String] Device ID of the phone that you want to deactivate. # @return [nil] OK def deactivate(device_id:) - @client.post("/phones/deactivate", {device_id: device_id}.compact) + @client.delete("/phones/deactivate", {device_id: device_id}.compact) nil end @@ -25,7 +25,7 @@ def deactivate(device_id:) # @param device_id [String] Device ID of the phone that you want to get. # @return [Seam::Resources::Phone] OK def get(device_id:) - res = @client.post("/phones/get", {device_id: device_id}.compact) + res = @client.get("/phones/get", {device_id: device_id}.compact) Seam::Resources::Phone.load_from_response(res.body["phone"]) end @@ -35,7 +35,7 @@ def get(device_id:) # @param owner_user_identity_id [String, nil] ID of the user identity that represents the owner by which you want to filter the list of returned phones. # @return [Seam::Resources::Phone] OK def list(acs_credential_id: nil, owner_user_identity_id: nil) - res = @client.post("/phones/list", {acs_credential_id: acs_credential_id, owner_user_identity_id: owner_user_identity_id}.compact) + res = @client.get("/phones/list", {acs_credential_id: acs_credential_id, owner_user_identity_id: owner_user_identity_id}.compact) Seam::Resources::Phone.load_from_response(res.body["phones"]) end diff --git a/lib/seam/routes/spaces.rb b/lib/seam/routes/spaces.rb index 1f35d1d..7f73e93 100644 --- a/lib/seam/routes/spaces.rb +++ b/lib/seam/routes/spaces.rb @@ -13,7 +13,7 @@ def initialize(client:, defaults:) # @param space_id [String] ID of the space to which you want to add entrances. # @return [nil] OK def add_acs_entrances(acs_entrance_ids:, space_id:) - @client.post("/spaces/add_acs_entrances", {acs_entrance_ids: acs_entrance_ids, space_id: space_id}.compact) + @client.put("/spaces/add_acs_entrances", {acs_entrance_ids: acs_entrance_ids, space_id: space_id}.compact) nil end @@ -23,7 +23,7 @@ def add_acs_entrances(acs_entrance_ids:, space_id:) # @param space_id [String] ID of the space to which you want to add the connected account. # @return [nil] OK def add_connected_account(connected_account_id:, space_id:) - @client.post("/spaces/add_connected_account", {connected_account_id: connected_account_id, space_id: space_id}.compact) + @client.put("/spaces/add_connected_account", {connected_account_id: connected_account_id, space_id: space_id}.compact) nil end @@ -33,7 +33,7 @@ def add_connected_account(connected_account_id:, space_id:) # @param space_id [String] ID of the space to which you want to add devices. # @return [nil] OK def add_devices(device_ids:, space_id:) - @client.post("/spaces/add_devices", {device_ids: device_ids, space_id: space_id}.compact) + @client.put("/spaces/add_devices", {device_ids: device_ids, space_id: space_id}.compact) nil end @@ -57,7 +57,7 @@ def create(name:, acs_entrance_ids: nil, connected_account_ids: nil, customer_da # @param space_id [String] ID of the space that you want to delete. # @return [nil] OK def delete(space_id:) - @client.post("/spaces/delete", {space_id: space_id}.compact) + @client.delete("/spaces/delete", {space_id: space_id}.compact) nil end @@ -71,7 +71,7 @@ def get(space_id: nil, space_key: nil) raise TypeError, "At least one parameter is required for /spaces/get" end - res = @client.post("/spaces/get", {space_id: space_id, space_key: space_key}.compact) + res = @client.get("/spaces/get", {space_id: space_id, space_key: space_key}.compact) Seam::Resources::Space.load_from_response(res.body["space"]) end @@ -100,7 +100,7 @@ def get_related(exclude: nil, include: nil, space_ids: nil, space_keys: nil) # @param space_key [String, nil] Filter spaces by space_key. # @return [Seam::Resources::Space] OK def list(customer_key: nil, limit: nil, page_cursor: nil, search: nil, space_key: nil) - res = @client.post("/spaces/list", {customer_key: customer_key, limit: limit, page_cursor: page_cursor, search: search, space_key: space_key}.compact) + res = @client.get("/spaces/list", {customer_key: customer_key, limit: limit, page_cursor: page_cursor, search: search, space_key: space_key}.compact) Seam::Resources::Space.load_from_response(res.body["spaces"]) end @@ -120,7 +120,7 @@ def remove_acs_entrances(acs_entrance_ids:, space_id:) # @param space_id [String] ID of the space from which you want to remove the connected account. # @return [nil] OK def remove_connected_account(connected_account_id:, space_id:) - @client.post("/spaces/remove_connected_account", {connected_account_id: connected_account_id, space_id: space_id}.compact) + @client.delete("/spaces/remove_connected_account", {connected_account_id: connected_account_id, space_id: space_id}.compact) nil end @@ -144,7 +144,7 @@ def remove_devices(device_ids:, space_id:) # @param space_key [String, nil] Unique key of the space that you want to update. # @return [Seam::Resources::Space] OK def update(acs_entrance_ids: nil, customer_data: nil, device_ids: nil, name: nil, space_id: nil, space_key: nil) - res = @client.post("/spaces/update", {acs_entrance_ids: acs_entrance_ids, customer_data: customer_data, device_ids: device_ids, name: name, space_id: space_id, space_key: space_key}.compact) + res = @client.patch("/spaces/update", {acs_entrance_ids: acs_entrance_ids, customer_data: customer_data, device_ids: device_ids, name: name, space_id: space_id, space_key: space_key}.compact) Seam::Resources::Space.load_from_response(res.body["space"]) end diff --git a/lib/seam/routes/thermostats.rb b/lib/seam/routes/thermostats.rb index d6fd8c3..89e77ae 100644 --- a/lib/seam/routes/thermostats.rb +++ b/lib/seam/routes/thermostats.rb @@ -73,7 +73,7 @@ def create_climate_preset(climate_preset_key:, device_id:, climate_preset_mode: # @param device_id [String] ID of the thermostat device for which you want to delete a climate preset. # @return [nil] OK def delete_climate_preset(climate_preset_key:, device_id:) - @client.post("/thermostats/delete_climate_preset", {climate_preset_key: climate_preset_key, device_id: device_id}.compact) + @client.delete("/thermostats/delete_climate_preset", {climate_preset_key: climate_preset_key, device_id: device_id}.compact) nil end @@ -179,7 +179,7 @@ def set_hvac_mode(device_id:, hvac_mode_setting:, cooling_set_point_celsius: nil # @param upper_limit_fahrenheit [Float, nil] Upper temperature limit in in °C. Seam alerts you if the reported temperature is higher than this value. You can specify either `upper_limit` but not both. # @return [nil] OK def set_temperature_threshold(device_id:, lower_limit_celsius: nil, lower_limit_fahrenheit: nil, upper_limit_celsius: nil, upper_limit_fahrenheit: nil) - @client.post("/thermostats/set_temperature_threshold", {device_id: device_id, lower_limit_celsius: lower_limit_celsius, lower_limit_fahrenheit: lower_limit_fahrenheit, upper_limit_celsius: upper_limit_celsius, upper_limit_fahrenheit: upper_limit_fahrenheit}.compact) + @client.patch("/thermostats/set_temperature_threshold", {device_id: device_id, lower_limit_celsius: lower_limit_celsius, lower_limit_fahrenheit: lower_limit_fahrenheit, upper_limit_celsius: upper_limit_celsius, upper_limit_fahrenheit: upper_limit_fahrenheit}.compact) nil end @@ -200,7 +200,7 @@ def set_temperature_threshold(device_id:, lower_limit_celsius: nil, lower_limit_ # @param name [String, nil] User-friendly name to identify the [climate preset](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-climate-presets). # @return [nil] OK def update_climate_preset(climate_preset_key:, device_id:, climate_preset_mode: nil, cooling_set_point_celsius: nil, cooling_set_point_fahrenheit: nil, ecobee_metadata: nil, fan_mode_setting: nil, heating_set_point_celsius: nil, heating_set_point_fahrenheit: nil, hvac_mode_setting: nil, manual_override_allowed: nil, name: nil) - @client.post("/thermostats/update_climate_preset", {climate_preset_key: climate_preset_key, device_id: device_id, climate_preset_mode: climate_preset_mode, cooling_set_point_celsius: cooling_set_point_celsius, cooling_set_point_fahrenheit: cooling_set_point_fahrenheit, ecobee_metadata: ecobee_metadata, fan_mode_setting: fan_mode_setting, heating_set_point_celsius: heating_set_point_celsius, heating_set_point_fahrenheit: heating_set_point_fahrenheit, hvac_mode_setting: hvac_mode_setting, manual_override_allowed: manual_override_allowed, name: name}.compact) + @client.patch("/thermostats/update_climate_preset", {climate_preset_key: climate_preset_key, device_id: device_id, climate_preset_mode: climate_preset_mode, cooling_set_point_celsius: cooling_set_point_celsius, cooling_set_point_fahrenheit: cooling_set_point_fahrenheit, ecobee_metadata: ecobee_metadata, fan_mode_setting: fan_mode_setting, heating_set_point_celsius: heating_set_point_celsius, heating_set_point_fahrenheit: heating_set_point_fahrenheit, hvac_mode_setting: hvac_mode_setting, manual_override_allowed: manual_override_allowed, name: name}.compact) nil end diff --git a/lib/seam/routes/thermostats_daily_programs.rb b/lib/seam/routes/thermostats_daily_programs.rb index f868979..681484b 100644 --- a/lib/seam/routes/thermostats_daily_programs.rb +++ b/lib/seam/routes/thermostats_daily_programs.rb @@ -25,7 +25,7 @@ def create(device_id:, name:, periods:) # @param thermostat_daily_program_id [String] ID of the thermostat daily program that you want to delete. # @return [nil] OK def delete(thermostat_daily_program_id:) - @client.post("/thermostats/daily_programs/delete", {thermostat_daily_program_id: thermostat_daily_program_id}.compact) + @client.delete("/thermostats/daily_programs/delete", {thermostat_daily_program_id: thermostat_daily_program_id}.compact) nil end @@ -36,7 +36,7 @@ def delete(thermostat_daily_program_id:) # @param thermostat_daily_program_id [String] ID of the thermostat daily program that you want to update. # @return [Seam::Resources::ActionAttempt] OK def update(name:, periods:, thermostat_daily_program_id:, wait_for_action_attempt: nil) - res = @client.post("/thermostats/daily_programs/update", {name: name, periods: periods, thermostat_daily_program_id: thermostat_daily_program_id}.compact) + res = @client.patch("/thermostats/daily_programs/update", {name: name, periods: periods, thermostat_daily_program_id: thermostat_daily_program_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/thermostats_schedules.rb b/lib/seam/routes/thermostats_schedules.rb index c1325aa..f808b67 100644 --- a/lib/seam/routes/thermostats_schedules.rb +++ b/lib/seam/routes/thermostats_schedules.rb @@ -27,7 +27,7 @@ def create(climate_preset_key:, device_id:, ends_at:, starts_at:, is_override_al # @param thermostat_schedule_id [String] ID of the thermostat schedule that you want to delete. # @return [nil] OK def delete(thermostat_schedule_id:) - @client.post("/thermostats/schedules/delete", {thermostat_schedule_id: thermostat_schedule_id}.compact) + @client.delete("/thermostats/schedules/delete", {thermostat_schedule_id: thermostat_schedule_id}.compact) nil end @@ -36,7 +36,7 @@ def delete(thermostat_schedule_id:) # @param thermostat_schedule_id [String] ID of the thermostat schedule that you want to get. # @return [Seam::Resources::ThermostatSchedule] OK def get(thermostat_schedule_id:) - res = @client.post("/thermostats/schedules/get", {thermostat_schedule_id: thermostat_schedule_id}.compact) + res = @client.get("/thermostats/schedules/get", {thermostat_schedule_id: thermostat_schedule_id}.compact) Seam::Resources::ThermostatSchedule.load_from_response(res.body["thermostat_schedule"]) end @@ -46,7 +46,7 @@ def get(thermostat_schedule_id:) # @param user_identifier_key [String, nil] User identifier key by which to filter the list of returned thermostat schedules. # @return [Seam::Resources::ThermostatSchedule] OK def list(device_id:, user_identifier_key: nil) - res = @client.post("/thermostats/schedules/list", {device_id: device_id, user_identifier_key: user_identifier_key}.compact) + res = @client.get("/thermostats/schedules/list", {device_id: device_id, user_identifier_key: user_identifier_key}.compact) Seam::Resources::ThermostatSchedule.load_from_response(res.body["thermostat_schedules"]) end @@ -61,7 +61,7 @@ def list(device_id:, user_identifier_key: nil) # @param starts_at [String, nil] Date and time at which the thermostat schedule starts, in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. # @return [nil] OK def update(thermostat_schedule_id:, climate_preset_key: nil, ends_at: nil, is_override_allowed: nil, max_override_period_minutes: nil, name: nil, starts_at: nil) - @client.post("/thermostats/schedules/update", {thermostat_schedule_id: thermostat_schedule_id, climate_preset_key: climate_preset_key, ends_at: ends_at, is_override_allowed: is_override_allowed, max_override_period_minutes: max_override_period_minutes, name: name, starts_at: starts_at}.compact) + @client.patch("/thermostats/schedules/update", {thermostat_schedule_id: thermostat_schedule_id, climate_preset_key: climate_preset_key, ends_at: ends_at, is_override_allowed: is_override_allowed, max_override_period_minutes: max_override_period_minutes, name: name, starts_at: starts_at}.compact) nil end diff --git a/lib/seam/routes/user_identities.rb b/lib/seam/routes/user_identities.rb index 46bae5f..e7d6f04 100644 --- a/lib/seam/routes/user_identities.rb +++ b/lib/seam/routes/user_identities.rb @@ -22,7 +22,7 @@ def unmanaged # @param user_identity_key [String, nil] Key of the user identity to which you want to add an access system user. # @return [nil] OK def add_acs_user(acs_user_id:, user_identity_id: nil, user_identity_key: nil) - @client.post("/user_identities/add_acs_user", {acs_user_id: acs_user_id, user_identity_id: user_identity_id, user_identity_key: user_identity_key}.compact) + @client.put("/user_identities/add_acs_user", {acs_user_id: acs_user_id, user_identity_id: user_identity_id, user_identity_key: user_identity_key}.compact) nil end @@ -44,7 +44,7 @@ def create(acs_system_ids: nil, email_address: nil, full_name: nil, phone_number # @param user_identity_id [String] ID of the user identity that you want to delete. # @return [nil] OK def delete(user_identity_id:) - @client.post("/user_identities/delete", {user_identity_id: user_identity_id}.compact) + @client.delete("/user_identities/delete", {user_identity_id: user_identity_id}.compact) nil end @@ -69,7 +69,7 @@ def get(user_identity_id: nil, user_identity_key: nil) raise TypeError, "At least one parameter is required for /user_identities/get" end - res = @client.post("/user_identities/get", {user_identity_id: user_identity_id, user_identity_key: user_identity_key}.compact) + res = @client.get("/user_identities/get", {user_identity_id: user_identity_id, user_identity_key: user_identity_key}.compact) Seam::Resources::UserIdentity.load_from_response(res.body["user_identity"]) end @@ -79,7 +79,7 @@ def get(user_identity_id: nil, user_identity_key: nil) # @param user_identity_id [String] ID of the user identity that you want to grant access to a device. # @return [nil] OK def grant_access_to_device(device_id:, user_identity_id:) - @client.post("/user_identities/grant_access_to_device", {device_id: device_id, user_identity_id: user_identity_id}.compact) + @client.put("/user_identities/grant_access_to_device", {device_id: device_id, user_identity_id: user_identity_id}.compact) nil end @@ -102,7 +102,7 @@ def list(created_before: nil, credential_manager_acs_system_id: nil, limit: nil, # @param user_identity_id [String] ID of the user identity for which you want to retrieve all accessible devices. # @return [Seam::Resources::Device] OK def list_accessible_devices(user_identity_id:) - res = @client.post("/user_identities/list_accessible_devices", {user_identity_id: user_identity_id}.compact) + res = @client.get("/user_identities/list_accessible_devices", {user_identity_id: user_identity_id}.compact) Seam::Resources::Device.load_from_response(res.body["devices"]) end @@ -111,7 +111,7 @@ def list_accessible_devices(user_identity_id:) # @param user_identity_id [String] ID of the user identity for which you want to retrieve all accessible entrances. # @return [Seam::Resources::AcsEntrance] OK def list_accessible_entrances(user_identity_id:) - res = @client.post("/user_identities/list_accessible_entrances", {user_identity_id: user_identity_id}.compact) + res = @client.get("/user_identities/list_accessible_entrances", {user_identity_id: user_identity_id}.compact) Seam::Resources::AcsEntrance.load_from_response(res.body["acs_entrances"]) end @@ -120,7 +120,7 @@ def list_accessible_entrances(user_identity_id:) # @param user_identity_id [String] ID of the user identity for which you want to retrieve all access systems. # @return [Seam::Resources::AcsSystem] OK def list_acs_systems(user_identity_id:) - res = @client.post("/user_identities/list_acs_systems", {user_identity_id: user_identity_id}.compact) + res = @client.get("/user_identities/list_acs_systems", {user_identity_id: user_identity_id}.compact) Seam::Resources::AcsSystem.load_from_response(res.body["acs_systems"]) end @@ -129,7 +129,7 @@ def list_acs_systems(user_identity_id:) # @param user_identity_id [String] ID of the user identity for which you want to retrieve all access system users. # @return [Seam::Resources::AcsUser] OK def list_acs_users(user_identity_id:) - res = @client.post("/user_identities/list_acs_users", {user_identity_id: user_identity_id}.compact) + res = @client.get("/user_identities/list_acs_users", {user_identity_id: user_identity_id}.compact) Seam::Resources::AcsUser.load_from_response(res.body["acs_users"]) end @@ -139,7 +139,7 @@ def list_acs_users(user_identity_id:) # @param user_identity_id [String] ID of the user identity from which you want to remove an access system user. # @return [nil] OK def remove_acs_user(acs_user_id:, user_identity_id:) - @client.post("/user_identities/remove_acs_user", {acs_user_id: acs_user_id, user_identity_id: user_identity_id}.compact) + @client.delete("/user_identities/remove_acs_user", {acs_user_id: acs_user_id, user_identity_id: user_identity_id}.compact) nil end @@ -149,7 +149,7 @@ def remove_acs_user(acs_user_id:, user_identity_id:) # @param user_identity_id [String] ID of the user identity from which you want to revoke access to a device. # @return [nil] OK def revoke_access_to_device(device_id:, user_identity_id:) - @client.post("/user_identities/revoke_access_to_device", {device_id: device_id, user_identity_id: user_identity_id}.compact) + @client.delete("/user_identities/revoke_access_to_device", {device_id: device_id, user_identity_id: user_identity_id}.compact) nil end @@ -162,7 +162,7 @@ def revoke_access_to_device(device_id:, user_identity_id:) # @param user_identity_key [String, nil] Unique key for the user identity. # @return [nil] OK def update(user_identity_id:, email_address: nil, full_name: nil, phone_number: nil, user_identity_key: nil) - @client.post("/user_identities/update", {user_identity_id: user_identity_id, email_address: email_address, full_name: full_name, phone_number: phone_number, user_identity_key: user_identity_key}.compact) + @client.patch("/user_identities/update", {user_identity_id: user_identity_id, email_address: email_address, full_name: full_name, phone_number: phone_number, user_identity_key: user_identity_key}.compact) nil end diff --git a/lib/seam/routes/user_identities_unmanaged.rb b/lib/seam/routes/user_identities_unmanaged.rb index 4f93dba..30f972c 100644 --- a/lib/seam/routes/user_identities_unmanaged.rb +++ b/lib/seam/routes/user_identities_unmanaged.rb @@ -12,7 +12,7 @@ def initialize(client:, defaults:) # @param user_identity_id [String] ID of the unmanaged user identity that you want to get. # @return [Seam::Resources::UnmanagedUserIdentity] OK def get(user_identity_id:) - res = @client.post("/user_identities/unmanaged/get", {user_identity_id: user_identity_id}.compact) + res = @client.get("/user_identities/unmanaged/get", {user_identity_id: user_identity_id}.compact) Seam::Resources::UnmanagedUserIdentity.load_from_response(res.body["user_identity"]) end @@ -24,7 +24,7 @@ def get(user_identity_id:) # @param search [String, nil] String for which to search. Filters returned unmanaged user identities to include all records that satisfy a partial match using `full_name`, `phone_number`, `email_address`, `user_identity_id` or `acs_system_id`. # @return [Seam::Resources::UnmanagedUserIdentity] OK def list(created_before: nil, limit: nil, page_cursor: nil, search: nil) - res = @client.post("/user_identities/unmanaged/list", {created_before: created_before, limit: limit, page_cursor: page_cursor, search: search}.compact) + res = @client.get("/user_identities/unmanaged/list", {created_before: created_before, limit: limit, page_cursor: page_cursor, search: search}.compact) Seam::Resources::UnmanagedUserIdentity.load_from_response(res.body["user_identities"]) end @@ -37,7 +37,7 @@ def list(created_before: nil, limit: nil, page_cursor: nil, search: nil) # @param user_identity_key [String, nil] Unique key for the user identity. If not provided, the existing key will be preserved. # @return [nil] OK def update(is_managed:, user_identity_id:, user_identity_key: nil) - @client.post("/user_identities/unmanaged/update", {is_managed: is_managed, user_identity_id: user_identity_id, user_identity_key: user_identity_key}.compact) + @client.patch("/user_identities/unmanaged/update", {is_managed: is_managed, user_identity_id: user_identity_id, user_identity_key: user_identity_key}.compact) nil end diff --git a/lib/seam/routes/webhooks.rb b/lib/seam/routes/webhooks.rb index e33e401..bf4a7e8 100644 --- a/lib/seam/routes/webhooks.rb +++ b/lib/seam/routes/webhooks.rb @@ -22,7 +22,7 @@ def create(url:, event_types: nil) # @param webhook_id [String] ID of the webhook that you want to delete. # @return [nil] OK def delete(webhook_id:) - @client.post("/webhooks/delete", {webhook_id: webhook_id}.compact) + @client.delete("/webhooks/delete", {webhook_id: webhook_id}.compact) nil end @@ -31,7 +31,7 @@ def delete(webhook_id:) # @param webhook_id [String] ID of the webhook that you want to get. # @return [Seam::Resources::Webhook] OK def get(webhook_id:) - res = @client.post("/webhooks/get", {webhook_id: webhook_id}.compact) + res = @client.get("/webhooks/get", {webhook_id: webhook_id}.compact) Seam::Resources::Webhook.load_from_response(res.body["webhook"]) end @@ -39,7 +39,7 @@ def get(webhook_id:) # Returns a list of all [webhooks](https://docs.seam.co/developer-tools/webhooks). # @return [Seam::Resources::Webhook] OK def list - res = @client.post("/webhooks/list") + res = @client.get("/webhooks/list") Seam::Resources::Webhook.load_from_response(res.body["webhooks"]) end @@ -49,7 +49,7 @@ def list # @param webhook_id [String] ID of the webhook that you want to update. # @return [nil] OK def update(event_types:, webhook_id:) - @client.post("/webhooks/update", {event_types: event_types, webhook_id: webhook_id}.compact) + @client.put("/webhooks/update", {event_types: event_types, webhook_id: webhook_id}.compact) nil end diff --git a/lib/seam/routes/workspaces.rb b/lib/seam/routes/workspaces.rb index ac42e0c..bf9badd 100644 --- a/lib/seam/routes/workspaces.rb +++ b/lib/seam/routes/workspaces.rb @@ -36,7 +36,7 @@ def create(name:, company_name: nil, connect_partner_name: nil, connect_webview_ # Returns the [workspace](https://docs.seam.co/core-concepts/workspaces) associated with the authentication value. # @return [Seam::Resources::Workspace] OK def get - res = @client.post("/workspaces/get") + res = @client.get("/workspaces/get") Seam::Resources::Workspace.load_from_response(res.body["workspace"]) end @@ -44,7 +44,7 @@ def get # Returns a list of [workspaces](https://docs.seam.co/core-concepts/workspaces) associated with the authentication value. # @return [Seam::Resources::Workspace] OK def list - res = @client.post("/workspaces/list") + res = @client.get("/workspaces/list") Seam::Resources::Workspace.load_from_response(res.body["workspaces"]) end @@ -68,7 +68,7 @@ def reset_sandbox(wait_for_action_attempt: nil) # @param organization_id [String, nil] ID of the organization to assign the workspace to. The authenticated user must be the owner of the workspace and an admin of the target organization. # @return [nil] OK def update(connect_partner_name: nil, connect_webview_customization: nil, is_publishable_key_auth_enabled: nil, is_suspended: nil, name: nil, organization_id: nil) - @client.post("/workspaces/update", {connect_partner_name: connect_partner_name, connect_webview_customization: connect_webview_customization, is_publishable_key_auth_enabled: is_publishable_key_auth_enabled, is_suspended: is_suspended, name: name, organization_id: organization_id}.compact) + @client.patch("/workspaces/update", {connect_partner_name: connect_partner_name, connect_webview_customization: connect_webview_customization, is_publishable_key_auth_enabled: is_publishable_key_auth_enabled, is_suspended: is_suspended, name: name, organization_id: organization_id}.compact) nil end diff --git a/spec/seam_client/headers_spec.rb b/spec/seam_client/headers_spec.rb index b4af067..48bf237 100644 --- a/spec/seam_client/headers_spec.rb +++ b/spec/seam_client/headers_spec.rb @@ -6,9 +6,8 @@ let(:device_id) { "device_id_1234" } it "sends the SDK and auth headers" do - stub = stub_request(:post, "#{Seam::DEFAULT_ENDPOINT}/devices/get") + stub = stub_request(:get, "#{Seam::DEFAULT_ENDPOINT}/devices/get?device_id=#{device_id}") .with( - body: {device_id: device_id}.to_json, headers: { "Authorization" => "Bearer seam_some_api_key", "Content-Type" => "application/json", @@ -31,7 +30,7 @@ end it "sends the workspace header with a personal access token" do - stub = stub_request(:post, "#{Seam::DEFAULT_ENDPOINT}/devices/get") + stub = stub_request(:get, "#{Seam::DEFAULT_ENDPOINT}/devices/get?device_id=#{device_id}") .with( headers: { "Authorization" => "Bearer seam_at_token",