google-ads-googleads 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (161) hide show
  1. checksums.yaml +5 -5
  2. data/ChangeLog +3 -0
  3. data/lib/google/ads/googleads/path_lookup_util.rb +29 -0
  4. data/lib/google/ads/googleads/proto_lookup_util.rb +91 -10
  5. data/lib/google/ads/googleads/v0/common/{ad_pb.rb → ad_type_infos_pb.rb} +4 -22
  6. data/lib/google/ads/googleads/v0/common/criteria_pb.rb +37 -3
  7. data/lib/google/ads/googleads/v0/common/metrics_pb.rb +8 -8
  8. data/lib/google/ads/googleads/v0/common/policy_pb.rb +57 -0
  9. data/lib/google/ads/googleads/v0/enums/ad_group_type_pb.rb +2 -0
  10. data/lib/google/ads/googleads/v0/enums/ad_network_type_pb.rb +1 -0
  11. data/lib/google/ads/googleads/v0/enums/ad_type_pb.rb +1 -0
  12. data/lib/google/ads/googleads/v0/enums/advertising_channel_sub_type_pb.rb +3 -0
  13. data/lib/google/ads/googleads/v0/enums/advertising_channel_type_pb.rb +2 -0
  14. data/lib/google/ads/googleads/v0/enums/bid_modifier_source_pb.rb +28 -0
  15. data/lib/google/ads/googleads/v0/enums/campaign_group_status_pb.rb +28 -0
  16. data/lib/google/ads/googleads/v0/enums/campaign_shared_set_status_pb.rb +28 -0
  17. data/lib/google/ads/googleads/v0/enums/criterion_type_pb.rb +2 -1
  18. data/lib/google/ads/googleads/v0/enums/device_pb.rb +1 -0
  19. data/lib/google/ads/googleads/v0/enums/hotel_date_selection_type_pb.rb +28 -0
  20. data/lib/google/ads/googleads/v0/enums/interaction_type_pb.rb +27 -0
  21. data/lib/google/ads/googleads/v0/enums/minute_of_hour_pb.rb +30 -0
  22. data/lib/google/ads/googleads/v0/enums/month_of_year_pb.rb +38 -0
  23. data/lib/google/ads/googleads/v0/enums/policy_topic_entry_type_pb.rb +31 -0
  24. data/lib/google/ads/googleads/v0/enums/policy_topic_evidence_destination_mismatch_url_type_pb.rb +31 -0
  25. data/lib/google/ads/googleads/v0/enums/product_condition_pb.rb +30 -0
  26. data/lib/google/ads/googleads/v0/enums/product_type_level_pb.rb +31 -0
  27. data/lib/google/ads/googleads/v0/enums/recommendation_type_pb.rb +5 -0
  28. data/lib/google/ads/googleads/v0/enums/shared_set_status_pb.rb +28 -0
  29. data/lib/google/ads/googleads/v0/enums/shared_set_type_pb.rb +28 -0
  30. data/lib/google/ads/googleads/v0/enums/slot_pb.rb +1 -0
  31. data/lib/google/ads/googleads/v0/errors/authentication_error_pb.rb +2 -0
  32. data/lib/google/ads/googleads/v0/errors/authorization_error_pb.rb +2 -0
  33. data/lib/google/ads/googleads/v0/errors/campaign_criterion_error_pb.rb +1 -0
  34. data/lib/google/ads/googleads/v0/errors/campaign_error_pb.rb +1 -2
  35. data/lib/google/ads/googleads/v0/errors/campaign_group_error_pb.rb +29 -0
  36. data/lib/google/ads/googleads/v0/errors/campaign_shared_set_error_pb.rb +27 -0
  37. data/lib/google/ads/googleads/v0/errors/context_error_pb.rb +1 -0
  38. data/lib/google/ads/googleads/v0/errors/database_error_pb.rb +27 -0
  39. data/lib/google/ads/googleads/v0/errors/enum_error_pb.rb +27 -0
  40. data/lib/google/ads/googleads/v0/errors/errors_pb.rb +21 -0
  41. data/lib/google/ads/googleads/v0/errors/header_error_pb.rb +27 -0
  42. data/lib/google/ads/googleads/v0/errors/mutate_error_pb.rb +1 -0
  43. data/lib/google/ads/googleads/v0/errors/policy_finding_error_pb.rb +27 -0
  44. data/lib/google/ads/googleads/v0/errors/query_error_pb.rb +1 -0
  45. data/lib/google/ads/googleads/v0/errors/quota_error_pb.rb +1 -0
  46. data/lib/google/ads/googleads/v0/errors/recommendation_error_pb.rb +1 -0
  47. data/lib/google/ads/googleads/v0/errors/shared_criterion_error_pb.rb +27 -0
  48. data/lib/google/ads/googleads/v0/errors/shared_set_error_pb.rb +30 -0
  49. data/lib/google/ads/googleads/v0/resources/ad_group_ad_pb.rb +2 -2
  50. data/lib/google/ads/googleads/v0/resources/ad_group_bid_modifier_pb.rb +4 -0
  51. data/lib/google/ads/googleads/v0/resources/ad_pb.rb +42 -0
  52. data/lib/google/ads/googleads/v0/resources/campaign_bid_modifier_pb.rb +30 -0
  53. data/lib/google/ads/googleads/v0/resources/campaign_criterion_pb.rb +2 -1
  54. data/lib/google/ads/googleads/v0/resources/campaign_group_pb.rb +27 -0
  55. data/lib/google/ads/googleads/v0/resources/campaign_pb.rb +9 -0
  56. data/lib/google/ads/googleads/v0/resources/campaign_shared_set_pb.rb +27 -0
  57. data/lib/google/ads/googleads/v0/resources/recommendation_pb.rb +25 -2
  58. data/lib/google/ads/googleads/v0/resources/shared_criterion_pb.rb +31 -0
  59. data/lib/google/ads/googleads/v0/resources/shared_set_pb.rb +31 -0
  60. data/lib/google/ads/googleads/v0/services.rb +1163 -0
  61. data/lib/google/ads/googleads/v0/services/ad_group_ad_service_client.rb +4 -4
  62. data/lib/google/ads/googleads/v0/services/ad_group_ad_service_services_pb.rb +2 -3
  63. data/lib/google/ads/googleads/v0/services/ad_group_bid_modifier_service_client.rb +4 -4
  64. data/lib/google/ads/googleads/v0/services/ad_group_bid_modifier_service_services_pb.rb +2 -3
  65. data/lib/google/ads/googleads/v0/services/ad_group_criterion_service_client.rb +4 -4
  66. data/lib/google/ads/googleads/v0/services/ad_group_criterion_service_services_pb.rb +2 -3
  67. data/lib/google/ads/googleads/v0/services/ad_group_service_client.rb +4 -4
  68. data/lib/google/ads/googleads/v0/services/ad_group_service_services_pb.rb +2 -3
  69. data/lib/google/ads/googleads/v0/services/bidding_strategy_service_client.rb +4 -4
  70. data/lib/google/ads/googleads/v0/services/bidding_strategy_service_services_pb.rb +2 -3
  71. data/lib/google/ads/googleads/v0/services/campaign_bid_modifier_service_client.rb +268 -0
  72. data/lib/google/ads/googleads/v0/services/campaign_bid_modifier_service_client_config.json +36 -0
  73. data/lib/google/ads/googleads/v0/services/campaign_bid_modifier_service_pb.rb +47 -0
  74. data/lib/google/ads/googleads/v0/services/campaign_bid_modifier_service_services_pb.rb +51 -0
  75. data/lib/google/ads/googleads/v0/services/campaign_budget_service_client.rb +4 -4
  76. data/lib/google/ads/googleads/v0/services/campaign_budget_service_services_pb.rb +2 -3
  77. data/lib/google/ads/googleads/v0/services/campaign_criterion_service_client.rb +4 -4
  78. data/lib/google/ads/googleads/v0/services/campaign_criterion_service_services_pb.rb +2 -3
  79. data/lib/google/ads/googleads/v0/services/campaign_group_service_client.rb +268 -0
  80. data/lib/google/ads/googleads/v0/services/campaign_group_service_client_config.json +36 -0
  81. data/lib/google/ads/googleads/v0/services/campaign_group_service_pb.rb +47 -0
  82. data/lib/google/ads/googleads/v0/services/campaign_group_service_services_pb.rb +51 -0
  83. data/lib/google/ads/googleads/v0/services/campaign_service_client.rb +4 -4
  84. data/lib/google/ads/googleads/v0/services/campaign_service_services_pb.rb +2 -3
  85. data/lib/google/ads/googleads/v0/services/campaign_shared_set_service_client.rb +267 -0
  86. data/lib/google/ads/googleads/v0/services/campaign_shared_set_service_client_config.json +36 -0
  87. data/lib/google/ads/googleads/v0/services/campaign_shared_set_service_pb.rb +44 -0
  88. data/lib/google/ads/googleads/v0/services/campaign_shared_set_service_services_pb.rb +50 -0
  89. data/lib/google/ads/googleads/v0/services/credentials.rb +10 -2
  90. data/lib/google/ads/googleads/v0/services/customer_service_client.rb +2 -2
  91. data/lib/google/ads/googleads/v0/services/customer_service_services_pb.rb +2 -3
  92. data/lib/google/ads/googleads/v0/services/doc/google/ads/googleads/v0/common/ad_type_infos.rb +120 -0
  93. data/lib/google/ads/googleads/v0/services/doc/google/ads/googleads/v0/common/bidding.rb +176 -0
  94. data/lib/google/ads/googleads/v0/services/doc/google/ads/googleads/v0/common/criteria.rb +225 -0
  95. data/lib/google/ads/googleads/v0/services/doc/google/ads/googleads/v0/common/custom_parameter.rb +33 -0
  96. data/lib/google/ads/googleads/v0/services/doc/google/ads/googleads/v0/common/metrics.rb +208 -0
  97. data/lib/google/ads/googleads/v0/services/doc/google/ads/googleads/v0/resources/ad.rb +79 -0
  98. data/lib/google/ads/googleads/v0/services/doc/google/ads/googleads/v0/resources/ad_group.rb +87 -0
  99. data/lib/google/ads/googleads/v0/services/doc/google/ads/googleads/v0/resources/ad_group_ad.rb +43 -0
  100. data/lib/google/ads/googleads/v0/services/doc/google/ads/googleads/v0/resources/ad_group_bid_modifier.rb +70 -0
  101. data/lib/google/ads/googleads/v0/services/doc/google/ads/googleads/v0/resources/ad_group_criterion.rb +148 -0
  102. data/lib/google/ads/googleads/v0/services/doc/google/ads/googleads/v0/resources/bidding_strategy.rb +73 -0
  103. data/lib/google/ads/googleads/v0/services/doc/google/ads/googleads/v0/resources/campaign.rb +223 -0
  104. data/lib/google/ads/googleads/v0/services/doc/google/ads/googleads/v0/resources/campaign_bid_modifier.rb +46 -0
  105. data/lib/google/ads/googleads/v0/services/doc/google/ads/googleads/v0/resources/campaign_budget.rb +88 -0
  106. data/lib/google/ads/googleads/v0/services/doc/google/ads/googleads/v0/resources/campaign_criterion.rb +66 -0
  107. data/lib/google/ads/googleads/v0/services/doc/google/ads/googleads/v0/resources/campaign_group.rb +49 -0
  108. data/lib/google/ads/googleads/v0/services/doc/google/ads/googleads/v0/resources/campaign_shared_set.rb +47 -0
  109. data/lib/google/ads/googleads/v0/services/doc/google/ads/googleads/v0/resources/customer.rb +57 -0
  110. data/lib/google/ads/googleads/v0/services/doc/google/ads/googleads/v0/resources/geo_target_constant.rb +44 -0
  111. data/lib/google/ads/googleads/v0/services/doc/google/ads/googleads/v0/resources/google_ads_field.rb +89 -0
  112. data/lib/google/ads/googleads/v0/services/doc/google/ads/googleads/v0/resources/keyword_view.rb +32 -0
  113. data/lib/google/ads/googleads/v0/services/doc/google/ads/googleads/v0/resources/recommendation.rb +223 -0
  114. data/lib/google/ads/googleads/v0/services/doc/google/ads/googleads/v0/resources/shared_criterion.rb +46 -0
  115. data/lib/google/ads/googleads/v0/services/doc/google/ads/googleads/v0/resources/shared_set.rb +56 -0
  116. data/lib/google/ads/googleads/v0/services/doc/google/ads/googleads/v0/services/ad_group_ad_service.rb +68 -0
  117. data/lib/google/ads/googleads/v0/services/doc/google/ads/googleads/v0/services/ad_group_bid_modifier_service.rb +71 -0
  118. data/lib/google/ads/googleads/v0/services/doc/google/ads/googleads/v0/services/ad_group_criterion_service.rb +69 -0
  119. data/lib/google/ads/googleads/v0/services/doc/google/ads/googleads/v0/services/ad_group_service.rb +68 -0
  120. data/lib/google/ads/googleads/v0/services/doc/google/ads/googleads/v0/services/bidding_strategy_service.rb +70 -0
  121. data/lib/google/ads/googleads/v0/services/doc/google/ads/googleads/v0/services/campaign_bid_modifier_service.rb +71 -0
  122. data/lib/google/ads/googleads/v0/services/doc/google/ads/googleads/v0/services/campaign_budget_service.rb +69 -0
  123. data/lib/google/ads/googleads/v0/services/doc/google/ads/googleads/v0/services/campaign_criterion_service.rb +69 -0
  124. data/lib/google/ads/googleads/v0/services/doc/google/ads/googleads/v0/services/campaign_group_service.rb +70 -0
  125. data/lib/google/ads/googleads/v0/services/doc/google/ads/googleads/v0/services/campaign_service.rb +69 -0
  126. data/lib/google/ads/googleads/v0/services/doc/google/ads/googleads/v0/services/campaign_shared_set_service.rb +64 -0
  127. data/lib/google/ads/googleads/v0/services/doc/google/ads/googleads/v0/services/customer_service.rb +29 -0
  128. data/lib/google/ads/googleads/v0/services/doc/google/ads/googleads/v0/services/geo_target_constant_service.rb +29 -0
  129. data/lib/google/ads/googleads/v0/services/doc/google/ads/googleads/v0/services/google_ads_field_service.rb +59 -0
  130. data/lib/google/ads/googleads/v0/services/doc/google/ads/googleads/v0/services/google_ads_service.rb +156 -0
  131. data/lib/google/ads/googleads/v0/services/doc/google/ads/googleads/v0/services/keyword_view_service.rb +29 -0
  132. data/lib/google/ads/googleads/v0/services/doc/google/ads/googleads/v0/services/recommendation_service.rb +112 -0
  133. data/lib/google/ads/googleads/v0/services/doc/google/ads/googleads/v0/services/shared_criterion_service.rb +64 -0
  134. data/lib/google/ads/googleads/v0/services/doc/google/ads/googleads/v0/services/shared_set_service.rb +69 -0
  135. data/lib/google/ads/googleads/v0/services/doc/google/protobuf/any.rb +124 -0
  136. data/lib/google/ads/googleads/v0/services/doc/google/protobuf/field_mask.rb +223 -0
  137. data/lib/google/ads/googleads/v0/services/doc/google/protobuf/wrappers.rb +89 -0
  138. data/lib/google/ads/googleads/v0/services/doc/google/rpc/status.rb +83 -0
  139. data/lib/google/ads/googleads/v0/services/doc/overview.rb +82 -0
  140. data/lib/google/ads/googleads/v0/services/geo_target_constant_service_client.rb +2 -2
  141. data/lib/google/ads/googleads/v0/services/geo_target_constant_service_services_pb.rb +2 -3
  142. data/lib/google/ads/googleads/v0/services/google_ads_field_service_client.rb +4 -4
  143. data/lib/google/ads/googleads/v0/services/google_ads_field_service_services_pb.rb +2 -3
  144. data/lib/google/ads/googleads/v0/services/google_ads_service_client.rb +2 -2
  145. data/lib/google/ads/googleads/v0/services/google_ads_service_pb.rb +12 -0
  146. data/lib/google/ads/googleads/v0/services/google_ads_service_services_pb.rb +2 -3
  147. data/lib/google/ads/googleads/v0/services/keyword_view_service_client.rb +2 -2
  148. data/lib/google/ads/googleads/v0/services/keyword_view_service_services_pb.rb +2 -3
  149. data/lib/google/ads/googleads/v0/services/recommendation_service_client.rb +4 -4
  150. data/lib/google/ads/googleads/v0/services/recommendation_service_pb.rb +2 -2
  151. data/lib/google/ads/googleads/v0/services/recommendation_service_services_pb.rb +2 -3
  152. data/lib/google/ads/googleads/v0/services/shared_criterion_service_client.rb +267 -0
  153. data/lib/google/ads/googleads/v0/services/shared_criterion_service_client_config.json +36 -0
  154. data/lib/google/ads/googleads/v0/services/shared_criterion_service_pb.rb +44 -0
  155. data/lib/google/ads/googleads/v0/services/shared_criterion_service_services_pb.rb +50 -0
  156. data/lib/google/ads/googleads/v0/services/shared_set_service_client.rb +267 -0
  157. data/lib/google/ads/googleads/v0/services/shared_set_service_client_config.json +36 -0
  158. data/lib/google/ads/googleads/v0/services/shared_set_service_pb.rb +47 -0
  159. data/lib/google/ads/googleads/v0/services/shared_set_service_services_pb.rb +50 -0
  160. data/lib/google/ads/googleads/version.rb +1 -1
  161. metadata +100 -4
