diff --git a/lib/seam/routes/access_codes.rb b/lib/seam/routes/access_codes.rb index af12abb..97ff56a 100644 --- a/lib/seam/routes/access_codes.rb +++ b/lib/seam/routes/access_codes.rb @@ -138,7 +138,7 @@ def list(access_code_ids: nil, access_grant_id: nil, access_grant_key: nil, acce raise TypeError, "At least one parameter is required for /access_codes/list" end - res = @client.post("/access_codes/list", {access_code_ids: access_code_ids, access_grant_id: access_grant_id, access_grant_key: access_grant_key, access_method_id: access_method_id, customer_key: customer_key, device_id: device_id, limit: limit, page_cursor: page_cursor, search: search, user_identifier_key: user_identifier_key}.compact) + res = @client.get("/access_codes/list", {access_code_ids: access_code_ids, access_grant_id: access_grant_id, access_grant_key: access_grant_key, access_method_id: access_method_id, customer_key: customer_key, device_id: device_id, limit: limit, page_cursor: page_cursor, search: search, user_identifier_key: user_identifier_key}.compact) Seam::Resources::AccessCode.load_from_response(res.body["access_codes"]) end diff --git a/lib/seam/routes/access_grants.rb b/lib/seam/routes/access_grants.rb index fa2a51f..193ba42 100644 --- a/lib/seam/routes/access_grants.rb +++ b/lib/seam/routes/access_grants.rb @@ -71,7 +71,7 @@ def get_related(access_grant_ids: nil, access_grant_keys: nil, exclude: nil, inc raise TypeError, "At least one parameter is required for /access_grants/get_related" end - res = @client.post("/access_grants/get_related", {access_grant_ids: access_grant_ids, access_grant_keys: access_grant_keys, exclude: exclude, include: include}.compact) + res = @client.get("/access_grants/get_related", {access_grant_ids: access_grant_ids, access_grant_keys: access_grant_keys, exclude: exclude, include: include}.compact) Seam::Resources::Batch.load_from_response(res.body["batch"]) end @@ -93,7 +93,7 @@ def get_related(access_grant_ids: nil, access_grant_keys: nil, exclude: nil, inc # @param user_identity_id [String, nil] ID of user identity by which you want to filter the list of Access Grants. # @return [Seam::Resources::AccessGrant] OK def list(access_code_id: nil, access_grant_ids: nil, access_grant_key: nil, acs_entrance_id: nil, acs_system_id: nil, customer_key: nil, device_id: nil, limit: nil, location_id: nil, page_cursor: nil, reservation_key: nil, space_id: nil, user_identity_id: nil) - res = @client.post("/access_grants/list", {access_code_id: access_code_id, access_grant_ids: access_grant_ids, access_grant_key: access_grant_key, acs_entrance_id: acs_entrance_id, acs_system_id: acs_system_id, customer_key: customer_key, device_id: device_id, limit: limit, location_id: location_id, page_cursor: page_cursor, reservation_key: reservation_key, space_id: space_id, user_identity_id: user_identity_id}.compact) + res = @client.get("/access_grants/list", {access_code_id: access_code_id, access_grant_ids: access_grant_ids, access_grant_key: access_grant_key, acs_entrance_id: acs_entrance_id, acs_system_id: acs_system_id, customer_key: customer_key, device_id: device_id, limit: limit, location_id: location_id, page_cursor: page_cursor, reservation_key: reservation_key, space_id: space_id, user_identity_id: user_identity_id}.compact) Seam::Resources::AccessGrant.load_from_response(res.body["access_grants"]) end diff --git a/lib/seam/routes/access_methods.rb b/lib/seam/routes/access_methods.rb index 70aed3a..26cc27e 100644 --- a/lib/seam/routes/access_methods.rb +++ b/lib/seam/routes/access_methods.rb @@ -68,7 +68,7 @@ def get(access_method_id:) # @param include [Array, nil] # @return [Seam::Resources::Batch] OK def get_related(access_method_ids:, exclude: nil, include: nil) - res = @client.post("/access_methods/get_related", {access_method_ids: access_method_ids, exclude: exclude, include: include}.compact) + res = @client.get("/access_methods/get_related", {access_method_ids: access_method_ids, exclude: exclude, include: include}.compact) Seam::Resources::Batch.load_from_response(res.body["batch"]) end diff --git a/lib/seam/routes/acs_encoders.rb b/lib/seam/routes/acs_encoders.rb index 74c2bff..00ecaad 100644 --- a/lib/seam/routes/acs_encoders.rb +++ b/lib/seam/routes/acs_encoders.rb @@ -44,7 +44,7 @@ def get(acs_encoder_id:) # @param page_cursor [String, Seam::Null, nil] Identifies the specific page of results to return, obtained from the previous page's `next_page_cursor`. # @return [Seam::Resources::AcsEncoder] OK def list(acs_system_id: nil, acs_system_ids: nil, acs_encoder_ids: nil, limit: nil, page_cursor: nil) - res = @client.post("/acs/encoders/list", {acs_system_id: acs_system_id, acs_system_ids: acs_system_ids, acs_encoder_ids: acs_encoder_ids, limit: limit, page_cursor: page_cursor}.compact) + res = @client.get("/acs/encoders/list", {acs_system_id: acs_system_id, acs_system_ids: acs_system_ids, acs_encoder_ids: acs_encoder_ids, limit: limit, page_cursor: page_cursor}.compact) Seam::Resources::AcsEncoder.load_from_response(res.body["acs_encoders"]) end diff --git a/lib/seam/routes/acs_entrances.rb b/lib/seam/routes/acs_entrances.rb index 8079678..71309c8 100644 --- a/lib/seam/routes/acs_entrances.rb +++ b/lib/seam/routes/acs_entrances.rb @@ -45,7 +45,7 @@ def grant_access(acs_entrance_id:, acs_user_id: nil, user_identity_id: nil) # @param space_id [String, nil] ID of the space for which you want to list entrances. # @return [Seam::Resources::AcsEntrance] OK def list(access_method_id: nil, acs_credential_id: nil, acs_entrance_ids: nil, acs_system_id: nil, connected_account_id: nil, customer_key: nil, limit: nil, location_id: nil, page_cursor: nil, search: nil, space_id: nil) - res = @client.post("/acs/entrances/list", {access_method_id: access_method_id, acs_credential_id: acs_credential_id, acs_entrance_ids: acs_entrance_ids, acs_system_id: acs_system_id, connected_account_id: connected_account_id, customer_key: customer_key, limit: limit, location_id: location_id, page_cursor: page_cursor, search: search, space_id: space_id}.compact) + res = @client.get("/acs/entrances/list", {access_method_id: access_method_id, acs_credential_id: acs_credential_id, acs_entrance_ids: acs_entrance_ids, acs_system_id: acs_system_id, connected_account_id: connected_account_id, customer_key: customer_key, limit: limit, location_id: location_id, page_cursor: page_cursor, search: search, space_id: space_id}.compact) Seam::Resources::AcsEntrance.load_from_response(res.body["acs_entrances"]) end @@ -55,7 +55,7 @@ def list(access_method_id: nil, acs_credential_id: nil, acs_entrance_ids: nil, a # @param include_if [Array, nil] Conditions that credentials must meet to be included in the returned list. # @return [Seam::Resources::AcsCredential] OK def list_credentials_with_access(acs_entrance_id:, include_if: nil) - res = @client.post("/acs/entrances/list_credentials_with_access", {acs_entrance_id: acs_entrance_id, include_if: include_if}.compact) + res = @client.get("/acs/entrances/list_credentials_with_access", {acs_entrance_id: acs_entrance_id, include_if: include_if}.compact) Seam::Resources::AcsCredential.load_from_response(res.body["acs_credentials"]) end diff --git a/lib/seam/routes/action_attempts.rb b/lib/seam/routes/action_attempts.rb index ce434c3..4037c41 100644 --- a/lib/seam/routes/action_attempts.rb +++ b/lib/seam/routes/action_attempts.rb @@ -28,7 +28,7 @@ def get(action_attempt_id:, wait_for_action_attempt: nil) # @param page_cursor [String, Seam::Null, nil] Identifies the specific page of results to return, obtained from the previous page's `next_page_cursor`. # @return [Seam::Resources::ActionAttempt] OK def list(action_attempt_ids: nil, device_id: nil, limit: nil, page_cursor: nil) - res = @client.post("/action_attempts/list", {action_attempt_ids: action_attempt_ids, device_id: device_id, limit: limit, page_cursor: page_cursor}.compact) + res = @client.get("/action_attempts/list", {action_attempt_ids: action_attempt_ids, device_id: device_id, limit: limit, page_cursor: page_cursor}.compact) Seam::Resources::ActionAttempt.load_from_response(res.body["action_attempts"]) end diff --git a/lib/seam/routes/connect_webviews.rb b/lib/seam/routes/connect_webviews.rb index 3b90b1b..3f22f0c 100644 --- a/lib/seam/routes/connect_webviews.rb +++ b/lib/seam/routes/connect_webviews.rb @@ -63,7 +63,7 @@ def get(connect_webview_id:) # @param user_identifier_key [String, nil] Your user ID for the user by which you want to filter Connect Webviews. # @return [Seam::Resources::ConnectWebview] OK def list(custom_metadata_has: nil, customer_key: nil, limit: nil, page_cursor: nil, search: nil, user_identifier_key: nil) - res = @client.post("/connect_webviews/list", {custom_metadata_has: custom_metadata_has, customer_key: customer_key, limit: limit, page_cursor: page_cursor, search: search, user_identifier_key: user_identifier_key}.compact) + res = @client.get("/connect_webviews/list", {custom_metadata_has: custom_metadata_has, customer_key: customer_key, limit: limit, page_cursor: page_cursor, search: search, user_identifier_key: user_identifier_key}.compact) Seam::Resources::ConnectWebview.load_from_response(res.body["connect_webviews"]) end diff --git a/lib/seam/routes/connected_accounts.rb b/lib/seam/routes/connected_accounts.rb index 7bb1bdc..ccfe407 100644 --- a/lib/seam/routes/connected_accounts.rb +++ b/lib/seam/routes/connected_accounts.rb @@ -49,7 +49,7 @@ def get(connected_account_id: nil, email: nil) # @param user_identifier_key [String, nil] Your user ID for the user by which you want to filter connected accounts. # @return [Seam::Resources::ConnectedAccount] OK def list(custom_metadata_has: nil, customer_key: nil, limit: nil, page_cursor: nil, search: nil, space_id: nil, user_identifier_key: nil) - res = @client.post("/connected_accounts/list", {custom_metadata_has: custom_metadata_has, customer_key: customer_key, limit: limit, page_cursor: page_cursor, search: search, space_id: space_id, user_identifier_key: user_identifier_key}.compact) + res = @client.get("/connected_accounts/list", {custom_metadata_has: custom_metadata_has, customer_key: customer_key, limit: limit, page_cursor: page_cursor, search: search, space_id: space_id, user_identifier_key: user_identifier_key}.compact) Seam::Resources::ConnectedAccount.load_from_response(res.body["connected_accounts"]) end diff --git a/lib/seam/routes/customers.rb b/lib/seam/routes/customers.rb index 502533c..32c2e1a 100644 --- a/lib/seam/routes/customers.rb +++ b/lib/seam/routes/customers.rb @@ -50,7 +50,7 @@ def create_portal(customer_resources_filters: nil, customization_profile_id: nil # @param user_keys [Array, nil] List of user keys to delete. # @return [nil] OK def delete_data(access_grant_keys: nil, booking_keys: nil, building_keys: nil, common_area_keys: nil, customer_keys: nil, facility_keys: nil, guest_keys: nil, listing_keys: nil, property_keys: nil, property_listing_keys: nil, reservation_keys: nil, resident_keys: nil, room_keys: nil, space_keys: nil, staff_member_keys: nil, tenant_keys: nil, unit_keys: nil, user_identity_keys: nil, user_keys: nil) - @client.post("/customers/delete_data", {access_grant_keys: access_grant_keys, booking_keys: booking_keys, building_keys: building_keys, common_area_keys: common_area_keys, customer_keys: customer_keys, facility_keys: facility_keys, guest_keys: guest_keys, listing_keys: listing_keys, property_keys: property_keys, property_listing_keys: property_listing_keys, reservation_keys: reservation_keys, resident_keys: resident_keys, room_keys: room_keys, space_keys: space_keys, staff_member_keys: staff_member_keys, tenant_keys: tenant_keys, unit_keys: unit_keys, user_identity_keys: user_identity_keys, user_keys: user_keys}.compact) + @client.delete("/customers/delete_data", {access_grant_keys: access_grant_keys, booking_keys: booking_keys, building_keys: building_keys, common_area_keys: common_area_keys, customer_keys: customer_keys, facility_keys: facility_keys, guest_keys: guest_keys, listing_keys: listing_keys, property_keys: property_keys, property_listing_keys: property_listing_keys, reservation_keys: reservation_keys, resident_keys: resident_keys, room_keys: room_keys, space_keys: space_keys, staff_member_keys: staff_member_keys, tenant_keys: tenant_keys, unit_keys: unit_keys, user_identity_keys: user_identity_keys, user_keys: user_keys}.compact) nil end diff --git a/lib/seam/routes/devices.rb b/lib/seam/routes/devices.rb index ae3abd6..9248a15 100644 --- a/lib/seam/routes/devices.rb +++ b/lib/seam/routes/devices.rb @@ -52,7 +52,7 @@ def get(device_id: nil, name: nil) # @param user_identifier_key [String, nil] Your own internal user ID for the user for which you want to list devices. # @return [Seam::Resources::Device] OK def list(connect_webview_id: nil, connected_account_id: nil, connected_account_ids: nil, created_before: nil, custom_metadata_has: nil, customer_key: nil, device_ids: nil, device_type: nil, device_types: nil, limit: nil, manufacturer: nil, page_cursor: nil, search: nil, space_id: nil, unstable_location_id: nil, user_identifier_key: nil) - res = @client.post("/devices/list", {connect_webview_id: connect_webview_id, connected_account_id: connected_account_id, connected_account_ids: connected_account_ids, created_before: created_before, custom_metadata_has: custom_metadata_has, customer_key: customer_key, device_ids: device_ids, device_type: device_type, device_types: device_types, limit: limit, manufacturer: manufacturer, page_cursor: page_cursor, search: search, space_id: space_id, unstable_location_id: unstable_location_id, user_identifier_key: user_identifier_key}.compact) + res = @client.get("/devices/list", {connect_webview_id: connect_webview_id, connected_account_id: connected_account_id, connected_account_ids: connected_account_ids, created_before: created_before, custom_metadata_has: custom_metadata_has, customer_key: customer_key, device_ids: device_ids, device_type: device_type, device_types: device_types, limit: limit, manufacturer: manufacturer, page_cursor: page_cursor, search: search, space_id: space_id, unstable_location_id: unstable_location_id, user_identifier_key: user_identifier_key}.compact) Seam::Resources::Device.load_from_response(res.body["devices"]) end diff --git a/lib/seam/routes/devices_unmanaged.rb b/lib/seam/routes/devices_unmanaged.rb index 85e35ce..a960905 100644 --- a/lib/seam/routes/devices_unmanaged.rb +++ b/lib/seam/routes/devices_unmanaged.rb @@ -43,7 +43,7 @@ def get(device_id: nil, name: nil) # @param search [String, nil] String for which to search. Filters returned devices to include all records that satisfy a partial match using `device_id` (full or partial UUID prefix, minimum 4 characters), `connected_account_id`, `display_name`, `custom_metadata` or `location.location_name`. # @return [Seam::Resources::UnmanagedDevice] OK def list(connect_webview_id: nil, connected_account_id: nil, connected_account_ids: nil, created_before: nil, customer_key: nil, device_ids: nil, device_type: nil, device_types: nil, limit: nil, manufacturer: nil, page_cursor: nil, search: nil) - res = @client.post("/devices/unmanaged/list", {connect_webview_id: connect_webview_id, connected_account_id: connected_account_id, connected_account_ids: connected_account_ids, created_before: created_before, customer_key: customer_key, device_ids: device_ids, device_type: device_type, device_types: device_types, limit: limit, manufacturer: manufacturer, page_cursor: page_cursor, search: search}.compact) + res = @client.get("/devices/unmanaged/list", {connect_webview_id: connect_webview_id, connected_account_id: connected_account_id, connected_account_ids: connected_account_ids, created_before: created_before, customer_key: customer_key, device_ids: device_ids, device_type: device_type, device_types: device_types, limit: limit, manufacturer: manufacturer, page_cursor: page_cursor, search: search}.compact) Seam::Resources::UnmanagedDevice.load_from_response(res.body["devices"]) end diff --git a/lib/seam/routes/events.rb b/lib/seam/routes/events.rb index 9c64c13..714b4f2 100644 --- a/lib/seam/routes/events.rb +++ b/lib/seam/routes/events.rb @@ -58,7 +58,7 @@ def list(access_code_id: nil, access_code_ids: nil, access_grant_id: nil, access raise TypeError, "At least one parameter is required for /events/list" end - res = @client.post("/events/list", {access_code_id: access_code_id, access_code_ids: access_code_ids, access_grant_id: access_grant_id, access_grant_ids: access_grant_ids, access_method_id: access_method_id, access_method_ids: access_method_ids, acs_access_group_id: acs_access_group_id, acs_credential_id: acs_credential_id, acs_encoder_id: acs_encoder_id, acs_entrance_id: acs_entrance_id, acs_system_id: acs_system_id, acs_system_ids: acs_system_ids, acs_user_id: acs_user_id, between: between, connect_webview_id: connect_webview_id, connected_account_id: connected_account_id, customer_key: customer_key, device_id: device_id, device_ids: device_ids, event_ids: event_ids, event_type: event_type, event_types: event_types, limit: limit, since: since, space_id: space_id, space_ids: space_ids, unstable_offset: unstable_offset, user_identity_id: user_identity_id}.compact) + res = @client.get("/events/list", {access_code_id: access_code_id, access_code_ids: access_code_ids, access_grant_id: access_grant_id, access_grant_ids: access_grant_ids, access_method_id: access_method_id, access_method_ids: access_method_ids, acs_access_group_id: acs_access_group_id, acs_credential_id: acs_credential_id, acs_encoder_id: acs_encoder_id, acs_entrance_id: acs_entrance_id, acs_system_id: acs_system_id, acs_system_ids: acs_system_ids, acs_user_id: acs_user_id, between: between, connect_webview_id: connect_webview_id, connected_account_id: connected_account_id, customer_key: customer_key, device_id: device_id, device_ids: device_ids, event_ids: event_ids, event_type: event_type, event_types: event_types, limit: limit, since: since, space_id: space_id, space_ids: space_ids, unstable_offset: unstable_offset, user_identity_id: user_identity_id}.compact) Seam::Resources::SeamEvent.load_from_response(res.body["events"]) end diff --git a/lib/seam/routes/locks.rb b/lib/seam/routes/locks.rb index bbb890e..e81bb50 100644 --- a/lib/seam/routes/locks.rb +++ b/lib/seam/routes/locks.rb @@ -51,7 +51,7 @@ def get(device_id: nil, name: nil) # @param manufacturer [String, nil] Manufacturer of the locks that you want to list. # @return [Seam::Resources::Device] OK def list(connect_webview_id: nil, connected_account_id: nil, customer_key: nil, device_type: nil, device_types: nil, manufacturer: nil) - res = @client.post("/locks/list", {connect_webview_id: connect_webview_id, connected_account_id: connected_account_id, customer_key: customer_key, device_type: device_type, device_types: device_types, manufacturer: manufacturer}.compact) + res = @client.get("/locks/list", {connect_webview_id: connect_webview_id, connected_account_id: connected_account_id, customer_key: customer_key, device_type: device_type, device_types: device_types, manufacturer: manufacturer}.compact) Seam::Resources::Device.load_from_response(res.body["devices"]) end diff --git a/lib/seam/routes/noise_sensors.rb b/lib/seam/routes/noise_sensors.rb index 16f33ed..21a3f9f 100644 --- a/lib/seam/routes/noise_sensors.rb +++ b/lib/seam/routes/noise_sensors.rb @@ -25,7 +25,7 @@ def simulate # @param manufacturer [String, nil] Manufacturers of the noise sensors that you want to list. # @return [Seam::Resources::Device] OK def list(connect_webview_id: nil, connected_account_id: nil, customer_key: nil, device_type: nil, device_types: nil, manufacturer: nil) - res = @client.post("/noise_sensors/list", {connect_webview_id: connect_webview_id, connected_account_id: connected_account_id, customer_key: customer_key, device_type: device_type, device_types: device_types, manufacturer: manufacturer}.compact) + res = @client.get("/noise_sensors/list", {connect_webview_id: connect_webview_id, connected_account_id: connected_account_id, customer_key: customer_key, device_type: device_type, device_types: device_types, manufacturer: manufacturer}.compact) Seam::Resources::Device.load_from_response(res.body["devices"]) end diff --git a/lib/seam/routes/spaces.rb b/lib/seam/routes/spaces.rb index c362696..9992b7e 100644 --- a/lib/seam/routes/spaces.rb +++ b/lib/seam/routes/spaces.rb @@ -87,7 +87,7 @@ def get_related(exclude: nil, include: nil, space_ids: nil, space_keys: nil) raise TypeError, "At least one parameter is required for /spaces/get_related" end - res = @client.post("/spaces/get_related", {exclude: exclude, include: include, space_ids: space_ids, space_keys: space_keys}.compact) + res = @client.get("/spaces/get_related", {exclude: exclude, include: include, space_ids: space_ids, space_keys: space_keys}.compact) Seam::Resources::Batch.load_from_response(res.body["batch"]) end @@ -110,7 +110,7 @@ def list(customer_key: nil, limit: nil, page_cursor: nil, search: nil, space_key # @param space_id [String] ID of the space from which you want to remove entrances. # @return [nil] OK def remove_acs_entrances(acs_entrance_ids:, space_id:) - @client.post("/spaces/remove_acs_entrances", {acs_entrance_ids: acs_entrance_ids, space_id: space_id}.compact) + @client.delete("/spaces/remove_acs_entrances", {acs_entrance_ids: acs_entrance_ids, space_id: space_id}.compact) nil end @@ -130,7 +130,7 @@ def remove_connected_account(connected_account_id:, space_id:) # @param space_id [String] ID of the space from which you want to remove devices. # @return [nil] OK def remove_devices(device_ids:, space_id:) - @client.post("/spaces/remove_devices", {device_ids: device_ids, space_id: space_id}.compact) + @client.delete("/spaces/remove_devices", {device_ids: device_ids, space_id: space_id}.compact) nil end diff --git a/lib/seam/routes/thermostats.rb b/lib/seam/routes/thermostats.rb index 916c3de..b7ec061 100644 --- a/lib/seam/routes/thermostats.rb +++ b/lib/seam/routes/thermostats.rb @@ -115,7 +115,7 @@ def heat_cool(device_id:, cooling_set_point_celsius: nil, cooling_set_point_fahr # @param manufacturer [String, nil] Manufacturer by which you want to filter thermostat devices. # @return [Seam::Resources::Device] OK def list(connect_webview_id: nil, connected_account_id: nil, customer_key: nil, device_type: nil, device_types: nil, manufacturer: nil) - res = @client.post("/thermostats/list", {connect_webview_id: connect_webview_id, connected_account_id: connected_account_id, customer_key: customer_key, device_type: device_type, device_types: device_types, manufacturer: manufacturer}.compact) + res = @client.get("/thermostats/list", {connect_webview_id: connect_webview_id, connected_account_id: connected_account_id, customer_key: customer_key, device_type: device_type, device_types: device_types, manufacturer: manufacturer}.compact) Seam::Resources::Device.load_from_response(res.body["devices"]) end diff --git a/lib/seam/routes/user_identities.rb b/lib/seam/routes/user_identities.rb index dc96178..69f130b 100644 --- a/lib/seam/routes/user_identities.rb +++ b/lib/seam/routes/user_identities.rb @@ -93,7 +93,7 @@ def grant_access_to_device(device_id:, user_identity_id:) # @param user_identity_ids [Array, nil] Array of user identity IDs by which to filter the list of user identities. # @return [Seam::Resources::UserIdentity] OK def list(created_before: nil, credential_manager_acs_system_id: nil, limit: nil, page_cursor: nil, search: nil, user_identity_ids: nil) - res = @client.post("/user_identities/list", {created_before: created_before, credential_manager_acs_system_id: credential_manager_acs_system_id, limit: limit, page_cursor: page_cursor, search: search, user_identity_ids: user_identity_ids}.compact) + res = @client.get("/user_identities/list", {created_before: created_before, credential_manager_acs_system_id: credential_manager_acs_system_id, limit: limit, page_cursor: page_cursor, search: search, user_identity_ids: user_identity_ids}.compact) Seam::Resources::UserIdentity.load_from_response(res.body["user_identities"]) end diff --git a/package-lock.json b/package-lock.json index f63906f..e8c43ab 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,7 +6,7 @@ "": { "name": "@seamapi/ruby", "devDependencies": { - "@seamapi/blueprint": "^1.7.0", + "@seamapi/blueprint": "^1.8.0", "@seamapi/fake-seam-connect": "2.0.4", "@seamapi/smith": "^1.1.0", "@seamapi/types": "1.1001.0", @@ -788,9 +788,9 @@ "license": "MIT" }, "node_modules/@seamapi/blueprint": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/@seamapi/blueprint/-/blueprint-1.7.0.tgz", - "integrity": "sha512-on9pREQKyFgIaS99KLcck5K6AqLEO8Iy5h1heuJ2sEC2A7wXk5s/TL8iDOB3+4eeaAwuHRPgze9/Omo84KjJkw==", + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@seamapi/blueprint/-/blueprint-1.8.0.tgz", + "integrity": "sha512-NUghBmYaKreBeBxwPIB2O9hjIFZtEjVj73tAsuKdJR8t4BxlKK1I0XDQXxo3ZsH2QezNlbdo9/0MoX/33VXuhQ==", "dev": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index 0e15ed5..c606964 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ } }, "devDependencies": { - "@seamapi/blueprint": "^1.7.0", + "@seamapi/blueprint": "^1.8.0", "@seamapi/fake-seam-connect": "2.0.4", "@seamapi/smith": "^1.1.0", "@seamapi/types": "1.1001.0", diff --git a/spec/seam_client/malformed_response_spec.rb b/spec/seam_client/malformed_response_spec.rb index 86f6987..aea93b8 100644 --- a/spec/seam_client/malformed_response_spec.rb +++ b/spec/seam_client/malformed_response_spec.rb @@ -9,7 +9,7 @@ describe "non-Seam error responses" do it "raises a Faraday error for a plain text response" do - stub_request(:post, url).to_return( + stub_request(:get, url).to_return( status: 500, body: "Internal Server Error", headers: {"Content-Type" => "text/plain"} @@ -19,7 +19,7 @@ end it "raises a Faraday error for malformed JSON" do - stub_request(:post, url).to_return( + stub_request(:get, url).to_return( status: 500, body: "{invalid json", headers: {"Content-Type" => "application/json"} @@ -29,7 +29,7 @@ end it "raises a Faraday error for JSON without an error object" do - stub_request(:post, url).to_return( + stub_request(:get, url).to_return( status: 500, body: {message: "Some error"}.to_json, headers: {"Content-Type" => "application/json"} @@ -39,7 +39,7 @@ end it "raises a Faraday error for an error object without a type and message" do - stub_request(:post, url).to_return( + stub_request(:get, url).to_return( status: 500, body: {error: {code: 500}}.to_json, headers: {"Content-Type" => "application/json"} diff --git a/spec/seam_client/retry_spec.rb b/spec/seam_client/retry_spec.rb index 731471c..a1dd7a8 100644 --- a/spec/seam_client/retry_spec.rb +++ b/spec/seam_client/retry_spec.rb @@ -23,42 +23,42 @@ def devices # keeps a simulated outage in place for every request. describe "faraday_retry_options" do it "retries until the request succeeds" do - stub_request(:post, url) + stub_request(:get, url) .to_return(service_unavailable) .to_return(service_unavailable) .to_return(devices) seam = Seam.new( api_key: "seam_some_api_key", - faraday_retry_options: {max: 3, interval: 0, methods: %i[post], retry_statuses: [503]} + faraday_retry_options: {max: 3, interval: 0, methods: %i[get], retry_statuses: [503]} ) expect(seam.devices.list).to eq([]) - expect(a_request(:post, url)).to have_been_made.times(3) + expect(a_request(:get, url)).to have_been_made.times(3) end it "gives up once the retries are exhausted" do - stub_request(:post, url).to_return(service_unavailable) + stub_request(:get, url).to_return(service_unavailable) seam = Seam.new( api_key: "seam_some_api_key", - faraday_retry_options: {max: 2, interval: 0, methods: %i[post], retry_statuses: [503]} + faraday_retry_options: {max: 2, interval: 0, methods: %i[get], retry_statuses: [503]} ) expect { seam.devices.list }.to raise_error(Seam::Http::ApiError) - expect(a_request(:post, url)).to have_been_made.times(3) + expect(a_request(:get, url)).to have_been_made.times(3) end it "does not retry when max is zero" do - stub_request(:post, url).to_return(service_unavailable) + stub_request(:get, url).to_return(service_unavailable) seam = Seam.new( api_key: "seam_some_api_key", - faraday_retry_options: {max: 0, interval: 0, methods: %i[post], retry_statuses: [503]} + faraday_retry_options: {max: 0, interval: 0, methods: %i[get], retry_statuses: [503]} ) expect { seam.devices.list }.to raise_error(Seam::Http::ApiError) - expect(a_request(:post, url)).to have_been_made.times(1) + expect(a_request(:get, url)).to have_been_made.times(1) end it "does not retry POST requests by default" do @@ -66,24 +66,22 @@ def devices seam = Seam.new(api_key: "seam_some_api_key", faraday_retry_options: {interval: 0}) - expect { seam.devices.list }.to raise_error(Seam::Http::ApiError) + expect { seam.client.post("/devices/list") }.to raise_error(Seam::Http::ApiError) expect(a_request(:post, url)).to have_been_made.times(1) end it "retries retryable responses for idempotent methods by default" do - # TODO: Use seam.devices.list once the generated SDK route uses GET. stub_request(:get, url) .to_return(service_unavailable) .to_return(devices) seam = Seam.new(api_key: "seam_some_api_key", faraday_retry_options: {interval: 0}) - expect(seam.client.get("/devices/list").status).to eq(200) + expect(seam.devices.list).to eq([]) expect(a_request(:get, url)).to have_been_made.times(2) end it "applies exponential backoff with jitter by default" do - # TODO: Use seam.devices.list once the generated SDK route uses GET. retry_delays = [] stub_request(:get, url) .to_return(service_unavailable) @@ -96,32 +94,30 @@ def devices faraday_retry_options: {retry_block: ->(**args) { retry_delays << args[:will_retry_in] }} ) - expect(seam.client.get("/devices/list").status).to eq(200) + expect(seam.devices.list).to eq([]) expect(retry_delays[0]).to be_between(0.2, 0.24) expect(retry_delays[1]).to be_between(0.4, 0.44) end it "retries connection failures by default" do - # TODO: Use seam.devices.list once the generated SDK route uses GET. stub_request(:get, url) .to_raise(Faraday::ConnectionFailed.new("connection refused")) .then.to_return(devices) seam = Seam.new(api_key: "seam_some_api_key", faraday_retry_options: {interval: 0}) - expect(seam.client.get("/devices/list").status).to eq(200) + expect(seam.devices.list).to eq([]) expect(a_request(:get, url)).to have_been_made.times(2) end it "retries timeouts by default" do - # TODO: Use seam.devices.list once the generated SDK route uses GET. stub_request(:get, url) .to_raise(Faraday::TimeoutError.new("timed out")) .then.to_return(devices) seam = Seam.new(api_key: "seam_some_api_key", faraday_retry_options: {interval: 0}) - expect(seam.client.get("/devices/list").status).to eq(200) + expect(seam.devices.list).to eq([]) expect(a_request(:get, url)).to have_been_made.times(2) end end diff --git a/spec/seam_client/timeout_spec.rb b/spec/seam_client/timeout_spec.rb index f725b7a..a9f50dc 100644 --- a/spec/seam_client/timeout_spec.rb +++ b/spec/seam_client/timeout_spec.rb @@ -46,7 +46,7 @@ let(:url) { "#{Seam::DEFAULT_ENDPOINT}/devices/list" } it "raises Faraday::TimeoutError" do - stub_request(:post, url).to_timeout + stub_request(:get, url).to_timeout seam = Seam.new(api_key: "seam_some_api_key", timeout: 1)