google-cloud-translate 3.7.3 → 3.7.4

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: 23688139762ed002d6ea1689cfa724a963b0f98c8cad36fe721b40c4fff39e63
4
- data.tar.gz: 599281e0a0f27d01dfcf9e46c21b52290572e0211ca268cbc18e87e5c29f10f8
3
+ metadata.gz: f8cf7a32f30be7ebe4466d97398218d0a0b5844af24f2b3dbc44bef1d5edd6f7
4
+ data.tar.gz: d9032461d1e52515cce444ca2e407721b53ffb02d4ad8349e82b0b0640214c7b
5
5
  SHA512:
6
- metadata.gz: 54a8550e86f0263ef5e01194aea6247dc3fdc1c41d0c5532040ba4e266aaaa5f3117a92b15cdc1ab7e4f5f5195bad87adc687c0450c3b2d282341172ba48e231
7
- data.tar.gz: c93e11a8fe4b0c497a97ab96494211b7cf2b85dea94a8508814fa1a1311eed78e039b652ef59a4c9c2f3db752c33fbdf993931ca563fb265637a4bea00a74d0c
6
+ metadata.gz: f835ce290535e817714c4b07a746f7e0bdb0bdef5bc379debac16062541cdc25f1100139952183ab36915f7bc9135f37037f638eec6895fed959d4ec0b9df342
7
+ data.tar.gz: 97ef3148b0fbe8a5a7172c7dfd8e3ad8394ac58be1f8cee02d234675827484ec8dab9b51e86307d33b048ea7144681718145b0e516f82988a5718f6b9c1e7e60
data/AUTHENTICATION.md CHANGED
@@ -33,6 +33,12 @@ credentials, there are several methods available to you.
33
33
 
34
34
  Credentials are accepted in the following ways, in the following order or precedence:
35
35
 
36
+ > [!WARNING]
37
+ > If you accept a credential configuration (JSON file or Hash) from an
38
+ > external source for authentication to Google Cloud, you must validate it before
39
+ > providing it to a Google API client library. Providing an unvalidated credential
40
+ > configuration to Google APIs can compromise the security of your systems and data.
41
+
36
42
  1. Credentials specified in method arguments
37
43
  2. Credentials specified in configuration
38
44
  3. Credentials pointed to or included in environment variables
@@ -54,20 +60,30 @@ whenever possible.
54
60
  To configure a credentials file for an individual client initialization:
55
61
 
56
62
  ```ruby
63
+ require "googleauth"
57
64
  require "google/cloud/translate"
58
65
 
66
+ credentials = ::Google::Auth::ServiceAccountCredentials.make_creds(
67
+ json_key_io: ::File.open("/path/to/keyfile.json")
68
+ )
69
+
59
70
  client = Google::Cloud::Translate.translation_service do |config|
60
- config.credentials = "path/to/credentialfile.json"
71
+ config.credentials = credentials
61
72
  end
62
73
  ```
63
74
 
64
75
  To configure a credentials file globally for all clients:
65
76
 
66
77
  ```ruby
78
+ require "googleauth"
67
79
  require "google/cloud/translate"
68
80
 
81
+ credentials = ::Google::Auth::ServiceAccountCredentials.make_creds(
82
+ json_key_io: ::File.open("/path/to/keyfile.json")
83
+ )
84
+
69
85
  Google::Cloud::Translate.configure do |config|
70
- config.credentials = "path/to/credentialfile.json"
86
+ config.credentials = credentials
71
87
  end
72
88
 
73
89
  client = Google::Cloud::Translate.translation_service
data/MIGRATING.md CHANGED
@@ -88,11 +88,18 @@ client = Google::Cloud::Translate.new version: :v2,
88
88
  ```
89
89
 
90
90
  New (V3):
91
- ```
91
+ ```ruby
92
+ require "googleauth"
93
+ require "google/cloud/translate"
94
+
95
+ credentials = ::Google::Auth::ServiceAccountCredentials.make_creds(
96
+ json_key_io: ::File.open("/path/to/keyfile.json")
97
+ )
98
+
92
99
  # Call the translation_service method to create a V3 client,
93
100
  # and pass a block to configure the client.
94
101
  client = Google::Cloud::Translate.translation_service do |config|
95
- config.credentials = "/path/to/credentials.json"
102
+ config.credentials = credentials
96
103
  end
97
104
 
98
105
  # You can omit the block if you're keeping the default configuration
@@ -29,8 +29,11 @@ module Google
29
29
  #
30
30
  # @param [String] project_id Project identifier for the Cloud Translation service you are connecting to. If not
31
31
  # present, the default project for the credentials is used.
32
- # @param [String, Hash, Google::Auth::Credentials] credentials The path to the keyfile as a String, the contents
33
- # of the keyfile as a Hash, or a Google::Auth::Credentials object.
32
+ # @param [Google::Auth::Credentials] credentials A Google::Auth::Credentials
33
+ # object.
34
+ # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials
35
+ # is deprecated. Providing an unvalidated credential configuration to
36
+ # Google APIs can compromise the security of your systems and data.
34
37
  # @param [String] key a public API access key (not an OAuth 2.0 token)
35
38
  # @param [String, Array<String>] scope The OAuth 2.0 scopes controlling the set of resources and operations that
36
39
  # the connection can access. See [Using OAuth 2.0 to Access Google
@@ -48,12 +51,17 @@ module Google
48
51
  # @return [Google::Cloud::Translate::V2::Api]
49
52
  #
50
53
  # @example
54
+ # require "googleauth"
51
55
  # require "google/cloud/translate/v2"
52
56
  #
57
+ # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds(
58
+ # json_key_io: ::File.open("/path/to/keyfile.json")
59
+ # )
60
+ #
53
61
  # translate = Google::Cloud::Translate::V2.new(
54
62
  # version: :v2,
55
63
  # project_id: "my-todo-project",
56
- # credentials: "/path/to/keyfile.json"
64
+ # credentials: credentials
57
65
  # )
58
66
  #
59
67
  # translation = translate.translate "Hello world!", to: "la"
@@ -20,7 +20,7 @@
20
20
  module Google
21
21
  module Cloud
22
22
  module Translate
23
- VERSION = "3.7.3"
23
+ VERSION = "3.7.4"
24
24
  end
25
25
  end
26
26
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-translate
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.7.3
4
+ version: 3.7.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Google LLC