@@ -0,0 +1,267 @@
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/shared_criterion_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/shared_criterion_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 shared criteria.
36
+ #
37
+ # @!attribute [r] shared_criterion_service_stub
38
+ # @return [Google::Ads::Googleads::V0::Services::SharedCriterionService::Stub]
39
+ class SharedCriterionServiceClient
40
+ attr_reader :shared_criterion_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
+ # The default set of gRPC interceptors.
49
+ GRPC_INTERCEPTORS = []
50
+
51
+ DEFAULT_TIMEOUT = 30
52
+
53
+ # The scopes needed to make gRPC calls to all of the methods defined in
54
+ # this service.
55
+ ALL_SCOPES = [
56
+ ].freeze
57
+
58
+
59
+ SHARED_CRITERIA_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
60
+ "customers/{customer}/sharedCriteria/{shared_criteria}"
61
+ )
62
+
63
+ private_constant :SHARED_CRITERIA_PATH_TEMPLATE
64
+
65
+ # Returns a fully-qualified shared_criteria resource name string.
66
+ # @param customer [String]
67
+ # @param shared_criteria [String]
68
+ # @return [String]
69
+ def self.shared_criteria_path customer, shared_criteria
70
+ SHARED_CRITERIA_PATH_TEMPLATE.render(
71
+ :"customer" => customer,
72
+ :"shared_criteria" => shared_criteria
73
+ )
74
+ end
75
+
76
+ # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
77
+ # Provides the means for authenticating requests made by the client. This parameter can
78
+ # be many types.
79
+ # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
80
+ # authenticating requests made by this client.
81
+ # A `String` will be treated as the path to the keyfile to be used for the construction of
82
+ # credentials for this client.
83
+ # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
84
+ # credentials for this client.
85
+ # A `GRPC::Core::Channel` will be used to make calls through.
86
+ # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
87
+ # should already be composed with a `GRPC::Core::CallCredentials` object.
88
+ # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
89
+ # metadata for requests, generally, to give OAuth credentials.
90
+ # @param scopes [Array<String>]
91
+ # The OAuth scopes for this service. This parameter is ignored if
92
+ # an updater_proc is supplied.
93
+ # @param client_config [Hash]
94
+ # A Hash for call options for each method. See
95
+ # Google::Gax#construct_settings for the structure of
96
+ # this data. Falls back to the default config if not specified
97
+ # or the specified config is missing data points.
98
+ # @param timeout [Numeric]
99
+ # The default timeout, in seconds, for calls made through this client.
100
+ # @param metadata [Hash]
101
+ # Default metadata to be sent with each request. This can be overridden on a per call basis.
102
+ # @param exception_transformer [Proc]
103
+ # An optional proc that intercepts any exceptions raised during an API call to inject
104
+ # custom error handling.
105
+ def initialize \
106
+ credentials: nil,
107
+ scopes: ALL_SCOPES,
108
+ client_config: {},
109
+ timeout: DEFAULT_TIMEOUT,
110
+ metadata: nil,
111
+ exception_transformer: nil,
112
+ lib_name: nil,
113
+ lib_version: ""
114
+ # These require statements are intentionally placed here to initialize
115
+ # the gRPC module only when it's required.
116
+ # See https://github.com/googleapis/toolkit/issues/446
117
+ require "google/gax/grpc"
118
+ require "google/ads/googleads/v0/services/shared_criterion_service_services_pb"
119
+
120
+ credentials ||= Google::Ads::Googleads::V0::Services::Credentials.default
121
+
122
+ if credentials.is_a?(String) || credentials.is_a?(Hash)
123
+ updater_proc = Google::Ads::Googleads::V0::Services::Credentials.new(credentials).updater_proc
124
+ end
125
+ if credentials.is_a?(GRPC::Core::Channel)
126
+ channel = credentials
127
+ end
128
+ if credentials.is_a?(GRPC::Core::ChannelCredentials)
129
+ chan_creds = credentials
130
+ end
131
+ if credentials.is_a?(Proc)
132
+ updater_proc = credentials
133
+ end
134
+ if credentials.is_a?(Google::Auth::Credentials)
135
+ updater_proc = credentials.updater_proc
136
+ end
137
+
138
+ package_version = Gem.loaded_specs['google-ads-googleads'].version.version
139
+
140
+ google_api_client = "gl-ruby/#{RUBY_VERSION}"
141
+ google_api_client << " #{lib_name}/#{lib_version}" if lib_name
142
+ google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
143
+ google_api_client << " grpc/#{GRPC::VERSION}"
144
+ google_api_client.freeze
145
+
146
+ headers = { :"x-goog-api-client" => google_api_client }
147
+ headers.merge!(metadata) unless metadata.nil?
148
+ client_config_file = Pathname.new(__dir__).join(
149
+ "shared_criterion_service_client_config.json"
150
+ )
151
+ defaults = client_config_file.open do |f|
152
+ Google::Gax.construct_settings(
153
+ "google.ads.googleads.v0.services.SharedCriterionService",
154
+ JSON.parse(f.read),
155
+ client_config,
156
+ Google::Gax::Grpc::STATUS_CODE_NAMES,
157
+ timeout,
158
+ errors: Google::Gax::Grpc::API_ERRORS,
159
+ metadata: headers
160
+ )
161
+ end
162
+
163
+ # Allow overriding the service path/port in subclasses.
164
+ service_path = self.class::SERVICE_ADDRESS
165
+ port = self.class::DEFAULT_SERVICE_PORT
166
+ interceptors = self.class::GRPC_INTERCEPTORS
167
+ @shared_criterion_service_stub = Google::Gax::Grpc.create_stub(
168
+ service_path,
169
+ port,
170
+ chan_creds: chan_creds,
171
+ channel: channel,
172
+ updater_proc: updater_proc,
173
+ scopes: scopes,
174
+ interceptors: interceptors,
175
+ &Google::Ads::Googleads::V0::Services::SharedCriterionService::Stub.method(:new)
176
+ )
177
+
178
+ @get_shared_criterion = Google::Gax.create_api_call(
179
+ @shared_criterion_service_stub.method(:get_shared_criterion),
180
+ defaults["get_shared_criterion"],
181
+ exception_transformer: exception_transformer
182
+ )
183
+ @mutate_shared_criteria = Google::Gax.create_api_call(
184
+ @shared_criterion_service_stub.method(:mutate_shared_criteria),
185
+ defaults["mutate_shared_criteria"],
186
+ exception_transformer: exception_transformer
187
+ )
188
+ end
189
+
190
+ # Service calls
191
+
192
+ # Returns the requested shared criterion in full detail.
193
+ #
194
+ # @param resource_name [String]
195
+ # The resource name of the shared criterion to fetch.
196
+ # @param options [Google::Gax::CallOptions]
197
+ # Overrides the default settings for this call, e.g, timeout,
198
+ # retries, etc.
199
+ # @yield [result, operation] Access the result along with the RPC operation
200
+ # @yieldparam result [Google::Ads::Googleads::V0::Resources::SharedCriterion]
201
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
202
+ # @return [Google::Ads::Googleads::V0::Resources::SharedCriterion]
203
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
204
+ # @example
205
+ # require "google/ads/googleads"
206
+ #
207
+ # shared_criterion_service_client = Google::Ads::Googleads::SharedCriterion.new(version: :v0)
208
+ # formatted_resource_name = Google::Ads::Googleads::V0::Services::SharedCriterionServiceClient.shared_criteria_path("[CUSTOMER]", "[SHARED_CRITERIA]")
209
+ # response = shared_criterion_service_client.get_shared_criterion(formatted_resource_name)
210
+
211
+ def get_shared_criterion \
212
+ resource_name,
213
+ options: nil,
214
+ &block
215
+ req = {
216
+ resource_name: resource_name
217
+ }.delete_if { |_, v| v.nil? }
218
+ req = Google::Gax::to_proto(req, Google::Ads::Googleads::V0::Services::GetSharedCriterionRequest)
219
+ @get_shared_criterion.call(req, options, &block)
220
+ end
221
+
222
+ # Creates or removes shared criteria. Operation statuses are returned.
223
+ #
224
+ # @param customer_id [String]
225
+ # The ID of the customer whose shared criteria are being modified.
226
+ # @param operations [Array<Google::Ads::Googleads::V0::Services::SharedCriterionOperation | Hash>]
227
+ # The list of operations to perform on individual shared criteria.
228
+ # A hash of the same form as `Google::Ads::Googleads::V0::Services::SharedCriterionOperation`
229
+ # can also be provided.
230
+ # @param options [Google::Gax::CallOptions]
231
+ # Overrides the default settings for this call, e.g, timeout,
232
+ # retries, etc.
233
+ # @yield [result, operation] Access the result along with the RPC operation
234
+ # @yieldparam result [Google::Ads::Googleads::V0::Services::MutateSharedCriteriaResponse]
235
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
236
+ # @return [Google::Ads::Googleads::V0::Services::MutateSharedCriteriaResponse]
237
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
238
+ # @example
239
+ # require "google/ads/googleads"
240
+ #
241
+ # shared_criterion_service_client = Google::Ads::Googleads::SharedCriterion.new(version: :v0)
242
+ #
243
+ # # TODO: Initialize +customer_id+:
244
+ # customer_id = ''
245
+ #
246
+ # # TODO: Initialize +operations+:
247
+ # operations = []
248
+ # response = shared_criterion_service_client.mutate_shared_criteria(customer_id, operations)
249
+
250
+ def mutate_shared_criteria \
251
+ customer_id,
252
+ operations,
253
+ options: nil,
254
+ &block
255
+ req = {
256
+ customer_id: customer_id,
257
+ operations: operations
258
+ }.delete_if { |_, v| v.nil? }
259
+ req = Google::Gax::to_proto(req, Google::Ads::Googleads::V0::Services::MutateSharedCriteriaRequest)
260
+ @mutate_shared_criteria.call(req, options, &block)
261
+ end
262
+ end
263
+ end
264
+ end
265
+ end
266
+ end
267
+ end
@@ -0,0 +1,36 @@
1
+ {
2
+ "interfaces": {
3
+ "google.ads.googleads.v0.services.SharedCriterionService": {
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
+ "GetSharedCriterion": {
24
+ "timeout_millis": 60000,
25
+ "retry_codes_name": "idempotent",
26
+ "retry_params_name": "default"
27
+ },
28
+ "MutateSharedCriteria": {
29
+ "timeout_millis": 60000,
30
+ "retry_codes_name": "non_idempotent",
31
+ "retry_params_name": "default"
32
+ }
33
+ }
34
+ }
35
+ }
36
+ }
@@ -0,0 +1,44 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: google/ads/googleads/v0/services/shared_criterion_service.proto
3
+
4
+ require 'google/protobuf'
5
+
6
+ require 'google/ads/googleads/v0/resources/shared_criterion_pb'
7
+ require 'google/api/annotations_pb'
8
+ Google::Protobuf::DescriptorPool.generated_pool.build do
9
+ add_message "google.ads.googleads.v0.services.GetSharedCriterionRequest" do
10
+ optional :resource_name, :string, 1
11
+ end
12
+ add_message "google.ads.googleads.v0.services.MutateSharedCriteriaRequest" do
13
+ optional :customer_id, :string, 1
14
+ repeated :operations, :message, 2, "google.ads.googleads.v0.services.SharedCriterionOperation"
15
+ end
16
+ add_message "google.ads.googleads.v0.services.SharedCriterionOperation" do
17
+ oneof :operation do
18
+ optional :create, :message, 1, "google.ads.googleads.v0.resources.SharedCriterion"
19
+ optional :remove, :string, 3
20
+ end
21
+ end
22
+ add_message "google.ads.googleads.v0.services.MutateSharedCriteriaResponse" do
23
+ repeated :results, :message, 2, "google.ads.googleads.v0.services.MutateSharedCriterionResult"
24
+ end
25
+ add_message "google.ads.googleads.v0.services.MutateSharedCriterionResult" do
26
+ optional :resource_name, :string, 1
27
+ end
28
+ end
29
+
30
+ module Google
31
+ module Ads
32
+ module Googleads
33
+ module V0
34
+ module Services
35
+ GetSharedCriterionRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.ads.googleads.v0.services.GetSharedCriterionRequest").msgclass
36
+ MutateSharedCriteriaRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.ads.googleads.v0.services.MutateSharedCriteriaRequest").msgclass
37
+ SharedCriterionOperation = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.ads.googleads.v0.services.SharedCriterionOperation").msgclass
38
+ MutateSharedCriteriaResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.ads.googleads.v0.services.MutateSharedCriteriaResponse").msgclass
39
+ MutateSharedCriterionResult = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.ads.googleads.v0.services.MutateSharedCriterionResult").msgclass
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,50 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # Source: google/ads/googleads/v0/services/shared_criterion_service.proto for package 'google.ads.googleads.v0.services'
3
+ # Original file comments:
4
+ # Copyright 2018 Google LLC.
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
+
20
+ require 'grpc'
21
+ require 'google/ads/googleads/v0/services/shared_criterion_service_pb'
22
+
23
+ module Google
24
+ module Ads
25
+ module Googleads
26
+ module V0
27
+ module Services
28
+ module SharedCriterionService
29
+ # Service to manage shared criteria.
30
+ class Service
31
+
32
+ include GRPC::GenericService
33
+
34
+ self.marshal_class_method = :encode
35
+ self.unmarshal_class_method = :decode
36
+ self.service_name = 'google.ads.googleads.v0.services.SharedCriterionService'
37
+
38
+ # Returns the requested shared criterion in full detail.
39
+ rpc :GetSharedCriterion, GetSharedCriterionRequest, Google::Ads::Googleads::V0::Resources::SharedCriterion
40
+ # Creates or removes shared criteria. Operation statuses are returned.
41
+ rpc :MutateSharedCriteria, MutateSharedCriteriaRequest, MutateSharedCriteriaResponse
42
+ end
43
+
44
+ Stub = Service.rpc_stub_class
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,267 @@
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/shared_set_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/shared_set_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 shared sets.
36
+ #
37
+ # @!attribute [r] shared_set_service_stub
38
+ # @return [Google::Ads::Googleads::V0::Services::SharedSetService::Stub]
39
+ class SharedSetServiceClient
40
+ attr_reader :shared_set_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
+ # The default set of gRPC interceptors.
49
+ GRPC_INTERCEPTORS = []
50
+
51
+ DEFAULT_TIMEOUT = 30
52
+
53
+ # The scopes needed to make gRPC calls to all of the methods defined in
54
+ # this service.
55
+ ALL_SCOPES = [
56
+ ].freeze
57
+
58
+
59
+ SHARED_SET_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
60
+ "customers/{customer}/sharedSets/{shared_set}"
61
+ )
62
+
63
+ private_constant :SHARED_SET_PATH_TEMPLATE
64
+
65
+ # Returns a fully-qualified shared_set resource name string.
66
+ # @param customer [String]
67
+ # @param shared_set [String]
68
+ # @return [String]
69
+ def self.shared_set_path customer, shared_set
70
+ SHARED_SET_PATH_TEMPLATE.render(
71
+ :"customer" => customer,
72
+ :"shared_set" => shared_set
73
+ )
74
+ end
75
+
76
+ # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
77
+ # Provides the means for authenticating requests made by the client. This parameter can
78
+ # be many types.
79
+ # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
80
+ # authenticating requests made by this client.
81
+ # A `String` will be treated as the path to the keyfile to be used for the construction of
82
+ # credentials for this client.
83
+ # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
84
+ # credentials for this client.
85
+ # A `GRPC::Core::Channel` will be used to make calls through.
86
+ # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
87
+ # should already be composed with a `GRPC::Core::CallCredentials` object.
88
+ # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
89
+ # metadata for requests, generally, to give OAuth credentials.
90
+ # @param scopes [Array<String>]
91
+ # The OAuth scopes for this service. This parameter is ignored if
92
+ # an updater_proc is supplied.
93
+ # @param client_config [Hash]
94
+ # A Hash for call options for each method. See
95
+ # Google::Gax#construct_settings for the structure of
96
+ # this data. Falls back to the default config if not specified
97
+ # or the specified config is missing data points.
98
+ # @param timeout [Numeric]
99
+ # The default timeout, in seconds, for calls made through this client.
100
+ # @param metadata [Hash]
101
+ # Default metadata to be sent with each request. This can be overridden on a per call basis.
102
+ # @param exception_transformer [Proc]
103
+ # An optional proc that intercepts any exceptions raised during an API call to inject
104
+ # custom error handling.
105
+ def initialize \
106
+ credentials: nil,
107
+ scopes: ALL_SCOPES,
108
+ client_config: {},
109
+ timeout: DEFAULT_TIMEOUT,
110
+ metadata: nil,
111
+ exception_transformer: nil,
112
+ lib_name: nil,
113
+ lib_version: ""
114
+ # These require statements are intentionally placed here to initialize
115
+ # the gRPC module only when it's required.
116
+ # See https://github.com/googleapis/toolkit/issues/446
117
+ require "google/gax/grpc"
118
+ require "google/ads/googleads/v0/services/shared_set_service_services_pb"
119
+
120
+ credentials ||= Google::Ads::Googleads::V0::Services::Credentials.default
121
+
122
+ if credentials.is_a?(String) || credentials.is_a?(Hash)
123
+ updater_proc = Google::Ads::Googleads::V0::Services::Credentials.new(credentials).updater_proc
124
+ end
125
+ if credentials.is_a?(GRPC::Core::Channel)
126
+ channel = credentials
127
+ end
128
+ if credentials.is_a?(GRPC::Core::ChannelCredentials)
129
+ chan_creds = credentials
130
+ end
131
+ if credentials.is_a?(Proc)
132
+ updater_proc = credentials
133
+ end
134
+ if credentials.is_a?(Google::Auth::Credentials)
135
+ updater_proc = credentials.updater_proc
136
+ end
137
+
138
+ package_version = Gem.loaded_specs['google-ads-googleads'].version.version
139
+
140
+ google_api_client = "gl-ruby/#{RUBY_VERSION}"
141
+ google_api_client << " #{lib_name}/#{lib_version}" if lib_name
142
+ google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
143
+ google_api_client << " grpc/#{GRPC::VERSION}"
144
+ google_api_client.freeze
145
+
146
+ headers = { :"x-goog-api-client" => google_api_client }
147
+ headers.merge!(metadata) unless metadata.nil?
148
+ client_config_file = Pathname.new(__dir__).join(
149
+ "shared_set_service_client_config.json"
150
+ )
151
+ defaults = client_config_file.open do |f|
152
+ Google::Gax.construct_settings(
153
+ "google.ads.googleads.v0.services.SharedSetService",
154
+ JSON.parse(f.read),
155
+ client_config,
156
+ Google::Gax::Grpc::STATUS_CODE_NAMES,
157
+ timeout,
158
+ errors: Google::Gax::Grpc::API_ERRORS,
159
+ metadata: headers
160
+ )
161
+ end
162
+
163
+ # Allow overriding the service path/port in subclasses.
164
+ service_path = self.class::SERVICE_ADDRESS
165
+ port = self.class::DEFAULT_SERVICE_PORT
166
+ interceptors = self.class::GRPC_INTERCEPTORS
167
+ @shared_set_service_stub = Google::Gax::Grpc.create_stub(
168
+ service_path,
169
+ port,
170
+ chan_creds: chan_creds,
171
+ channel: channel,
172
+ updater_proc: updater_proc,
173
+ scopes: scopes,
174
+ interceptors: interceptors,
175
+ &Google::Ads::Googleads::V0::Services::SharedSetService::Stub.method(:new)
176
+ )
177
+
178
+ @get_shared_set = Google::Gax.create_api_call(
179
+ @shared_set_service_stub.method(:get_shared_set),
180
+ defaults["get_shared_set"],
181
+ exception_transformer: exception_transformer
182
+ )
183
+ @mutate_shared_sets = Google::Gax.create_api_call(
184
+ @shared_set_service_stub.method(:mutate_shared_sets),
185
+ defaults["mutate_shared_sets"],
186
+ exception_transformer: exception_transformer
187
+ )
188
+ end
189
+
190
+ # Service calls
191
+
192
+ # Returns the requested shared set in full detail.
193
+ #
194
+ # @param resource_name [String]
195
+ # The resource name of the shared set to fetch.
196
+ # @param options [Google::Gax::CallOptions]
197
+ # Overrides the default settings for this call, e.g, timeout,
198
+ # retries, etc.
199
+ # @yield [result, operation] Access the result along with the RPC operation
200
+ # @yieldparam result [Google::Ads::Googleads::V0::Resources::SharedSet]
201
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
202
+ # @return [Google::Ads::Googleads::V0::Resources::SharedSet]
203
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
204
+ # @example
205
+ # require "google/ads/googleads"
206
+ #
207
+ # shared_set_service_client = Google::Ads::Googleads::SharedSet.new(version: :v0)
208
+ # formatted_resource_name = Google::Ads::Googleads::V0::Services::SharedSetServiceClient.shared_set_path("[CUSTOMER]", "[SHARED_SET]")
209
+ # response = shared_set_service_client.get_shared_set(formatted_resource_name)
210
+
211
+ def get_shared_set \
212
+ resource_name,
213
+ options: nil,
214
+ &block
215
+ req = {
216
+ resource_name: resource_name
217
+ }.delete_if { |_, v| v.nil? }
218
+ req = Google::Gax::to_proto(req, Google::Ads::Googleads::V0::Services::GetSharedSetRequest)
219
+ @get_shared_set.call(req, options, &block)
220
+ end
221
+
222
+ # Creates, updates, or removes shared sets. Operation statuses are returned.
223
+ #
224
+ # @param customer_id [String]
225
+ # The ID of the customer whose shared sets are being modified.
226
+ # @param operations [Array<Google::Ads::Googleads::V0::Services::SharedSetOperation | Hash>]
227
+ # The list of operations to perform on individual shared sets.
228
+ # A hash of the same form as `Google::Ads::Googleads::V0::Services::SharedSetOperation`
229
+ # can also be provided.
230
+ # @param options [Google::Gax::CallOptions]
231
+ # Overrides the default settings for this call, e.g, timeout,
232
+ # retries, etc.
233
+ # @yield [result, operation] Access the result along with the RPC operation
234
+ # @yieldparam result [Google::Ads::Googleads::V0::Services::MutateSharedSetsResponse]
235
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
236
+ # @return [Google::Ads::Googleads::V0::Services::MutateSharedSetsResponse]
237
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
238
+ # @example
239
+ # require "google/ads/googleads"
240
+ #
241
+ # shared_set_service_client = Google::Ads::Googleads::SharedSet.new(version: :v0)
242
+ #
243
+ # # TODO: Initialize +customer_id+:
244
+ # customer_id = ''
245
+ #
246
+ # # TODO: Initialize +operations+:
247
+ # operations = []
248
+ # response = shared_set_service_client.mutate_shared_sets(customer_id, operations)
249
+
250
+ def mutate_shared_sets \
251
+ customer_id,
252
+ operations,
253
+ options: nil,
254
+ &block
255
+ req = {
256
+ customer_id: customer_id,
257
+ operations: operations
258
+ }.delete_if { |_, v| v.nil? }
259
+ req = Google::Gax::to_proto(req, Google::Ads::Googleads::V0::Services::MutateSharedSetsRequest)
260
+ @mutate_shared_sets.call(req, options, &block)
261
+ end
262
+ end
263
+ end
264
+ end
265
+ end
266
+ end
267
+ end