googleads / google-ads-ruby

Google Ads API Ruby Client Library
https://developers.google.com/google-ads/api/
Apache License 2.0
70 stars 65 forks source link

How to trigger a `remove_all` OfflineUserDataJobOperation? #414

Closed alexibz closed 2 years ago

alexibz commented 2 years ago

What is your question? I'm trying to figure out how to trigger a remove_all operation on a customer match list. I know how to create and remove resources, but can't remove_all using the library, although I see it is part of the spec here : Examples using remove and create:

google_client.operation.create_resource.offline_user_data_job
google_client.operation.remove_resource.offline_user_data_job
mcloonan commented 2 years ago

The create_resource and etc. are shortcuts that automatically populate the create/remove/update field of the operation, since those are very common across all operation types. For anything else, you should be able to do:

google_client.operation.[type] do |op|
  # Code here acting on the operation.
  op.create = client.resource.[type] ...
end

Which will then let you operate on the operation directly. So in this case:

google_client.operation.offline_user_data_job do |op|
  op.remove_all = true
end