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 +4 -4
- data/CHANGELOG.md +4 -0
- data/google_ads_config.rb +5 -0
- data/lib/google/ads/google_ads/config.rb +2 -0
- data/lib/google/ads/google_ads/google_ads_client.rb +11 -1
- data/lib/google/ads/google_ads/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f9eae41b67b912a31e073d1f883bd20705af4ed6473ae2dce8c8b02157d0f448
|
|
4
|
+
data.tar.gz: 96fbdb2125072eb8a1ba4f662a84334b3162c46ea72d817c8a9fc8a3a9ae8a2f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c8998d3600eb8f1f5e636726fd8bd0fe71d0c15a035cd827d29fc5db055a7a944ed00de85ab3904e042b2146b9b0a7c48182daddbe949e091ba5d245e748f974
|
|
7
|
+
data.tar.gz: ac29bbf1aa98e1fbaf69217ebe92eb827ac3f5db967dc1c7228c587db72d81c2b354d8ee94ed5abb70cef7fb7ff1d45afbc2f8069c3bd95702196715bff225f5
|
data/CHANGELOG.md
CHANGED
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.
|
|
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()
|