google-ads-googleads 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (150) hide show
  1. checksums.yaml +7 -0
  2. data/ChangeLog +2 -0
  3. data/README.md +107 -0
  4. data/Rakefile +7 -0
  5. data/googleads_config.rb +10 -0
  6. data/lib/google/ads/googleads.rb +25 -0
  7. data/lib/google/ads/googleads/config.rb +42 -0
  8. data/lib/google/ads/googleads/errors.rb +40 -0
  9. data/lib/google/ads/googleads/field_mask_util.rb +159 -0
  10. data/lib/google/ads/googleads/googleads_client.rb +177 -0
  11. data/lib/google/ads/googleads/patches.rb +45 -0
  12. data/lib/google/ads/googleads/path_lookup_util.rb +84 -0
  13. data/lib/google/ads/googleads/proto_lookup_util.rb +249 -0
  14. data/lib/google/ads/googleads/v0/common/ad_pb.rb +80 -0
  15. data/lib/google/ads/googleads/v0/common/bidding_pb.rb +71 -0
  16. data/lib/google/ads/googleads/v0/common/criteria_pb.rb +25 -0
  17. data/lib/google/ads/googleads/v0/common/custom_parameter_pb.rb +24 -0
  18. data/lib/google/ads/googleads/v0/common/metrics_pb.rb +65 -0
  19. data/lib/google/ads/googleads/v0/common/policy_pb.rb +24 -0
  20. data/lib/google/ads/googleads/v0/common/value_pb.rb +28 -0
  21. data/lib/google/ads/googleads/v0/enums/ad_group_ad_status_pb.rb +29 -0
  22. data/lib/google/ads/googleads/v0/enums/ad_group_criterion_status_pb.rb +29 -0
  23. data/lib/google/ads/googleads/v0/enums/ad_group_status_pb.rb +29 -0
  24. data/lib/google/ads/googleads/v0/enums/ad_group_type_pb.rb +27 -0
  25. data/lib/google/ads/googleads/v0/enums/ad_network_type_pb.rb +31 -0
  26. data/lib/google/ads/googleads/v0/enums/ad_serving_optimization_status_pb.rb +31 -0
  27. data/lib/google/ads/googleads/v0/enums/ad_type_pb.rb +32 -0
  28. data/lib/google/ads/googleads/v0/enums/advertising_channel_sub_type_pb.rb +28 -0
  29. data/lib/google/ads/googleads/v0/enums/advertising_channel_type_pb.rb +27 -0
  30. data/lib/google/ads/googleads/v0/enums/bid_source_pb.rb +29 -0
  31. data/lib/google/ads/googleads/v0/enums/bidding_strategy_type_pb.rb +36 -0
  32. data/lib/google/ads/googleads/v0/enums/budget_delivery_method_pb.rb +28 -0
  33. data/lib/google/ads/googleads/v0/enums/budget_status_pb.rb +28 -0
  34. data/lib/google/ads/googleads/v0/enums/campaign_serving_status_pb.rb +31 -0
  35. data/lib/google/ads/googleads/v0/enums/campaign_status_pb.rb +29 -0
  36. data/lib/google/ads/googleads/v0/enums/criterion_type_pb.rb +27 -0
  37. data/lib/google/ads/googleads/v0/enums/day_of_week_pb.rb +33 -0
  38. data/lib/google/ads/googleads/v0/enums/device_pb.rb +29 -0
  39. data/lib/google/ads/googleads/v0/enums/google_ads_field_category_pb.rb +30 -0
  40. data/lib/google/ads/googleads/v0/enums/google_ads_field_data_type_pb.rb +36 -0
  41. data/lib/google/ads/googleads/v0/enums/keyword_match_type_pb.rb +29 -0
  42. data/lib/google/ads/googleads/v0/enums/page_one_promoted_strategy_goal_pb.rb +28 -0
  43. data/lib/google/ads/googleads/v0/enums/quality_score_bucket_pb.rb +29 -0
  44. data/lib/google/ads/googleads/v0/enums/slot_pb.rb +32 -0
  45. data/lib/google/ads/googleads/v0/errors/ad_customizer_error_pb.rb +31 -0
  46. data/lib/google/ads/googleads/v0/errors/ad_error_pb.rb +154 -0
  47. data/lib/google/ads/googleads/v0/errors/ad_group_ad_error_pb.rb +34 -0
  48. data/lib/google/ads/googleads/v0/errors/ad_group_criterion_error_pb.rb +63 -0
  49. data/lib/google/ads/googleads/v0/errors/ad_group_error_pb.rb +38 -0
  50. data/lib/google/ads/googleads/v0/errors/ad_sharing_error_pb.rb +29 -0
  51. data/lib/google/ads/googleads/v0/errors/adx_error_pb.rb +27 -0
  52. data/lib/google/ads/googleads/v0/errors/authentication_error_pb.rb +47 -0
  53. data/lib/google/ads/googleads/v0/errors/authorization_error_pb.rb +30 -0
  54. data/lib/google/ads/googleads/v0/errors/bidding_error_pb.rb +46 -0
  55. data/lib/google/ads/googleads/v0/errors/bidding_strategy_error_pb.rb +30 -0
  56. data/lib/google/ads/googleads/v0/errors/campaign_budget_error_pb.rb +40 -0
  57. data/lib/google/ads/googleads/v0/errors/campaign_criterion_error_pb.rb +36 -0
  58. data/lib/google/ads/googleads/v0/errors/campaign_error_pb.rb +60 -0
  59. data/lib/google/ads/googleads/v0/errors/collection_size_error_pb.rb +28 -0
  60. data/lib/google/ads/googleads/v0/errors/criterion_error_pb.rb +106 -0
  61. data/lib/google/ads/googleads/v0/errors/date_error_pb.rb +34 -0
  62. data/lib/google/ads/googleads/v0/errors/date_range_error_pb.rb +31 -0
  63. data/lib/google/ads/googleads/v0/errors/distinct_error_pb.rb +28 -0
  64. data/lib/google/ads/googleads/v0/errors/errors_pb.rb +154 -0
  65. data/lib/google/ads/googleads/v0/errors/feed_attribute_reference_error_pb.rb +29 -0
  66. data/lib/google/ads/googleads/v0/errors/field_mask_error_pb.rb +30 -0
  67. data/lib/google/ads/googleads/v0/errors/function_error_pb.rb +42 -0
  68. data/lib/google/ads/googleads/v0/errors/function_parsing_error_pb.rb +37 -0
  69. data/lib/google/ads/googleads/v0/errors/id_error_pb.rb +27 -0
  70. data/lib/google/ads/googleads/v0/errors/image_error_pb.rb +63 -0
  71. data/lib/google/ads/googleads/v0/errors/internal_error_pb.rb +28 -0
  72. data/lib/google/ads/googleads/v0/errors/list_operation_error_pb.rb +28 -0
  73. data/lib/google/ads/googleads/v0/errors/media_bundle_error_pb.rb +48 -0
  74. data/lib/google/ads/googleads/v0/errors/media_error_pb.rb +50 -0
  75. data/lib/google/ads/googleads/v0/errors/multiplier_error_pb.rb +38 -0
  76. data/lib/google/ads/googleads/v0/errors/mutate_error_pb.rb +31 -0
  77. data/lib/google/ads/googleads/v0/errors/new_resource_creation_error_pb.rb +29 -0
  78. data/lib/google/ads/googleads/v0/errors/not_empty_error_pb.rb +27 -0
  79. data/lib/google/ads/googleads/v0/errors/null_error_pb.rb +27 -0
  80. data/lib/google/ads/googleads/v0/errors/operation_access_denied_error_pb.rb +35 -0
  81. data/lib/google/ads/googleads/v0/errors/operator_error_pb.rb +27 -0
  82. data/lib/google/ads/googleads/v0/errors/query_error_pb.rb +72 -0
  83. data/lib/google/ads/googleads/v0/errors/quota_error_pb.rb +28 -0
  84. data/lib/google/ads/googleads/v0/errors/range_error_pb.rb +28 -0
  85. data/lib/google/ads/googleads/v0/errors/region_code_error_pb.rb +27 -0
  86. data/lib/google/ads/googleads/v0/errors/request_error_pb.rb +41 -0
  87. data/lib/google/ads/googleads/v0/errors/resource_access_denied_error_pb.rb +27 -0
  88. data/lib/google/ads/googleads/v0/errors/resource_count_limit_exceeded_error_pb.rb +33 -0
  89. data/lib/google/ads/googleads/v0/errors/setting_error_pb.rb +43 -0
  90. data/lib/google/ads/googleads/v0/errors/string_format_error_pb.rb +28 -0
  91. data/lib/google/ads/googleads/v0/errors/string_length_error_pb.rb +28 -0
  92. data/lib/google/ads/googleads/v0/errors/url_field_error_pb.rb +70 -0
  93. data/lib/google/ads/googleads/v0/resources/ad_group_ad_pb.rb +28 -0
  94. data/lib/google/ads/googleads/v0/resources/ad_group_criterion_pb.rb +64 -0
  95. data/lib/google/ads/googleads/v0/resources/ad_group_pb.rb +38 -0
  96. data/lib/google/ads/googleads/v0/resources/bidding_strategy_pb.rb +36 -0
  97. data/lib/google/ads/googleads/v0/resources/campaign_budget_pb.rb +32 -0
  98. data/lib/google/ads/googleads/v0/resources/campaign_criterion_pb.rb +32 -0
  99. data/lib/google/ads/googleads/v0/resources/campaign_pb.rb +70 -0
  100. data/lib/google/ads/googleads/v0/resources/customer_pb.rb +29 -0
  101. data/lib/google/ads/googleads/v0/resources/google_ads_field_pb.rb +38 -0
  102. data/lib/google/ads/googleads/v0/resources/keyword_view_pb.rb +22 -0
  103. data/lib/google/ads/googleads/v0/services/ad_group_ad_service_client.rb +262 -0
  104. data/lib/google/ads/googleads/v0/services/ad_group_ad_service_client_config.json +36 -0
  105. data/lib/google/ads/googleads/v0/services/ad_group_ad_service_pb.rb +47 -0
  106. data/lib/google/ads/googleads/v0/services/ad_group_ad_service_services_pb.rb +51 -0
  107. data/lib/google/ads/googleads/v0/services/ad_group_criterion_service_client.rb +262 -0
  108. data/lib/google/ads/googleads/v0/services/ad_group_criterion_service_client_config.json +36 -0
  109. data/lib/google/ads/googleads/v0/services/ad_group_criterion_service_pb.rb +47 -0
  110. data/lib/google/ads/googleads/v0/services/ad_group_criterion_service_services_pb.rb +51 -0
  111. data/lib/google/ads/googleads/v0/services/ad_group_service_client.rb +262 -0
  112. data/lib/google/ads/googleads/v0/services/ad_group_service_client_config.json +36 -0
  113. data/lib/google/ads/googleads/v0/services/ad_group_service_pb.rb +47 -0
  114. data/lib/google/ads/googleads/v0/services/ad_group_service_services_pb.rb +51 -0
  115. data/lib/google/ads/googleads/v0/services/bidding_strategy_service_client.rb +263 -0
  116. data/lib/google/ads/googleads/v0/services/bidding_strategy_service_client_config.json +36 -0
  117. data/lib/google/ads/googleads/v0/services/bidding_strategy_service_pb.rb +47 -0
  118. data/lib/google/ads/googleads/v0/services/bidding_strategy_service_services_pb.rb +52 -0
  119. data/lib/google/ads/googleads/v0/services/campaign_budget_service_client.rb +263 -0
  120. data/lib/google/ads/googleads/v0/services/campaign_budget_service_client_config.json +36 -0
  121. data/lib/google/ads/googleads/v0/services/campaign_budget_service_pb.rb +47 -0
  122. data/lib/google/ads/googleads/v0/services/campaign_budget_service_services_pb.rb +52 -0
  123. data/lib/google/ads/googleads/v0/services/campaign_criterion_service_client.rb +262 -0
  124. data/lib/google/ads/googleads/v0/services/campaign_criterion_service_client_config.json +36 -0
  125. data/lib/google/ads/googleads/v0/services/campaign_criterion_service_pb.rb +47 -0
  126. data/lib/google/ads/googleads/v0/services/campaign_criterion_service_services_pb.rb +51 -0
  127. data/lib/google/ads/googleads/v0/services/campaign_service_client.rb +262 -0
  128. data/lib/google/ads/googleads/v0/services/campaign_service_client_config.json +36 -0
  129. data/lib/google/ads/googleads/v0/services/campaign_service_pb.rb +47 -0
  130. data/lib/google/ads/googleads/v0/services/campaign_service_services_pb.rb +51 -0
  131. data/lib/google/ads/googleads/v0/services/credentials.rb +33 -0
  132. data/lib/google/ads/googleads/v0/services/customer_service_client.rb +214 -0
  133. data/lib/google/ads/googleads/v0/services/customer_service_client_config.json +31 -0
  134. data/lib/google/ads/googleads/v0/services/customer_service_pb.rb +24 -0
  135. data/lib/google/ads/googleads/v0/services/customer_service_services_pb.rb +49 -0
  136. data/lib/google/ads/googleads/v0/services/google_ads_field_service_client.rb +285 -0
  137. data/lib/google/ads/googleads/v0/services/google_ads_field_service_client_config.json +36 -0
  138. data/lib/google/ads/googleads/v0/services/google_ads_field_service_pb.rb +36 -0
  139. data/lib/google/ads/googleads/v0/services/google_ads_field_service_services_pb.rb +51 -0
  140. data/lib/google/ads/googleads/v0/services/google_ads_service_client.rb +242 -0
  141. data/lib/google/ads/googleads/v0/services/google_ads_service_client_config.json +31 -0
  142. data/lib/google/ads/googleads/v0/services/google_ads_service_pb.rb +72 -0
  143. data/lib/google/ads/googleads/v0/services/google_ads_service_services_pb.rb +49 -0
  144. data/lib/google/ads/googleads/v0/services/keyword_view_service_client.rb +216 -0
  145. data/lib/google/ads/googleads/v0/services/keyword_view_service_client_config.json +31 -0
  146. data/lib/google/ads/googleads/v0/services/keyword_view_service_pb.rb +24 -0
  147. data/lib/google/ads/googleads/v0/services/keyword_view_service_services_pb.rb +49 -0
  148. data/lib/google/ads/googleads/version.rb +25 -0
  149. data/lib/google/ads/googleads/wrapper_util.rb +48 -0
  150. metadata +248 -0
