From 107816806b7b7d97ebc8408e368c6cfdcb10b60b Mon Sep 17 00:00:00 2001 From: Lois Patterson Date: Tue, 17 Nov 2026 14:02:24 +0000 Subject: [PATCH 1/3] Remove read-only ImageAsset fields from upload_image_asset examples --- examples/misc/upload_image_asset.rb | 7 ------- 1 file changed, 7 deletions(-) diff --git a/examples/misc/upload_image_asset.rb b/examples/misc/upload_image_asset.rb index ebcfc35dd..f419296ca 100755 --- a/examples/misc/upload_image_asset.rb +++ b/examples/misc/upload_image_asset.rb @@ -36,13 +36,6 @@ def upload_image_asset(customer_id) asset.type = :IMAGE asset.image_asset = client.resource.image_asset do |image_asset| image_asset.data = image_data - image_asset.file_size = image_data.length() - image_asset.mime_type = :IMAGE_JPEG - image_asset.full_size = client.resource.image_dimension do |dimension| - dimension.height_pixels = 315 - dimension.width_pixels = 600 - dimension.url = url - end end # Provide a unique friendly name to identify your asset. # When there is an existing image asset with the same content but a different From c7e7c89df4831cb7330766dc13f13d9e5d9300d0 Mon Sep 17 00:00:00 2001 From: pattersonlois Date: Wed, 18 Nov 2026 19:12:09 +0000 Subject: [PATCH 2/3] Use URI.open(url, &:read) in upload_image_asset example --- examples/misc/upload_image_asset.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/misc/upload_image_asset.rb b/examples/misc/upload_image_asset.rb index f419296ca..2a7cf042d 100755 --- a/examples/misc/upload_image_asset.rb +++ b/examples/misc/upload_image_asset.rb @@ -29,7 +29,7 @@ def upload_image_asset(customer_id) client = Google::Ads::GoogleAds::GoogleAdsClient.new url = 'https://gaagl.page.link/Eit5' - image_data = open(url) { |f| f.read } + image_data = URI.open(url, &:read) # Create the operation for uploading the image asset. asset_operation = client.operation.create_resource.asset do |asset| From fb84000544017a1d8c6df61efbc50948fdd10c33 Mon Sep 17 00:00:00 2001 From: Lois Patterson Date: Tue, 24 Nov 2026 21:56:27 +0000 Subject: [PATCH 3/3] Use URI(url).open(&:read) in upload_image_asset example --- examples/misc/upload_image_asset.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/misc/upload_image_asset.rb b/examples/misc/upload_image_asset.rb index 2a7cf042d..c698535f9 100755 --- a/examples/misc/upload_image_asset.rb +++ b/examples/misc/upload_image_asset.rb @@ -29,7 +29,7 @@ def upload_image_asset(customer_id) client = Google::Ads::GoogleAds::GoogleAdsClient.new url = 'https://gaagl.page.link/Eit5' - image_data = URI.open(url, &:read) + image_data = URI(url).open(&:read) # Create the operation for uploading the image asset. asset_operation = client.operation.create_resource.asset do |asset|