Lookup Util

Fetching references to proto classes when using the API requires that you either have an intrinsic understanding of the API or need to frequently look up the proto reference documentation for the exact path.

ProtoLookupUtil

The proto lookup util lets you look up and create instances of services, operations, enumerations, and resources without having to keep track of API version numbers and namespaces.

Here's how you typically instantiate a campaign:

campaign = Google::Ads::GoogleAds::V18::Resources::Campaign.new

But with the proto lookup util, you can use a simpler form:

campaign = client.resource.campaign

When fetching a resource, service, or operation, an instance of that entity is returned. When fetching an enumeration, a reference to the class is returned, without instantiation.

For enumerations, you can use a shortcut to bypass the need for looking up the enumeration protos.

campaign.status = :PAUSED

We recommend using the client.service method to fetch services even if you don't use this utility for any other use cases. There is extra logic built into this method to pass along your developer token and authentication details, which you would have to handle manually if you used another method.