Skip to content

Commit e03ce20

Browse files
fix!: Added proto3 optional to Network primitive fields (#32254)
fix!: Added pagination to ListNetworks fix!: Renamed `USER_MESSAGES_CCPA_MESSAGES_SHOWN` `Metric` to `USER_MESSAGES_US_STATES_MESSAGES_SHOWN` docs: Updated documentation for `ad_review_center_ad_id` filter feat: Added LineItem service feat: Added additional Report metrics and dimensions feat: Added write methods for AdUnits feat: Added write methods for CustomTargetingKeys docs: Updated documentation for Report metrics and dimensions docs: Made `status` optional for SearchAdReviewCenterAds PiperOrigin-RevId: 842183588 Source-Link: googleapis/googleapis@8c06c1e Source-Link: googleapis/googleapis-gen@f5580fd Copy-Tag: eyJwIjoiZ29vZ2xlLWFkcy1hZF9tYW5hZ2VyLy5Pd2xCb3QueWFtbCIsImgiOiJmNTU4MGZkMzQ2ODZhOTM1ZTc2MWQ4ZmZkYmU4ZDI4YmE5NTJmOTZmIn0= * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent aec7c50 commit e03ce20

File tree

2 files changed

+73
-0
lines changed

2 files changed

+73
-0
lines changed

google-ads-ad_manager/lib/google/ads/ad_manager.rb

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1539,6 +1539,69 @@ def self.geo_target_service_available? version: :v1
15391539
false
15401540
end
15411541

1542+
##
1543+
# Create a new client object for LineItemService.
1544+
#
1545+
# By default, this returns an instance of
1546+
# [Google::Ads::AdManager::V1::LineItemService::Rest::Client](https://rubydoc.info/gems/google-ads-ad_manager-v1/Google/Ads/AdManager/V1/LineItemService/Rest/Client)
1547+
# for a REST client for version V1 of the API.
1548+
# However, you can specify a different API version by passing it in the
1549+
# `version` parameter. If the LineItemService service is
1550+
# supported by that API version, and the corresponding gem is available, the
1551+
# appropriate versioned client will be returned.
1552+
#
1553+
# Raises an exception if the currently installed versioned client gem for the
1554+
# given API version does not support the LineItemService service.
1555+
# You can determine whether the method will succeed by calling
1556+
# {Google::Ads::AdManager.line_item_service_available?}.
1557+
#
1558+
# ## About LineItemService
1559+
#
1560+
# Provides methods for handling `LineItem` objects.
1561+
#
1562+
# @param version [::String, ::Symbol] The API version to connect to. Optional.
1563+
# Defaults to `:v1`.
1564+
# @return [::Object] A client object for the specified version.
1565+
#
1566+
def self.line_item_service version: :v1, &block
1567+
require "google/ads/ad_manager/#{version.to_s.downcase}"
1568+
1569+
package_name = Google::Ads::AdManager
1570+
.constants
1571+
.select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
1572+
.first
1573+
service_module = Google::Ads::AdManager.const_get(package_name).const_get(:LineItemService)
1574+
service_module.const_get(:Rest).const_get(:Client).new(&block)
1575+
end
1576+
1577+
##
1578+
# Determines whether the LineItemService service is supported by the current client.
1579+
# If true, you can retrieve a client object by calling {Google::Ads::AdManager.line_item_service}.
1580+
# If false, that method will raise an exception. This could happen if the given
1581+
# API version does not exist or does not support the LineItemService service,
1582+
# or if the versioned client gem needs an update to support the LineItemService service.
1583+
#
1584+
# @param version [::String, ::Symbol] The API version to connect to. Optional.
1585+
# Defaults to `:v1`.
1586+
# @return [boolean] Whether the service is available.
1587+
#
1588+
def self.line_item_service_available? version: :v1
1589+
require "google/ads/ad_manager/#{version.to_s.downcase}"
1590+
package_name = Google::Ads::AdManager
1591+
.constants
1592+
.select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
1593+
.first
1594+
return false unless package_name
1595+
service_module = Google::Ads::AdManager.const_get package_name
1596+
return false unless service_module.const_defined? :LineItemService
1597+
service_module = service_module.const_get :LineItemService
1598+
return false unless service_module.const_defined? :Rest
1599+
service_module = service_module.const_get :Rest
1600+
service_module.const_defined? :Client
1601+
rescue ::LoadError
1602+
false
1603+
end
1604+
15421605
##
15431606
# Create a new client object for MobileCarrierService.
15441607
#

google-ads-ad_manager/test/google/ads/ad_manager/client_test.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,16 @@ def test_geo_target_service_rest
280280
end
281281
end
282282

283+
def test_line_item_service_rest
284+
skip unless Google::Ads::AdManager.line_item_service_available?
285+
Gapic::Rest::ClientStub.stub :new, DummyStub.new do
286+
client = Google::Ads::AdManager.line_item_service do |config|
287+
config.credentials = :dummy_credentials
288+
end
289+
assert_kind_of Google::Ads::AdManager::V1::LineItemService::Rest::Client, client
290+
end
291+
end
292+
283293
def test_mobile_carrier_service_rest
284294
skip unless Google::Ads::AdManager.mobile_carrier_service_available?
285295
Gapic::Rest::ClientStub.stub :new, DummyStub.new do

0 commit comments

Comments
 (0)