Class: Google::Ads::GoogleAds::V16::Services::GoogleAdsService::Client

Inherits:
Object
  • Object
show all
Includes:
Paths
Defined in:
lib/google/ads/google_ads/v16/services/google_ads_service/client.rb

Overview

Client for the GoogleAdsService service.

Service to fetch data and metrics across resources.

Defined Under Namespace

Classes: Configuration

Constant Summary collapse

DEFAULT_ENDPOINT_TEMPLATE =
"googleads.$UNIVERSE_DOMAIN$"

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Paths

#accessible_bidding_strategy_path, #account_budget_path, #account_budget_proposal_path, #account_link_path, #ad_group_ad_asset_combination_view_path, #ad_group_ad_asset_view_path, #ad_group_ad_label_path, #ad_group_ad_path, #ad_group_asset_path, #ad_group_asset_set_path, #ad_group_audience_view_path, #ad_group_bid_modifier_path, #ad_group_criterion_customizer_path, #ad_group_criterion_label_path, #ad_group_criterion_path, #ad_group_criterion_simulation_path, #ad_group_customizer_path, #ad_group_extension_setting_path, #ad_group_feed_path, #ad_group_label_path, #ad_group_path, #ad_group_simulation_path, #ad_parameter_path, #ad_path, #ad_schedule_view_path, #age_range_view_path, #android_privacy_shared_key_google_ad_group_path, #android_privacy_shared_key_google_campaign_path, #android_privacy_shared_key_google_network_type_path, #asset_field_type_view_path, #asset_group_asset_path, #asset_group_listing_group_filter_path, #asset_group_path, #asset_group_product_group_view_path, #asset_group_signal_path, #asset_group_top_combination_view_path, #asset_path, #asset_set_asset_path, #asset_set_path, #asset_set_type_view_path, #audience_path, #batch_job_path, #bidding_data_exclusion_path, #bidding_seasonality_adjustment_path, #bidding_strategy_path, #bidding_strategy_simulation_path, #billing_setup_path, #call_view_path, #campaign_asset_path, #campaign_asset_set_path, #campaign_audience_view_path, #campaign_bid_modifier_path, #campaign_budget_path, #campaign_conversion_goal_path, #campaign_criterion_path, #campaign_customizer_path, #campaign_draft_path, #campaign_extension_setting_path, #campaign_feed_path, #campaign_group_path, #campaign_label_path, #campaign_lifecycle_goal_path, #campaign_path, #campaign_search_term_insight_path, #campaign_shared_set_path, #campaign_simulation_path, #carrier_constant_path, #change_event_path, #change_status_path, #click_view_path, #combined_audience_path, #conversion_action_path, #conversion_custom_variable_path, #conversion_goal_campaign_config_path, #conversion_value_rule_path, #conversion_value_rule_set_path, #currency_constant_path, #custom_audience_path, #custom_conversion_goal_path, #custom_interest_path, #customer_asset_path, #customer_asset_set_path, #customer_client_link_path, #customer_client_path, #customer_conversion_goal_path, #customer_customizer_path, #customer_extension_setting_path, #customer_feed_path, #customer_label_path, #customer_lifecycle_goal_path, #customer_manager_link_path, #customer_negative_criterion_path, #customer_path, #customer_search_term_insight_path, #customer_user_access_invitation_path, #customer_user_access_path, #customizer_attribute_path, #detail_placement_view_path, #detailed_demographic_path, #display_keyword_view_path, #distance_view_path, #domain_category_path, #dynamic_search_ads_search_term_view_path, #expanded_landing_page_view_path, #experiment_arm_path, #experiment_path, #extension_feed_item_path, #feed_item_path, #feed_item_set_link_path, #feed_item_set_path, #feed_item_target_path, #feed_mapping_path, #feed_path, #feed_placeholder_view_path, #gender_view_path, #geo_target_constant_path, #geographic_view_path, #group_placement_view_path, #hotel_group_view_path, #hotel_performance_view_path, #hotel_reconciliation_path, #income_range_view_path, #keyword_plan_ad_group_keyword_path, #keyword_plan_ad_group_path, #keyword_plan_campaign_keyword_path, #keyword_plan_campaign_path, #keyword_plan_path, #keyword_theme_constant_path, #keyword_view_path, #label_path, #landing_page_view_path, #language_constant_path, #lead_form_submission_data_path, #life_event_path, #local_services_employee_path, #local_services_lead_conversation_path, #local_services_lead_path, #local_services_verification_artifact_path, #location_view_path, #managed_placement_view_path, #media_file_path, #mobile_app_category_constant_path, #mobile_device_constant_path, #offline_conversion_upload_client_summary_path, #offline_user_data_job_path, #operating_system_version_constant_path, #paid_organic_search_term_view_path, #parental_status_view_path, #payments_account_path, #per_store_view_path, #product_category_constant_path, #product_group_view_path, #product_link_invitation_path, #product_link_path, #qualifying_question_path, #recommendation_path, #recommendation_subscription_path, #remarketing_action_path, #search_term_view_path, #shared_criterion_path, #shared_set_path, #shopping_performance_view_path, #smart_campaign_search_term_view_path, #smart_campaign_setting_path, #third_party_app_analytics_link_path, #topic_constant_path, #topic_view_path, #travel_activity_group_view_path, #travel_activity_performance_view_path, #user_interest_path, #user_list_path, #user_location_view_path, #video_path, #webpage_view_path

