google-ads-googleads 36.0.0 → 36.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0eb1daa3bef54a0ea96d1a029b090baabb217b766d62d292d8c20893552c0f92
4
- data.tar.gz: 62bb2a182b3c39affb26bfa8bf60cb928e08218d675c161649644c4f177e50b1
3
+ metadata.gz: f9eae41b67b912a31e073d1f883bd20705af4ed6473ae2dce8c8b02157d0f448
4
+ data.tar.gz: 96fbdb2125072eb8a1ba4f662a84334b3162c46ea72d817c8a9fc8a3a9ae8a2f
5
5
  SHA512:
6
- metadata.gz: 6756499b295e05f6d0515a1462d6b4f1093d053ddf772a8ec262f880ffe0bbab2eb8160842556086c386f339d6c8331bf118685184811421a70e19447b054310
7
- data.tar.gz: da15e987b903c26687072860f819076c8b4b0ae4dbbebf4afc8c70f7933be9a9ccd199a0358c7a5ce9db11347e30781ebcdbbcf7ff65e7fa8f558aff4fec2755
6
+ metadata.gz: c8998d3600eb8f1f5e636726fd8bd0fe71d0c15a035cd827d29fc5db055a7a944ed00de85ab3904e042b2146b9b0a7c48182daddbe949e091ba5d245e748f974
7
+ data.tar.gz: ac29bbf1aa98e1fbaf69217ebe92eb827ac3f5db967dc1c7228c587db72d81c2b354d8ee94ed5abb70cef7fb7ff1d45afbc2f8069c3bd95702196715bff225f5
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ 36.1.0
2
+ ------
3
+ - Add support for Application Default Credentials.
4
+
1
5
  36.0.0
2
6
  ------
3
7
  - Compatibility with v22 of the API: https://developers.google.com/google-ads/api/docs/release-notes
data/google_ads_config.rb CHANGED
@@ -26,6 +26,11 @@ Google::Ads::GoogleAds::Config.new do |c|
26
26
  c.client_secret = 'INSERT_CLIENT_SECRET_HERE'
27
27
  c.refresh_token = 'INSERT_REFRESH_TOKEN_HERE'
28
28
 
29
+ # You can also authenticate using Application Default Credentials (ADC)
30
+ # To understand how ADC discovers credentials in a given environment,
31
+ # see: https://developers.google.com/identity/protocols/application-default-credentials.
32
+ c.use_application_default_credentials = false
33
+
29
34
  # Whether to use the Google Cloud Organization of your Google Cloud
30
35
  # project instead of developer token to determine your Google Ads API access levels.
31
36
  # Use this flag only if you are enrolled into a limited pilot that supports
@@ -27,6 +27,7 @@ module Google
27
27
  attr_accessor :client_secret
28
28
  attr_accessor :keyfile
29
29
  attr_accessor :impersonate
30
+ attr_accessor :use_application_default_credentials
30
31
  attr_accessor :authentication
31
32
 
32
33
  attr_accessor :developer_token
@@ -51,6 +52,7 @@ module Google
51
52
  @client_secret = nil
52
53
  @keyfile = nil
53
54
  @impersonate = nil
55
+ @use_application_default_credentials = nil
54
56
  @authentication = nil
55
57
 
56
58
  @developer_token = nil
@@ -35,6 +35,7 @@ require 'logger'
35
35
  require 'json'
36
36
  require 'openssl'
37
37
  require 'signet/oauth_2/client'
38
+ require 'googleauth'
38
39
  require 'delegate'
39
40
 
40
41
  module Google
@@ -100,6 +101,7 @@ module Google
100
101
  @config.client_secret = ENV.fetch("GOOGLE_ADS_CLIENT_SECRET", @config.client_secret)
101
102
  @config.keyfile = ENV.fetch("GOOGLE_ADS_JSON_KEY_FILE_PATH", @config.keyfile)
102
103
  @config.impersonate = ENV.fetch("GOOGLE_ADS_IMPERSONATED_EMAIL", @config.impersonate)
104
+ @config.use_application_default_credentials = ENV.fetch("GOOGLE_ADS_USE_APPLICATION_DEFAULT_CREDENTIALS", @config.use_application_default_credentials)
103
105
  @config.developer_token = ENV.fetch("GOOGLE_ADS_DEVELOPER_TOKEN", @config.developer_token)
104
106
  @config.login_customer_id = ENV.fetch("GOOGLE_ADS_LOGIN_CUSTOMER_ID", @config.login_customer_id)
105
107
  @config.linked_customer_id = ENV.fetch("GOOGLE_ADS_LINKED_CUSTOMER_ID", @config.linked_customer_id)
@@ -201,7 +203,9 @@ module Google
201
203
  private
202
204
 
203
205
  def get_credentials
204
- if @config.authentication
206
+ if @config.use_application_default_credentials
207
+ get_application_default_credentials
208
+ elsif @config.authentication
205
209
  @config.authentication
206
210
  elsif @config.keyfile
207
211
  get_service_account_credentials
@@ -236,6 +240,12 @@ module Google
236
240
  scope: [SCOPE],
237
241
  ).updater_proc
238
242
  end
243
+
244
+ # Provides a Google::Auth::Credentials initialized with Application
245
+ # Default Credentials specified in the config.
246
+ def get_application_default_credentials
247
+ Google::Auth.get_application_default(SCOPE).updater_proc
248
+ end
239
249
 
240
250
  # Create the default logger, useful if the user hasn't defined one.
241
251
  def create_default_logger()
@@ -20,7 +20,7 @@ module Google
20
20
  module Ads
21
21
  module GoogleAds
22
22
  CLIENT_LIB_NAME = 'gccl'.freeze
23
- CLIENT_LIB_VERSION = '36.0.0'.freeze
23
+ CLIENT_LIB_VERSION = '36.1.0'.freeze
24
24
  VERSION = CLIENT_LIB_VERSION
25
25
  end
26
26
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-ads-googleads
3
3
  version: !ruby/object:Gem::Version
4
- version: 36.0.0
4
+ version: 36.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Google Inc