google-ads-googleads 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,33 @@
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
+ require "googleauth"
16
+
17
+ module Google
18
+ module Ads
19
+ module Googleads
20
+ module V0
21
+ module Services
22
+ class Credentials < Google::Auth::Credentials
23
+ SCOPE = [
24
+ ].freeze
25
+ PATH_ENV_VARS = %w(GOOGLEADS_KEYFILE GOOGLE_CLOUD_KEYFILE GCLOUD_KEYFILE)
26
+ JSON_ENV_VARS = %w(GOOGLEADS_KEYFILE_JSON GOOGLE_CLOUD_KEYFILE_JSON GCLOUD_KEYFILE_JSON)
27
+ DEFAULT_PATHS = ["~/.config/gcloud/application_default_credentials.json"]
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,214 @@
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/customer_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/customer_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 manage customers.
36
+ #
37
+ # @!attribute [r] customer_service_stub
38
+ # @return [Google::Ads::Googleads::V0::Services::CustomerService::Stub]
39
+ class CustomerServiceClient
40
+ attr_reader :customer_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
+ # The scopes needed to make gRPC calls to all of the methods defined in
51
+ # this service.
52
+ ALL_SCOPES = [
53
+ ].freeze
54
+
55
+
56
+ CUSTOMER_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
57
+ "customers/{customer}"
58
+ )
59
+
60
+ private_constant :CUSTOMER_PATH_TEMPLATE
61
+
62
+ # Returns a fully-qualified customer resource name string.
63
+ # @param customer [String]
64
+ # @return [String]
65
+ def self.customer_path customer
66
+ CUSTOMER_PATH_TEMPLATE.render(
67
+ :"customer" => customer
68
+ )
69
+ end
70
+
71
+ # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
72
+ # Provides the means for authenticating requests made by the client. This parameter can
73
+ # be many types.
74
+ # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
75
+ # authenticating requests made by this client.
76
+ # A `String` will be treated as the path to the keyfile to be used for the construction of
77
+ # credentials for this client.
78
+ # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
79
+ # credentials for this client.
80
+ # A `GRPC::Core::Channel` will be used to make calls through.
81
+ # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
82
+ # should already be composed with a `GRPC::Core::CallCredentials` object.
83
+ # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
84
+ # metadata for requests, generally, to give OAuth credentials.
85
+ # @param scopes [Array<String>]
86
+ # The OAuth scopes for this service. This parameter is ignored if
87
+ # an updater_proc is supplied.
88
+ # @param client_config [Hash]
89
+ # A Hash for call options for each method. See
90
+ # Google::Gax#construct_settings for the structure of
91
+ # this data. Falls back to the default config if not specified
92
+ # or the specified config is missing data points.
93
+ # @param timeout [Numeric]
94
+ # The default timeout, in seconds, for calls made through this client.
95
+ # @param metadata [Hash]
96
+ # Default metadata to be sent with each request. This can be overridden on a per call basis.
97
+ # @param exception_transformer [Proc]
98
+ # An optional proc that intercepts any exceptions raised during an API call to inject
99
+ # custom error handling.
100
+ def initialize \
101
+ credentials: nil,
102
+ scopes: ALL_SCOPES,
103
+ client_config: {},
104
+ timeout: DEFAULT_TIMEOUT,
105
+ metadata: nil,
106
+ exception_transformer: nil,
107
+ lib_name: nil,
108
+ lib_version: ""
109
+ # These require statements are intentionally placed here to initialize
110
+ # the gRPC module only when it's required.
111
+ # See https://github.com/googleapis/toolkit/issues/446
112
+ require "google/gax/grpc"
113
+ require "google/ads/googleads/v0/services/customer_service_services_pb"
114
+
115
+ credentials ||= Google::Ads::Googleads::V0::Services::Credentials.default
116
+
117
+ if credentials.is_a?(String) || credentials.is_a?(Hash)
118
+ updater_proc = Google::Ads::Googleads::V0::Services::Credentials.new(credentials).updater_proc
119
+ end
120
+ if credentials.is_a?(GRPC::Core::Channel)
121
+ channel = credentials
122
+ end
123
+ if credentials.is_a?(GRPC::Core::ChannelCredentials)
124
+ chan_creds = credentials
125
+ end
126
+ if credentials.is_a?(Proc)
127
+ updater_proc = credentials
128
+ end
129
+ if credentials.is_a?(Google::Auth::Credentials)
130
+ updater_proc = credentials.updater_proc
131
+ end
132
+
133
+ package_version = Gem.loaded_specs['google-ads-googleads'].version.version
134
+
135
+ google_api_client = "gl-ruby/#{RUBY_VERSION}"
136
+ google_api_client << " #{lib_name}/#{lib_version}" if lib_name
137
+ google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
138
+ google_api_client << " grpc/#{GRPC::VERSION}"
139
+ google_api_client.freeze
140
+
141
+ headers = { :"x-goog-api-client" => google_api_client }
142
+ headers.merge!(metadata) unless metadata.nil?
143
+ client_config_file = Pathname.new(__dir__).join(
144
+ "customer_service_client_config.json"
145
+ )
146
+ defaults = client_config_file.open do |f|
147
+ Google::Gax.construct_settings(
148
+ "google.ads.googleads.v0.services.CustomerService",
149
+ JSON.parse(f.read),
150
+ client_config,
151
+ Google::Gax::Grpc::STATUS_CODE_NAMES,
152
+ timeout,
153
+ errors: Google::Gax::Grpc::API_ERRORS,
154
+ metadata: headers
155
+ )
156
+ end
157
+
158
+ # Allow overriding the service path/port in subclasses.
159
+ service_path = self.class::SERVICE_ADDRESS
160
+ port = self.class::DEFAULT_SERVICE_PORT
161
+ @customer_service_stub = Google::Gax::Grpc.create_stub(
162
+ service_path,
163
+ port,
164
+ chan_creds: chan_creds,
165
+ channel: channel,
166
+ updater_proc: updater_proc,
167
+ scopes: scopes,
168
+ &Google::Ads::Googleads::V0::Services::CustomerService::Stub.method(:new)
169
+ )
170
+
171
+ @get_customer = Google::Gax.create_api_call(
172
+ @customer_service_stub.method(:get_customer),
173
+ defaults["get_customer"],
174
+ exception_transformer: exception_transformer
175
+ )
176
+ end
177
+
178
+ # Service calls
179
+
180
+ # Returns the requested customer in full detail.
181
+ #
182
+ # @param resource_name [String]
183
+ # The resource name of the customer to fetch.
184
+ # @param options [Google::Gax::CallOptions]
185
+ # Overrides the default settings for this call, e.g, timeout,
186
+ # retries, etc.
187
+ # @yield [result, operation] Access the result along with the RPC operation
188
+ # @yieldparam result [Google::Ads::Googleads::V0::Resources::Customer]
189
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
190
+ # @return [Google::Ads::Googleads::V0::Resources::Customer]
191
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
192
+ # @example
193
+ # require "google/ads/googleads/v0/services"
194
+ #
195
+ # customer_service_client = Google::Ads::Googleads::V0::Services::Customer.new
196
+ # formatted_resource_name = Google::Ads::Googleads::V0::Services::CustomerServiceClient.customer_path("[CUSTOMER]")
197
+ # response = customer_service_client.get_customer(formatted_resource_name)
198
+
199
+ def get_customer \
200
+ resource_name,
201
+ options: nil,
202
+ &block
203
+ req = {
204
+ resource_name: resource_name
205
+ }.delete_if { |_, v| v.nil? }
206
+ req = Google::Gax::to_proto(req, Google::Ads::Googleads::V0::Services::GetCustomerRequest)
207
+ @get_customer.call(req, options, &block)
208
+ end
209
+ end
210
+ end
211
+ end
212
+ end
213
+ end
214
+ end
@@ -0,0 +1,31 @@
1
+ {
2
+ "interfaces": {
3
+ "google.ads.googleads.v0.services.CustomerService": {
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
+ "GetCustomer": {
24
+ "timeout_millis": 60000,
25
+ "retry_codes_name": "idempotent",
26
+ "retry_params_name": "default"
27
+ }
28
+ }
29
+ }
30
+ }
31
+ }
@@ -0,0 +1,24 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: google/ads/googleads/v0/services/customer_service.proto
3
+
4
+ require 'google/protobuf'
5
+
6
+ require 'google/ads/googleads/v0/resources/customer_pb'
7
+ require 'google/api/annotations_pb'
8
+ Google::Protobuf::DescriptorPool.generated_pool.build do
9
+ add_message "google.ads.googleads.v0.services.GetCustomerRequest" do
10
+ optional :resource_name, :string, 1
11
+ end
12
+ end
13
+
14
+ module Google
15
+ module Ads
16
+ module Googleads
17
+ module V0
18
+ module Services
19
+ GetCustomerRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.ads.googleads.v0.services.GetCustomerRequest").msgclass
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,49 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # Source: google/ads/googleads/v0/services/customer_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/customer_service_pb'
21
+
22
+ module Google
23
+ module Ads
24
+ module Googleads
25
+ module V0
26
+ module Services
27
+ module CustomerService
28
+ # Proto file describing the Customer service.
29
+ #
30
+ # Service to manage customers.
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.CustomerService'
38
+
39
+ # Returns the requested customer in full detail.
40
+ rpc :GetCustomer, GetCustomerRequest, Google::Ads::Googleads::V0::Resources::Customer
41
+ end
42
+
43
+ Stub = Service.rpc_stub_class
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,285 @@
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_field_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_field_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 Google Ads API fields.
36
+ #
37
+ # @!attribute [r] google_ads_field_service_stub
38
+ # @return [Google::Ads::Googleads::V0::Services::GoogleAdsFieldService::Stub]
39
+ class GoogleAdsFieldServiceClient
40
+ attr_reader :google_ads_field_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_ads_fields" => 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
+ GOOGLE_ADS_FIELD_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
66
+ "googleAdsFields/{google_ads_field}"
67
+ )
68
+
69
+ private_constant :GOOGLE_ADS_FIELD_PATH_TEMPLATE
70
+
71
+ # Returns a fully-qualified google_ads_field resource name string.
72
+ # @param google_ads_field [String]
73
+ # @return [String]
74
+ def self.google_ads_field_path google_ads_field
75
+ GOOGLE_ADS_FIELD_PATH_TEMPLATE.render(
76
+ :"google_ads_field" => google_ads_field
77
+ )
78
+ end
79
+
80
+ # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
81
+ # Provides the means for authenticating requests made by the client. This parameter can
82
+ # be many types.
83
+ # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
84
+ # authenticating requests made by this client.
85
+ # A `String` will be treated as the path to the keyfile to be used for the construction of
86
+ # credentials for this client.
87
+ # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
88
+ # credentials for this client.
89
+ # A `GRPC::Core::Channel` will be used to make calls through.
90
+ # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
91
+ # should already be composed with a `GRPC::Core::CallCredentials` object.
92
+ # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
93
+ # metadata for requests, generally, to give OAuth credentials.
94
+ # @param scopes [Array<String>]
95
+ # The OAuth scopes for this service. This parameter is ignored if
96
+ # an updater_proc is supplied.
97
+ # @param client_config [Hash]
98
+ # A Hash for call options for each method. See
99
+ # Google::Gax#construct_settings for the structure of
100
+ # this data. Falls back to the default config if not specified
101
+ # or the specified config is missing data points.
102
+ # @param timeout [Numeric]
103
+ # The default timeout, in seconds, for calls made through this client.
104
+ # @param metadata [Hash]
105
+ # Default metadata to be sent with each request. This can be overridden on a per call basis.
106
+ # @param exception_transformer [Proc]
107
+ # An optional proc that intercepts any exceptions raised during an API call to inject
108
+ # custom error handling.
109
+ def initialize \
110
+ credentials: nil,
111
+ scopes: ALL_SCOPES,
112
+ client_config: {},
113
+ timeout: DEFAULT_TIMEOUT,
114
+ metadata: nil,
115
+ exception_transformer: nil,
116
+ lib_name: nil,
117
+ lib_version: ""
118
+ # These require statements are intentionally placed here to initialize
119
+ # the gRPC module only when it's required.
120
+ # See https://github.com/googleapis/toolkit/issues/446
121
+ require "google/gax/grpc"
122
+ require "google/ads/googleads/v0/services/google_ads_field_service_services_pb"
123
+
124
+ credentials ||= Google::Ads::Googleads::V0::Services::Credentials.default
125
+
126
+ if credentials.is_a?(String) || credentials.is_a?(Hash)
127
+ updater_proc = Google::Ads::Googleads::V0::Services::Credentials.new(credentials).updater_proc
128
+ end
129
+ if credentials.is_a?(GRPC::Core::Channel)
130
+ channel = credentials
131
+ end
132
+ if credentials.is_a?(GRPC::Core::ChannelCredentials)
133
+ chan_creds = credentials
134
+ end
135
+ if credentials.is_a?(Proc)
136
+ updater_proc = credentials
137
+ end
138
+ if credentials.is_a?(Google::Auth::Credentials)
139
+ updater_proc = credentials.updater_proc
140
+ end
141
+
142
+ package_version = Gem.loaded_specs['google-ads-googleads'].version.version
143
+
144
+ google_api_client = "gl-ruby/#{RUBY_VERSION}"
145
+ google_api_client << " #{lib_name}/#{lib_version}" if lib_name
146
+ google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
147
+ google_api_client << " grpc/#{GRPC::VERSION}"
148
+ google_api_client.freeze
149
+
150
+ headers = { :"x-goog-api-client" => google_api_client }
151
+ headers.merge!(metadata) unless metadata.nil?
152
+ client_config_file = Pathname.new(__dir__).join(
153
+ "google_ads_field_service_client_config.json"
154
+ )
155
+ defaults = client_config_file.open do |f|
156
+ Google::Gax.construct_settings(
157
+ "google.ads.googleads.v0.services.GoogleAdsFieldService",
158
+ JSON.parse(f.read),
159
+ client_config,
160
+ Google::Gax::Grpc::STATUS_CODE_NAMES,
161
+ timeout,
162
+ page_descriptors: PAGE_DESCRIPTORS,
163
+ errors: Google::Gax::Grpc::API_ERRORS,
164
+ metadata: headers
165
+ )
166
+ end
167
+
168
+ # Allow overriding the service path/port in subclasses.
169
+ service_path = self.class::SERVICE_ADDRESS
170
+ port = self.class::DEFAULT_SERVICE_PORT
171
+ @google_ads_field_service_stub = Google::Gax::Grpc.create_stub(
172
+ service_path,
173
+ port,
174
+ chan_creds: chan_creds,
175
+ channel: channel,
176
+ updater_proc: updater_proc,
177
+ scopes: scopes,
178
+ &Google::Ads::Googleads::V0::Services::GoogleAdsFieldService::Stub.method(:new)
179
+ )
180
+
181
+ @get_google_ads_field = Google::Gax.create_api_call(
182
+ @google_ads_field_service_stub.method(:get_google_ads_field),
183
+ defaults["get_google_ads_field"],
184
+ exception_transformer: exception_transformer
185
+ )
186
+ @search_google_ads_fields = Google::Gax.create_api_call(
187
+ @google_ads_field_service_stub.method(:search_google_ads_fields),
188
+ defaults["search_google_ads_fields"],
189
+ exception_transformer: exception_transformer
190
+ )
191
+ end
192
+
193
+ # Service calls
194
+
195
+ # Returns just the requested field.
196
+ #
197
+ # @param resource_name [String]
198
+ # The resource name of the field to get.
199
+ # @param options [Google::Gax::CallOptions]
200
+ # Overrides the default settings for this call, e.g, timeout,
201
+ # retries, etc.
202
+ # @yield [result, operation] Access the result along with the RPC operation
203
+ # @yieldparam result [Google::Ads::Googleads::V0::Resources::GoogleAdsField]
204
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
205
+ # @return [Google::Ads::Googleads::V0::Resources::GoogleAdsField]
206
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
207
+ # @example
208
+ # require "google/ads/googleads/v0/services"
209
+ #
210
+ # google_ads_field_service_client = Google::Ads::Googleads::V0::Services::GoogleAdsField.new
211
+ # formatted_resource_name = Google::Ads::Googleads::V0::Services::GoogleAdsFieldServiceClient.google_ads_field_path("[GOOGLE_ADS_FIELD]")
212
+ # response = google_ads_field_service_client.get_google_ads_field(formatted_resource_name)
213
+
214
+ def get_google_ads_field \
215
+ resource_name,
216
+ options: nil,
217
+ &block
218
+ req = {
219
+ resource_name: resource_name
220
+ }.delete_if { |_, v| v.nil? }
221
+ req = Google::Gax::to_proto(req, Google::Ads::Googleads::V0::Services::GetGoogleAdsFieldRequest)
222
+ @get_google_ads_field.call(req, options, &block)
223
+ end
224
+
225
+ # Returns all fields that match the search query.
226
+ #
227
+ # @param query [String]
228
+ # The query string.
229
+ # @param page_size [Integer]
230
+ # The maximum number of resources contained in the underlying API
231
+ # response. If page streaming is performed per-resource, this
232
+ # parameter does not affect the return value. If page streaming is
233
+ # performed per-page, this determines the maximum number of
234
+ # resources in a page.
235
+ # @param options [Google::Gax::CallOptions]
236
+ # Overrides the default settings for this call, e.g, timeout,
237
+ # retries, etc.
238
+ # @yield [result, operation] Access the result along with the RPC operation
239
+ # @yieldparam result [Google::Gax::PagedEnumerable<Google::Ads::Googleads::V0::Resources::GoogleAdsField>]
240
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
241
+ # @return [Google::Gax::PagedEnumerable<Google::Ads::Googleads::V0::Resources::GoogleAdsField>]
242
+ # An enumerable of Google::Ads::Googleads::V0::Resources::GoogleAdsField instances.
243
+ # See Google::Gax::PagedEnumerable documentation for other
244
+ # operations such as per-page iteration or access to the response
245
+ # object.
246
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
247
+ # @example
248
+ # require "google/ads/googleads/v0/services"
249
+ #
250
+ # google_ads_field_service_client = Google::Ads::Googleads::V0::Services::GoogleAdsField.new
251
+ #
252
+ # # TODO: Initialize +query+:
253
+ # query = ''
254
+ #
255
+ # # Iterate over all results.
256
+ # google_ads_field_service_client.search_google_ads_fields(query).each do |element|
257
+ # # Process element.
258
+ # end
259
+ #
260
+ # # Or iterate over results one page at a time.
261
+ # google_ads_field_service_client.search_google_ads_fields(query).each_page do |page|
262
+ # # Process each page at a time.
263
+ # page.each do |element|
264
+ # # Process element.
265
+ # end
266
+ # end
267
+
268
+ def search_google_ads_fields \
269
+ query,
270
+ page_size: nil,
271
+ options: nil,
272
+ &block
273
+ req = {
274
+ query: query,
275
+ page_size: page_size
276
+ }.delete_if { |_, v| v.nil? }
277
+ req = Google::Gax::to_proto(req, Google::Ads::Googleads::V0::Services::SearchGoogleAdsFieldsRequest)
278
+ @search_google_ads_fields.call(req, options, &block)
279
+ end
280
+ end
281
+ end
282
+ end
283
+ end
284
+ end
285
+ end