Constructor Details

#initialize {|config| ... } ⇒ Client

Create a new GoogleAdsService client object.

Examples:


# Create a client using the default configuration
client = ::Google::Ads::GoogleAds::V16::Services::GoogleAdsService::Client.new

# Create a client using a custom configuration
client = ::Google::Ads::GoogleAds::V16::Services::GoogleAdsService::Client.new do |config|
  config.timeout = 10.0
end

Yields:

  • (config)

    Configure the GoogleAdsService client.

Yield Parameters:



120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# File 'lib/google/ads/google_ads/v16/services/google_ads_service/client.rb', line 120

def initialize
  # These require statements are intentionally placed here to initialize
  # the gRPC module only when it's required.
  # See https://github.com/googleapis/toolkit/issues/446
  require "gapic/grpc"
  require "google/ads/google_ads/v16/services/google_ads_service_services_pb"

  # Create the configuration object
  @config = Configuration.new Client.configure

  # Yield the configuration if needed
  yield @config if block_given?

  # Create credentials
  credentials = @config.credentials
  # Use self-signed JWT if the endpoint is unchanged from default,
  # but only if the default endpoint does not have a region prefix.
  enable_self_signed_jwt = @config.endpoint.nil? ||
                           (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
                           !@config.endpoint.split(".").first.include?("-"))
  credentials ||= Credentials.default scope: @config.scope,
                                      enable_self_signed_jwt: enable_self_signed_jwt
  if credentials.is_a?(::String) || credentials.is_a?(::Hash)
    credentials = Credentials.new credentials, scope: @config.scope
  end
  @quota_project_id = @config.quota_project
  @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id

  @google_ads_service_stub = ::Gapic::ServiceStub.new(
    ::Google::Ads::GoogleAds::V16::Services::GoogleAdsService::Stub,
    credentials: credentials,
    endpoint: @config.endpoint,
    endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
    universe_domain: @config.universe_domain,
    channel_args: @config.channel_args,
    interceptors: @config.interceptors,
    channel_pool_config: @config.channel_pool
  )
end

Instance Attribute Details



40
41
42
# File 'lib/google/ads/google_ads/v16/services/google_ads_service/client.rb', line 40

def google_ads_service_stub
  @google_ads_service_stub
end

Class Method Details

.configure {|config| ... } ⇒ Client::Configuration

Configure the GoogleAdsService Client class.

See Configuration for a description of the configuration fields.

Examples:


# Modify the configuration for all GoogleAdsService clients
::Google::Ads::GoogleAds::V16::Services::GoogleAdsService::Client.configure do |config|
  config.timeout = 10.0
end

Yields:

  • (config)

    Configure the Client client.

Yield Parameters:

Returns:



60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/google/ads/google_ads/v16/services/google_ads_service/client.rb', line 60

def self.configure
  @configure ||= begin
    default_config = Client::Configuration.new

    default_config.timeout = 14_400.0
    default_config.retry_policy = {
      initial_delay: 5.0, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
    }

    default_config
  end
  yield @configure if block_given?
  @configure
end

Instance Method Details

#configure {|config| ... } ⇒ Client::Configuration

Configure the GoogleAdsService Client instance.

The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on configure.

See Configuration for a description of the configuration fields.

Yields:

  • (config)

    Configure the Client client.

