조회 유틸리티
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
API를 사용할 때 proto 클래스에 대한 참조를 가져오려면 API를 내재적으로 이해하거나 정확한 경로에 대한 proto 참조 문서를 자주 조회해야 합니다.
ProtoLookupUtil
프로토 조회 유틸리티를 사용하면 API 버전 번호와 네임스페이스를 추적하지 않고도 서비스, 작업, 열거형, 리소스의 인스턴스를 조회하고 만들 수 있습니다.
일반적으로 캠페인을 인스턴스화하는 방법은 다음과 같습니다.
campaign = Google::Ads::GoogleAds::V21::Resources::Campaign.new
하지만 프로토 조회 유틸리티를 사용하면 더 간단한 형식을 사용할 수 있습니다.
campaign = client.resource.campaign
리소스, 서비스 또는 작업을 가져올 때 해당 항목의 인스턴스가 반환됩니다. 열거형을 가져올 때 인스턴스화 없이 클래스 참조가 반환됩니다.
열거형의 경우 단축키를 사용하여 열거형 프로토콜을 조회할 필요가 없습니다.
campaign.status = :PAUSED
다른 사용 사례에 이 유틸리티를 사용하지 않더라도 client.service
메서드를 사용하여 서비스를 가져오는 것이 좋습니다. 이 메서드에는 개발자 토큰과 인증 세부정보를 전달하는 추가 로직이 내장되어 있으며, 다른 메서드를 사용하는 경우 이를 수동으로 처리해야 합니다.
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-09-05(UTC)
[null,null,["최종 업데이트: 2025-09-05(UTC)"],[[["\u003cp\u003eThe ProtoLookupUtil simplifies interactions with the Google Ads API by removing the need to specify API version numbers and namespaces when working with services, operations, enumerations, and resources.\u003c/p\u003e\n"],["\u003cp\u003eInstead of manually instantiating proto classes with complex paths, the utility allows you to create and access them using a more concise and intuitive syntax, such as \u003ccode\u003eclient.resource.campaign\u003c/code\u003e instead of \u003ccode\u003eGoogle::Ads::GoogleAds::V18::Resources::Campaign.new\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eIt offers a shortcut for using enumerations directly, like assigning \u003ccode\u003e:PAUSED\u003c/code\u003e to a campaign status, without requiring explicit proto lookups.\u003c/p\u003e\n"],["\u003cp\u003eUsing \u003ccode\u003eclient.service\u003c/code\u003e is recommended for fetching services, as it automatically handles developer token and authentication details.\u003c/p\u003e\n"]]],[],null,["# Lookup Util\n\nFetching references to proto classes when using the API requires that you either\nhave an intrinsic understanding of the API or need to frequently look up the\nproto reference documentation for the exact path.\n\nProtoLookupUtil\n---------------\n\nThe proto lookup util lets you look up and create instances of services,\noperations, enumerations, and resources without having to keep track of API\nversion numbers and namespaces.\n\nHere's how you typically instantiate a campaign: \n\n campaign = Google::Ads::GoogleAds::V21::Resources::Campaign.new\n\nBut with the proto lookup util, you can use a simpler form: \n\n campaign = client.resource.campaign\n\nWhen fetching a resource, service, or operation, an instance of that entity is\nreturned. When fetching an enumeration, a reference to the class is returned,\nwithout instantiation.\n\nFor enumerations, you can use a shortcut to bypass the need for looking up the\nenumeration protos. \n\n campaign.status = :PAUSED\n\nWe recommend using the `client.service` method to fetch services even if you\ndon't use this utility for any other use cases. There is extra logic built into\nthis method to pass along your developer token and authentication details, which\nyou would have to handle manually if you used another method."]]