0

ruby で Google スライド API を使用して省略記号の形状を更新しようとしています。これはコードです:

shape_properties = {
    shape_background_fill: {
        solid_fill: {
            color: {
                rgb_color: {
                    red: 1.0,
                    green: 0,
                    blue: 0
                }
            }
        }
    }
}

requests = [{
              update_shape_properties: {
                object_id: ellipse.object_id,
                fields: 'shapeBackgroundFill',
                shape_properties: shape_properties,
              },
            }]

# Execute the request.
req = Google::Apis::SlidesV1::BatchUpdatePresentationRequest.new(requests: requests)
response = @slides.batch_update_presentation(presentation_id,req)

同じエラーで試した別のコードは次のとおりです。

rgb_color = Google::Apis::SlidesV1::RgbColor.new(red: 1.0, green: 0, blue: 0)
color = Google::Apis::SlidesV1::OpaqueColor.new(rgb_color: rgb_color)
solid_fill = Google::Apis::SlidesV1::SolidFill.new(color: color)
shape_background_fill = Google::Apis::SlidesV1::ShapeBackgroundFill.new(solid_fill: solid_fill)
shape_properties = Google::Apis::SlidesV1::ShapeProperties.new(shape_background_fill: shape_background_fill)
requests = [{
                update_shape_properties: {
                  object_id: ellipse.object_id,
                  fields: 'shapeBackgroundFill',
                  shape_properties: shape_properties,
                },
            }]
req = Google::Apis::SlidesV1::BatchUpdatePresentationRequest.new(requests: requests)
response = @slides.batch_update_presentation(presentation_id, req)

次のエラーが表示されます。

`check_status': badRequest: Invalid requests[0].updateShapeProperties: The object () could not be found. (Google::Apis::ClientError)

なぜ失敗するのですか?

4

1 に答える 1