Yield Parameters:

Returns:



90
91
92
93
# File 'lib/google/ads/google_ads/v16/services/google_ads_service/client.rb', line 90

def configure
  yield @config if block_given?
  @config
end

#mutate(request, options = nil) ⇒ ::Google::Ads::GoogleAds::V16::Services::MutateGoogleAdsResponse #mutate(customer_id: nil, mutate_operations: nil, partial_failure: nil, validate_only: nil, response_content_type: nil) ⇒ ::Google::Ads::GoogleAds::V16::Services::MutateGoogleAdsResponse

Creates, updates, or removes resources. This method supports atomic transactions with multiple types of resources. For example, you can atomically create a campaign and a campaign budget, or perform up to thousands of mutates atomically.

This method is essentially a wrapper around a series of mutate methods. The only features it offers over calling those methods directly are:

  • Atomic transactions

  • Temp resource names (described below)

  • Somewhat reduced latency over making a series of mutate calls

Note: Only resources that support atomic transactions are included, so this method can’t replace all calls to individual services.

## Atomic Transaction Benefits

Atomicity makes error handling much easier. If you’re making a series of changes and one fails, it can leave your account in an inconsistent state. With atomicity, you either reach the chosen state directly, or the request fails and you can retry.

## Temp Resource Names

Temp resource names are a special type of resource name used to create a resource and reference that resource in the same request. For example, if a campaign budget is created with ‘resource_name` equal to `customers/123/campaignBudgets/-1`, that resource name can be reused in the `Campaign.budget` field in the same request. That way, the two resources are created and linked atomically.

To create a temp resource name, put a negative number in the part of the name that the server would normally allocate.

Note:

  • Resources must be created with a temp name before the name can be reused. For example, the previous CampaignBudget+Campaign example would fail if the mutate order was reversed.

  • Temp names are not remembered across requests.

  • There’s no limit to the number of temp names in a request.

  • Each temp name must use a unique negative number, even if the resource types differ.

## Latency

It’s important to group mutates by resource type or the request may time out and fail. Latency is roughly equal to a series of calls to individual mutate methods, where each change in resource type is a new call. For example, mutating 10 campaigns then 10 ad groups is like 2 calls, while mutating 1 campaign, 1 ad group, 1 campaign, 1 ad group is like 4 calls.

List of thrown errors:

[AdCustomizerError]()
[AdError]()
[AdGroupAdError]()
[AdGroupCriterionError]()
[AdGroupError]()
[AssetError]()
[AuthenticationError]()
[AuthorizationError]()
[BiddingError]()
[CampaignBudgetError]()
[CampaignCriterionError]()
[CampaignError]()
[CampaignExperimentError]()
[CampaignSharedSetError]()
[CollectionSizeError]()
[ContextError]()
[ConversionActionError]()
[CriterionError]()
[CustomerFeedError]()
[DatabaseError]()
[DateError]()
[DateRangeError]()
[DistinctError]()
[ExtensionFeedItemError]()
[ExtensionSettingError]()
[FeedAttributeReferenceError]()
[FeedError]()
[FeedItemError]()
[FeedItemSetError]()
[FieldError]()
[FieldMaskError]()
[FunctionParsingError]()
[HeaderError]()
[ImageError]()
[InternalError]()
[KeywordPlanAdGroupKeywordError]()
[KeywordPlanCampaignError]()
[KeywordPlanError]()
[LabelError]()
[ListOperationError]()
[MediaUploadError]()
[MutateError]()
[NewResourceCreationError]()
[NullError]()
[OperationAccessDeniedError]()
[PolicyFindingError]()
[PolicyViolationError]()
[QuotaError]()
[RangeError]()
[RequestError]()
[ResourceCountLimitExceededError]()
[SettingError]()
[SharedSetError]()
[SizeLimitError]()
[StringFormatError]()
[StringLengthError]()
[UrlFieldError]()
[UserListError]()
[YoutubeVideoRegistrationError]()

Examples:

Basic example

require "google/ads/google_ads/v16/services"

# Create a client object. The client can be reused for multiple calls.
client = Google::Ads::GoogleAds::V16::Services::GoogleAdsService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Ads::GoogleAds::V16::Services::MutateGoogleAdsRequest.new

# Call the mutate method.
result = client.mutate request

# The returned object is of type Google::Ads::GoogleAds::V16::Services::MutateGoogleAdsResponse.
p result

Overloads:

  • #mutate(request, options = nil) ⇒ ::Google::Ads::GoogleAds::V16::Services::MutateGoogleAdsResponse

    Pass arguments to ‘mutate` via a request object, either of type MutateGoogleAdsRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Ads::GoogleAds::V16::Services::MutateGoogleAdsRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #mutate(customer_id: nil, mutate_operations: nil, partial_failure: nil, validate_only: nil, response_content_type: nil) ⇒ ::Google::Ads::GoogleAds::V16::Services::MutateGoogleAdsResponse

    Pass arguments to ‘mutate` via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • customer_id (::String) (defaults to: nil)

      Required. The ID of the customer whose resources are being modified.

    • mutate_operations (::Array<::Google::Ads::GoogleAds::V16::Services::MutateOperation, ::Hash>) (defaults to: nil)

      Required. The list of operations to perform on individual resources.

    • partial_failure (::Boolean) (defaults to: nil)

      If true, successful operations will be carried out and invalid operations will return errors. If false, all operations will be carried out in one transaction if and only if they are all valid. Default is false.

    • validate_only (::Boolean) (defaults to: nil)

      If true, the request is validated but not executed. Only errors are returned, not results.

    • response_content_type (::Google::Ads::GoogleAds::V16::Enums::ResponseContentTypeEnum::ResponseContentType) (defaults to: nil)

      The response content type setting. Determines whether the mutable resource or just the resource name should be returned post mutation. The mutable resource will only be returned if the resource has the appropriate response field. For example, MutateCampaignResult.campaign.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (Google::Ads::GoogleAds::Error)

    if the RPC is aborted.



564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
# File 'lib/google/ads/google_ads/v16/services/google_ads_service/client.rb', line 564

def mutate request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request,
                                     to: ::Google::Ads::GoogleAds::V16::Services::MutateGoogleAdsRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.mutate..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Ads::GoogleAds::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.customer_id
    header_params["customer_id"] = request.customer_id
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.mutate.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.mutate.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @google_ads_service_stub.call_rpc :mutate, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
  # rescue GRPC::BadStatus => grpc_error
  #  raise Google::Ads::GoogleAds::Error.new grpc_error.message
end

#search(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Ads::GoogleAds::V16::Services::GoogleAdsRow> #search(customer_id: nil, query: nil, page_token: nil, page_size: nil, validate_only: nil, return_total_results_count: nil, summary_row_setting: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Ads::GoogleAds::V16::Services::GoogleAdsRow>

Returns all rows that match the search query.

List of thrown errors:

[AuthenticationError]()
[AuthorizationError]()
[ChangeEventError]()
[ChangeStatusError]()
[ClickViewError]()
[HeaderError]()
[InternalError]()
[QueryError]()
[QuotaError]()
[RequestError]()

Examples:

Basic example

require "google/ads/google_ads/v16/services"

# Create a client object. The client can be reused for multiple calls.
client = Google::Ads::GoogleAds::V16::Services::GoogleAdsService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Ads::GoogleAds::V16::Services::SearchGoogleAdsRequest.new

# Call the search method.
result = client.search request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Ads::GoogleAds::V16::Services::GoogleAdsRow.
  p item
end

Overloads:

  • #search(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Ads::GoogleAds::V16::Services::GoogleAdsRow>

    Pass arguments to ‘search` via a request object, either of type SearchGoogleAdsRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Ads::GoogleAds::V16::Services::SearchGoogleAdsRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #search(customer_id: nil, query: nil, page_token: nil, page_size: nil, validate_only: nil, return_total_results_count: nil, summary_row_setting: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Ads::GoogleAds::V16::Services::GoogleAdsRow>

    Pass arguments to ‘search` via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • customer_id (::String) (defaults to: nil)

      Required. The ID of the customer being queried.

    • query (::String) (defaults to: nil)

      Required. The query string.

    • page_token (::String) (defaults to: nil)

      Token of the page to retrieve. If not specified, the first page of results will be returned. Use the value obtained from ‘next_page_token` in the previous response in order to request the next page of results.

    • page_size (::Integer) (defaults to: nil)

      Number of elements to retrieve in a single page. When too large a page is requested, the server may decide to further limit the number of returned resources.

    • validate_only (::Boolean) (defaults to: nil)

      If true, the request is validated but not executed.

    • return_total_results_count (::Boolean) (defaults to: nil)

      If true, the total number of results that match the query ignoring the LIMIT clause will be included in the response. Default is false.

    • summary_row_setting (::Google::Ads::GoogleAds::V16::Enums::SummaryRowSettingEnum::SummaryRowSetting) (defaults to: nil)

      Determines whether a summary row will be returned. By default, summary row is not returned. If requested, the summary row will be sent in a response by itself after all other query results are returned.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (Google::Ads::GoogleAds::Error)

    if the RPC is aborted.