@@ -0,0 +1,36 @@
1
+ {
2
+ "interfaces": {
3
+ "google.ads.googleads.v0.services.GoogleAdsFieldService": {
4
+ "retry_codes": {
5
+ "idempotent": [
6
+ "DEADLINE_EXCEEDED",
7
+ "UNAVAILABLE"
8
+ ],
9
+ "non_idempotent": []
10
+ },
11
+ "retry_params": {
12
+ "default": {
13
+ "initial_retry_delay_millis": 100,
14
+ "retry_delay_multiplier": 1.3,
15
+ "max_retry_delay_millis": 60000,
16
+ "initial_rpc_timeout_millis": 20000,
17
+ "rpc_timeout_multiplier": 1.0,
18
+ "max_rpc_timeout_millis": 20000,
19
+ "total_timeout_millis": 600000
20
+ }
21
+ },
22
+ "methods": {
23
+ "GetGoogleAdsField": {
24
+ "timeout_millis": 600000,
25
+ "retry_codes_name": "idempotent",
26
+ "retry_params_name": "default"
27
+ },
28
+ "SearchGoogleAdsFields": {
29
+ "timeout_millis": 600000,
30
+ "retry_codes_name": "non_idempotent",
31
+ "retry_params_name": "default"
32
+ }
33
+ }
34
+ }
35
+ }
36
+ }
@@ -0,0 +1,36 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: google/ads/googleads/v0/services/google_ads_field_service.proto
3
+
4
+ require 'google/protobuf'
5
+
6
+ require 'google/ads/googleads/v0/resources/google_ads_field_pb'
7
+ require 'google/api/annotations_pb'
8
+ Google::Protobuf::DescriptorPool.generated_pool.build do
9
+ add_message "google.ads.googleads.v0.services.GetGoogleAdsFieldRequest" do
10
+ optional :resource_name, :string, 1
11
+ end
12
+ add_message "google.ads.googleads.v0.services.SearchGoogleAdsFieldsRequest" do
13
+ optional :query, :string, 1
14
+ optional :page_token, :string, 2
15
+ optional :page_size, :int32, 3
16
+ end
17
+ add_message "google.ads.googleads.v0.services.SearchGoogleAdsFieldsResponse" do
18
+ repeated :results, :message, 1, "google.ads.googleads.v0.resources.GoogleAdsField"
19
+ optional :next_page_token, :string, 2
20
+ optional :total_results_count, :int64, 3
21
+ end
22
+ end
23
+
24
+ module Google
25
+ module Ads
26
+ module Googleads
27
+ module V0
28
+ module Services
29
+ GetGoogleAdsFieldRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.ads.googleads.v0.services.GetGoogleAdsFieldRequest").msgclass
30
+ SearchGoogleAdsFieldsRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.ads.googleads.v0.services.SearchGoogleAdsFieldsRequest").msgclass
31
+ SearchGoogleAdsFieldsResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.ads.googleads.v0.services.SearchGoogleAdsFieldsResponse").msgclass
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,51 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # Source: google/ads/googleads/v0/services/google_ads_field_service.proto for package 'google.ads.googleads.v0.services'
3
+ # Original file comments:
4
+ # Copyright 2018 Google Inc.
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ require 'grpc'
20
+ require 'google/ads/googleads/v0/services/google_ads_field_service_pb'
21
+
22
+ module Google
23
+ module Ads
24
+ module Googleads
25
+ module V0
26
+ module Services
27
+ module GoogleAdsFieldService
28
+ # Proto file describing the GoogleAdsFieldService
29
+ #
30
+ # Service to fetch Google Ads API fields.
31
+ class Service
32
+
33
+ include GRPC::GenericService
34
+
35
+ self.marshal_class_method = :encode
36
+ self.unmarshal_class_method = :decode
37
+ self.service_name = 'google.ads.googleads.v0.services.GoogleAdsFieldService'
38
+
39
+ # Returns just the requested field.
40
+ rpc :GetGoogleAdsField, GetGoogleAdsFieldRequest, Google::Ads::Googleads::V0::Resources::GoogleAdsField
41
+ # Returns all fields that match the search query.
42
+ rpc :SearchGoogleAdsFields, SearchGoogleAdsFieldsRequest, SearchGoogleAdsFieldsResponse
43
+ end
44
+
45
+ Stub = Service.rpc_stub_class
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,242 @@
1
+ # Copyright 2018 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ #
15
+ # EDITING INSTRUCTIONS
16
+ # This file was generated from the file
17
+ # https://github.com/googleapis/googleapis/blob/master/google/ads/googleads/v0/services/google_ads_service.proto,
18
+ # and updates to that file get reflected here through a refresh process.
19
+ # For the short term, the refresh process will only be runnable by Google
20
+ # engineers.
21
+
22
+ require "json"
23
+ require "pathname"
24
+
25
+ require "google/gax"
26
+
27
+ require "google/ads/googleads/v0/services/google_ads_service_pb"
28
+ require "google/ads/googleads/v0/services/credentials"
29
+
30
+ module Google
31
+ module Ads
32
+ module Googleads
33
+ module V0
34
+ module Services
35
+ # Service to fetch data and metrics across resources.
36
+ #
37
+ # @!attribute [r] google_ads_service_stub
38
+ # @return [Google::Ads::Googleads::V0::Services::GoogleAdsService::Stub]
39
+ class GoogleAdsServiceClient
40
+ attr_reader :google_ads_service_stub
41
+
42
+ # The default address of the service.
43
+ SERVICE_ADDRESS = "googleads.googleapis.com".freeze
44
+
45
+ # The default port of the service.
46
+ DEFAULT_SERVICE_PORT = 443
47
+
48
+ DEFAULT_TIMEOUT = 30
49
+
50
+ PAGE_DESCRIPTORS = {
51
+ "search" => Google::Gax::PageDescriptor.new(
52
+ "page_token",
53
+ "next_page_token",
54
+ "results")
55
+ }.freeze
56
+
57
+ private_constant :PAGE_DESCRIPTORS
58
+
59
+ # The scopes needed to make gRPC calls to all of the methods defined in
60
+ # this service.
61
+ ALL_SCOPES = [
62
+ ].freeze
63
+
64
+
65
+ # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
66
+ # Provides the means for authenticating requests made by the client. This parameter can
67
+ # be many types.
68
+ # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
69
+ # authenticating requests made by this client.
70
+ # A `String` will be treated as the path to the keyfile to be used for the construction of
71
+ # credentials for this client.
72
+ # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
73
+ # credentials for this client.
74
+ # A `GRPC::Core::Channel` will be used to make calls through.
75
+ # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
76
+ # should already be composed with a `GRPC::Core::CallCredentials` object.
77
+ # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
78
+ # metadata for requests, generally, to give OAuth credentials.
79
+ # @param scopes [Array<String>]
80
+ # The OAuth scopes for this service. This parameter is ignored if
81
+ # an updater_proc is supplied.
82
+ # @param client_config [Hash]
83
+ # A Hash for call options for each method. See
84
+ # Google::Gax#construct_settings for the structure of
85
+ # this data. Falls back to the default config if not specified
86
+ # or the specified config is missing data points.
87
+ # @param timeout [Numeric]
88
+ # The default timeout, in seconds, for calls made through this client.
89
+ # @param metadata [Hash]
90
+ # Default metadata to be sent with each request. This can be overridden on a per call basis.
91
+ # @param exception_transformer [Proc]
92
+ # An optional proc that intercepts any exceptions raised during an API call to inject
93
+ # custom error handling.
94
+ def initialize \
95
+ credentials: nil,
96
+ scopes: ALL_SCOPES,
97
+ client_config: {},
98
+ timeout: DEFAULT_TIMEOUT,
99
+ metadata: nil,
100
+ exception_transformer: nil,
101
+ lib_name: nil,
102
+ lib_version: ""
103
+ # These require statements are intentionally placed here to initialize
104
+ # the gRPC module only when it's required.
105
+ # See https://github.com/googleapis/toolkit/issues/446
106
+ require "google/gax/grpc"
107
+ require "google/ads/googleads/v0/services/google_ads_service_services_pb"
108
+
109
+ credentials ||= Google::Ads::Googleads::V0::Services::Credentials.default
110
+
111
+ if credentials.is_a?(String) || credentials.is_a?(Hash)
112
+ updater_proc = Google::Ads::Googleads::V0::Services::Credentials.new(credentials).updater_proc
113
+ end
114
+ if credentials.is_a?(GRPC::Core::Channel)
115
+ channel = credentials
116
+ end
117
+ if credentials.is_a?(GRPC::Core::ChannelCredentials)
118
+ chan_creds = credentials
119
+ end
120
+ if credentials.is_a?(Proc)
121
+ updater_proc = credentials
122
+ end
123
+ if credentials.is_a?(Google::Auth::Credentials)
124
+ updater_proc = credentials.updater_proc
125
+ end
126
+
127
+ package_version = Gem.loaded_specs['google-ads-googleads'].version.version
128
+
129
+ google_api_client = "gl-ruby/#{RUBY_VERSION}"
130
+ google_api_client << " #{lib_name}/#{lib_version}" if lib_name
131
+ google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
132
+ google_api_client << " grpc/#{GRPC::VERSION}"
133
+ google_api_client.freeze
134
+
135
+ headers = { :"x-goog-api-client" => google_api_client }
136
+ headers.merge!(metadata) unless metadata.nil?
137
+ client_config_file = Pathname.new(__dir__).join(
138
+ "google_ads_service_client_config.json"
139
+ )
140
+ defaults = client_config_file.open do |f|
141
+ Google::Gax.construct_settings(
142
+ "google.ads.googleads.v0.services.GoogleAdsService",
143
+ JSON.parse(f.read),
144
+ client_config,
145
+ Google::Gax::Grpc::STATUS_CODE_NAMES,
146
+ timeout,
147
+ page_descriptors: PAGE_DESCRIPTORS,
148
+ errors: Google::Gax::Grpc::API_ERRORS,
149
+ metadata: headers
150
+ )
151
+ end
152
+
153
+ # Allow overriding the service path/port in subclasses.
154
+ service_path = self.class::SERVICE_ADDRESS
155
+ port = self.class::DEFAULT_SERVICE_PORT
156
+ @google_ads_service_stub = Google::Gax::Grpc.create_stub(
157
+ service_path,
158
+ port,
159
+ chan_creds: chan_creds,
160
+ channel: channel,
161
+ updater_proc: updater_proc,
162
+ scopes: scopes,
163
+ &Google::Ads::Googleads::V0::Services::GoogleAdsService::Stub.method(:new)
164
+ )
165
+
166
+ @search = Google::Gax.create_api_call(
167
+ @google_ads_service_stub.method(:search),
168
+ defaults["search"],
169
+ exception_transformer: exception_transformer
170
+ )
171
+ end
172
+
173
+ # Service calls
174
+
175
+ # Returns all rows that match the search query.
176
+ #
177
+ # @param customer_id [String]
178
+ # The ID of the customer being queried.
179
+ # @param query [String]
180
+ # The query string.
181
+ # @param page_size [Integer]
182
+ # The maximum number of resources contained in the underlying API
183
+ # response. If page streaming is performed per-resource, this
184
+ # parameter does not affect the return value. If page streaming is
185
+ # performed per-page, this determines the maximum number of
186
+ # resources in a page.
187
+ # @param options [Google::Gax::CallOptions]
188
+ # Overrides the default settings for this call, e.g, timeout,
189
+ # retries, etc.
190
+ # @yield [result, operation] Access the result along with the RPC operation
191
+ # @yieldparam result [Google::Gax::PagedEnumerable<Google::Ads::Googleads::V0::Services::GoogleAdsRow>]
192
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
193
+ # @return [Google::Gax::PagedEnumerable<Google::Ads::Googleads::V0::Services::GoogleAdsRow>]
194
+ # An enumerable of Google::Ads::Googleads::V0::Services::GoogleAdsRow instances.
195
+ # See Google::Gax::PagedEnumerable documentation for other
196
+ # operations such as per-page iteration or access to the response
197
+ # object.
198
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
199
+ # @example
200
+ # require "google/ads/googleads/v0/services"
201
+ #
202
+ # google_ads_service_client = Google::Ads::Googleads::V0::Services::GoogleAds.new
203
+ #
204
+ # # TODO: Initialize +customer_id+:
205
+ # customer_id = ''
206
+ #
207
+ # # TODO: Initialize +query+:
208
+ # query = ''
209
+ #
210
+ # # Iterate over all results.
211
+ # google_ads_service_client.search(customer_id, query).each do |element|
212
+ # # Process element.
213
+ # end
214
+ #
215
+ # # Or iterate over results one page at a time.
216
+ # google_ads_service_client.search(customer_id, query).each_page do |page|
217
+ # # Process each page at a time.
218
+ # page.each do |element|
219
+ # # Process element.
220
+ # end
221
+ # end
222
+
223
+ def search \
224
+ customer_id,
225
+ query,
226
+ page_size: nil,
227
+ options: nil,
228
+ &block
229
+ req = {
230
+ customer_id: customer_id,
231
+ query: query,
232
+ page_size: page_size
233
+ }.delete_if { |_, v| v.nil? }
234
+ req = Google::Gax::to_proto(req, Google::Ads::Googleads::V0::Services::SearchGoogleAdsRequest)
235
+ @search.call(req, options, &block)
236
+ end
237
+ end
238
+ end
239
+ end
240
+ end
241
+ end
242
+ end
@@ -0,0 +1,31 @@
1
+ {
2
+ "interfaces": {
3
+ "google.ads.googleads.v0.services.GoogleAdsService": {
4
+ "retry_codes": {
5
+ "idempotent": [
6
+ "DEADLINE_EXCEEDED",
7
+ "UNAVAILABLE"
8
+ ],
9
+ "non_idempotent": []
10
+ },
11
+ "retry_params": {
12
+ "default": {
13
+ "initial_retry_delay_millis": 100,
14
+ "retry_delay_multiplier": 1.3,
15
+ "max_retry_delay_millis": 60000,
16
+ "initial_rpc_timeout_millis": 20000,
17
+ "rpc_timeout_multiplier": 1.0,
18
+ "max_rpc_timeout_millis": 20000,
19
+ "total_timeout_millis": 600000
20
+ }
21
+ },
22
+ "methods": {
23
+ "Search": {
24
+ "timeout_millis": 600000,
25
+ "retry_codes_name": "non_idempotent",
26
+ "retry_params_name": "default"
27
+ }
28
+ }
29
+ }
30
+ }
31
+ }
@@ -0,0 +1,72 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: google/ads/googleads/v0/services/google_ads_service.proto
3
+
4
+ require 'google/protobuf'
5
+
6
+ require 'google/ads/googleads/v0/common/metrics_pb'
7
+ require 'google/ads/googleads/v0/enums/ad_network_type_pb'
8
+ require 'google/ads/googleads/v0/enums/day_of_week_pb'
9
+ require 'google/ads/googleads/v0/enums/device_pb'
10
+ require 'google/ads/googleads/v0/enums/slot_pb'
11
+ require 'google/ads/googleads/v0/resources/ad_group_pb'
12
+ require 'google/ads/googleads/v0/resources/ad_group_ad_pb'
13
+ require 'google/ads/googleads/v0/resources/ad_group_criterion_pb'
14
+ require 'google/ads/googleads/v0/resources/bidding_strategy_pb'
15
+ require 'google/ads/googleads/v0/resources/campaign_pb'
16
+ require 'google/ads/googleads/v0/resources/campaign_budget_pb'
17
+ require 'google/ads/googleads/v0/resources/campaign_criterion_pb'
18
+ require 'google/ads/googleads/v0/resources/customer_pb'
19
+ require 'google/ads/googleads/v0/resources/keyword_view_pb'
20
+ require 'google/api/annotations_pb'
21
+ require 'google/protobuf/field_mask_pb'
22
+ require 'google/protobuf/wrappers_pb'
23
+ Google::Protobuf::DescriptorPool.generated_pool.build do
24
+ add_message "google.ads.googleads.v0.services.SearchGoogleAdsRequest" do
25
+ optional :customer_id, :string, 1
26
+ optional :query, :string, 2
27
+ optional :page_token, :string, 3
28
+ optional :page_size, :int32, 4
29
+ end
30
+ add_message "google.ads.googleads.v0.services.SearchGoogleAdsResponse" do
31
+ repeated :results, :message, 1, "google.ads.googleads.v0.services.GoogleAdsRow"
32
+ optional :next_page_token, :string, 2
33
+ optional :total_results_count, :int64, 3
34
+ optional :field_mask, :message, 5, "google.protobuf.FieldMask"
35
+ end
36
+ add_message "google.ads.googleads.v0.services.GoogleAdsRow" do
37
+ optional :ad_group, :message, 3, "google.ads.googleads.v0.resources.AdGroup"
38
+ optional :ad_group_ad, :message, 16, "google.ads.googleads.v0.resources.AdGroupAd"
39
+ optional :ad_group_criterion, :message, 17, "google.ads.googleads.v0.resources.AdGroupCriterion"
40
+ optional :bidding_strategy, :message, 18, "google.ads.googleads.v0.resources.BiddingStrategy"
41
+ optional :campaign_budget, :message, 19, "google.ads.googleads.v0.resources.CampaignBudget"
42
+ optional :campaign, :message, 2, "google.ads.googleads.v0.resources.Campaign"
43
+ optional :campaign_criterion, :message, 20, "google.ads.googleads.v0.resources.CampaignCriterion"
44
+ optional :customer, :message, 1, "google.ads.googleads.v0.resources.Customer"
45
+ optional :keyword_view, :message, 21, "google.ads.googleads.v0.resources.KeywordView"
46
+ optional :metrics, :message, 4, "google.ads.googleads.v0.common.Metrics"
47
+ optional :ad_network_type, :enum, 5, "google.ads.googleads.v0.enums.AdNetworkTypeEnum.AdNetworkType"
48
+ optional :date, :message, 6, "google.protobuf.StringValue"
49
+ optional :day_of_week, :enum, 7, "google.ads.googleads.v0.enums.DayOfWeekEnum.DayOfWeek"
50
+ optional :device, :enum, 8, "google.ads.googleads.v0.enums.DeviceEnum.Device"
51
+ optional :hour, :message, 9, "google.protobuf.Int32Value"
52
+ optional :month, :message, 10, "google.protobuf.StringValue"
53
+ optional :quarter, :message, 12, "google.protobuf.StringValue"
54
+ optional :slot, :enum, 13, "google.ads.googleads.v0.enums.SlotEnum.Slot"
55
+ optional :week, :message, 14, "google.protobuf.StringValue"
56
+ optional :year, :message, 15, "google.protobuf.Int32Value"
57
+ end
58
+ end
59
+
60
+ module Google
61
+ module Ads
62
+ module Googleads
63
+ module V0
64
+ module Services
65
+ SearchGoogleAdsRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.ads.googleads.v0.services.SearchGoogleAdsRequest").msgclass
66
+ SearchGoogleAdsResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.ads.googleads.v0.services.SearchGoogleAdsResponse").msgclass
67
+ GoogleAdsRow = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.ads.googleads.v0.services.GoogleAdsRow").msgclass
68
+ end
69
+ end
70
+ end
71
+ end
72
+ end