Using gem 'google-api-client' V4 to work with Google Sheets. I am trying to insert a few rows at an index, and here is what I have -
spreadsheet = sheet(sheet_id: Utilities.global_config[:googlesheets][:sheetid], sheet_name: 'Sheetname')
insert_dimension_range = Google::Apis::SheetsV4::DimensionRange.new
insert_dimension_range.sheet_id = spreadsheet.properties.sheet_id
insert_dimension_range.dimension = 'ROWS'
insert_dimension_range.start_index = 1
insert_dimension_range.end_index = 3
insert_dimension = Google::Apis::SheetsV4::InsertDimensionRequest.new(inherit_from_before: false)
insert_dimension.range = insert_dimension_range
insert_dimension_request = Google::Apis::SheetsV4::Request.new
insert_dimension_request.insert_dimension = insert_dimension
batch_update_spreadsheet_request = Google::Apis::SheetsV4::BatchUpdateSpreadsheetRequest.new
batch_update_spreadsheet_request.requests = [insert_dimension: insert_dimension_request]
response = service.batch_update_spreadsheet(Utilities.global_config[:googlesheets][:sheetid], batch_update_spreadsheet_request)
Not sure what is wrong with the above code. I am getting an error message - Google::Apis::ClientError: badRequest: Must specify at least one request.
This is how the in-memory representation of object is looking before the API sends a request to Google's servers -

I can see the @request_object.requests array has the proper insert_dimension in it, but don't understand the error message.
Does anyone know what I need to fix? Many thanks in advance ♂️