243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
# File 'lib/google/ads/google_ads/v16/services/google_ads_service/client.rb', line 243

def search request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request,
                                     to: ::Google::Ads::GoogleAds::V16::Services::SearchGoogleAdsRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.search..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Ads::GoogleAds::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.customer_id
    header_params["customer_id"] = request.customer_id
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.search.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.search.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @google_ads_service_stub.call_rpc :search, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @google_ads_service_stub, :search, request, response,
                                            operation, options
    yield response, operation if block_given?
    return response
  end
  # rescue GRPC::BadStatus => grpc_error
  #  raise Google::Ads::GoogleAds::Error.new grpc_error.message
end

#search_stream(request, options = nil) ⇒ ::Enumerable<::Google::Ads::GoogleAds::V16::Services::SearchGoogleAdsStreamResponse> #search_stream(customer_id: nil, query: nil, summary_row_setting: nil) ⇒ ::Enumerable<::Google::Ads::GoogleAds::V16::Services::SearchGoogleAdsStreamResponse>

Returns all rows that match the search stream query.

List of thrown errors:

[AuthenticationError]()
[AuthorizationError]()
[ChangeEventError]()
[ChangeStatusError]()
[ClickViewError]()
[HeaderError]()
[InternalError]()
[QueryError]()
[QuotaError]()
[RequestError]()

Examples:

Basic example

require "google/ads/google_ads/v16/services"

# Create a client object. The client can be reused for multiple calls.
client = Google::Ads::GoogleAds::V16::Services::GoogleAdsService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Ads::GoogleAds::V16::Services::SearchGoogleAdsStreamRequest.new

# Call the search_stream method to start streaming.
output = client.search_stream request

# The returned object is a streamed enumerable yielding elements of type
# ::Google::Ads::GoogleAds::V16::Services::SearchGoogleAdsStreamResponse
output.each do |current_response|
  p current_response
end

Overloads:

  • #search_stream(request, options = nil) ⇒ ::Enumerable<::Google::Ads::GoogleAds::V16::Services::SearchGoogleAdsStreamResponse>

    Pass arguments to ‘search_stream` via a request object, either of type SearchGoogleAdsStreamRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Ads::GoogleAds::V16::Services::SearchGoogleAdsStreamRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #search_stream(customer_id: nil, query: nil, summary_row_setting: nil) ⇒ ::Enumerable<::Google::Ads::GoogleAds::V16::Services::SearchGoogleAdsStreamResponse>

    Pass arguments to ‘search_stream` via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • customer_id (::String) (defaults to: nil)

      Required. The ID of the customer being queried.

    • query (::String) (defaults to: nil)

      Required. The query string.

    • summary_row_setting (::Google::Ads::GoogleAds::V16::Enums::SummaryRowSettingEnum::SummaryRowSetting) (defaults to: nil)

      Determines whether a summary row will be returned. By default, summary row is not returned. If requested, the summary row will be sent in a response by itself after all other query results are returned.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (Google::Ads::GoogleAds::Error)

    if the RPC is aborted.



352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
# File 'lib/google/ads/google_ads/v16/services/google_ads_service/client.rb', line 352

def search_stream request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request,
                                     to: ::Google::Ads::GoogleAds::V16::Services::SearchGoogleAdsStreamRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.search_stream..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Ads::GoogleAds::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.customer_id
    header_params["customer_id"] = request.customer_id
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.search_stream.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.search_stream.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @google_ads_service_stub.call_rpc :search_stream, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
  # rescue GRPC::BadStatus => grpc_error
  #  raise Google::Ads::GoogleAds::Error.new grpc_error.message
end

#universe_domainString

The effective universe domain

Returns:

  • (String)


100
101
102
# File 'lib/google/ads/google_ads/v16/services/google_ads_service/client.rb', line 100

def universe_domain
  @google_ads_service_stub.universe_domain
end