google-apis-core 1.0.2 → 1.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 +6 -0
- data/lib/google/api_client/auth/storage.rb +5 -0
- data/lib/google/api_client/auth/storages/file_store.rb +5 -0
- data/lib/google/api_client/auth/storages/redis_store.rb +6 -0
- data/lib/google/apis/core/storage_upload.rb +29 -1
- data/lib/google/apis/core/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 850aff1c0e3fa076d1ae86405b2390296f569c0f8a7f05e81aa94deca2419995
|
|
4
|
+
data.tar.gz: 5f0e301b6362136d3cad534d1de668ac535ef025c6b525a7f6bc402d8deb10cf
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6aac326b8d12f844d928bf46de25daa0fe52e2f0f1c1558df08d832fa29d354eb69c94ae360dabd94aac59ade6c12fa4131f4b4bd7a55f222b84720ad4e93bdf
|
|
7
|
+
data.tar.gz: 66f01cade6af7c80059f34ba0567ebe5e0683e022a505c3996d290eb5c7073e033a7a95f89c0926d437e640cab2c8959abbe405cf4cf1cca54eb5c9c9760b191
|
data/CHANGELOG.md
CHANGED
|
@@ -38,6 +38,11 @@ module Google
|
|
|
38
38
|
#
|
|
39
39
|
# @param [Object] store
|
|
40
40
|
# Storage object
|
|
41
|
+
#
|
|
42
|
+
# @note Warning: This class is part of a deprecated credentials flow.
|
|
43
|
+
# Providing an unvalidated credential configuration to Google APIs can
|
|
44
|
+
# compromise the security of your systems and data. Use
|
|
45
|
+
# google-auth-library-ruby instead.
|
|
41
46
|
def initialize(store)
|
|
42
47
|
@store= store
|
|
43
48
|
@authorization = nil
|
|
@@ -37,6 +37,11 @@ module Google
|
|
|
37
37
|
|
|
38
38
|
##
|
|
39
39
|
# Attempt to read in credentials from the specified file.
|
|
40
|
+
#
|
|
41
|
+
# @note Warning: This method is part of a deprecated credentials flow.
|
|
42
|
+
# Providing an unvalidated credential configuration to Google APIs can
|
|
43
|
+
# compromise the security of your systems and data. Use
|
|
44
|
+
# google-auth-library-ruby instead.
|
|
40
45
|
def load_credentials
|
|
41
46
|
open(path, 'r') { |f| JSON.parse(f.read) }
|
|
42
47
|
rescue
|
|
@@ -37,6 +37,12 @@ module Google
|
|
|
37
37
|
|
|
38
38
|
##
|
|
39
39
|
# Attempt to read in credentials from redis.
|
|
40
|
+
#
|
|
41
|
+
# @note Warning: This method is part of a deprecated credentials flow.
|
|
42
|
+
# Providing an unvalidated credential configuration to Google APIs can
|
|
43
|
+
# compromise the security of your systems and data. Use
|
|
44
|
+
# google-auth-library-ruby instead.
|
|
45
|
+
#
|
|
40
46
|
# @return [Hash]
|
|
41
47
|
def load_credentials
|
|
42
48
|
credentials = redis.get redis_credentials_key
|
|
@@ -176,6 +176,10 @@ module Google
|
|
|
176
176
|
request_header = header.dup
|
|
177
177
|
request_header[CONTENT_RANGE_HEADER] = get_content_range_header current_chunk_size
|
|
178
178
|
request_header[CONTENT_LENGTH_HEADER] = current_chunk_size.to_s
|
|
179
|
+
last_chunk = remaining_content_size <= current_chunk_size
|
|
180
|
+
formatted_string = formatted_checksum_header
|
|
181
|
+
request_header['X-Goog-Hash'] = formatted_string if (last_chunk && !formatted_string.empty?)
|
|
182
|
+
|
|
179
183
|
chunk_body =
|
|
180
184
|
if @upload_chunk_size == 0
|
|
181
185
|
upload_io
|
|
@@ -191,7 +195,7 @@ module Google
|
|
|
191
195
|
success(result)
|
|
192
196
|
rescue => e
|
|
193
197
|
logger.warn {
|
|
194
|
-
"error
|
|
198
|
+
"error occurred please use uploadId-#{response.headers['X-GUploader-UploadID']} to resume your upload"
|
|
195
199
|
} unless response.nil?
|
|
196
200
|
upload_io.pos = @offset
|
|
197
201
|
error(e, rethrow: true)
|
|
@@ -290,6 +294,30 @@ module Google
|
|
|
290
294
|
end
|
|
291
295
|
sprintf('bytes %s/%d', numerator, upload_io.size)
|
|
292
296
|
end
|
|
297
|
+
|
|
298
|
+
# Generates a formatted checksum header string from the request body.
|
|
299
|
+
#
|
|
300
|
+
# Parses the body as JSON and extracts checksum values for the keys "crc32c", "md5Hash", and "md5".
|
|
301
|
+
# The "md5Hash" key is renamed to "md5" in the output.
|
|
302
|
+
# Returns a comma-separated string in the format "key=value" for each present checksum.
|
|
303
|
+
#
|
|
304
|
+
# @example
|
|
305
|
+
# If the body contains:
|
|
306
|
+
# { "md5Hash": "1B2M2Y8AsgTpgAmY7PhCfg==",
|
|
307
|
+
# "crc32c": "AAAAAA==" }
|
|
308
|
+
# The method returns:
|
|
309
|
+
# "crc32c=AAAAAA==,md5=1B2M2Y8AsgTpgAmY7PhCfg=="
|
|
310
|
+
# @return [String] the formatted checksum header, or an empty string if no relevant keys are present
|
|
311
|
+
def formatted_checksum_header
|
|
312
|
+
hash_data = body.to_s.empty? ? {} : JSON.parse(body)
|
|
313
|
+
target_keys = ["crc32c", "md5Hash", "md5"]
|
|
314
|
+
selected_keys = hash_data.slice(*target_keys)
|
|
315
|
+
formatted_string = selected_keys.map do |key, value|
|
|
316
|
+
output_key = (key == "md5Hash") ? "md5" : key
|
|
317
|
+
"#{output_key}=#{value}"
|
|
318
|
+
end.join(',')
|
|
319
|
+
formatted_string
|
|
320
|
+
end
|
|
293
321
|
end
|
|
294
322
|
end
|
|
295
323
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: google-apis-core
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0
|
|
4
|
+
version: 1.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Google LLC
|
|
@@ -153,7 +153,7 @@ licenses:
|
|
|
153
153
|
metadata:
|
|
154
154
|
bug_tracker_uri: https://github.com/googleapis/google-api-ruby-client/issues
|
|
155
155
|
changelog_uri: https://github.com/googleapis/google-api-ruby-client/tree/main/google-apis-core/CHANGELOG.md
|
|
156
|
-
documentation_uri: https://googleapis.dev/ruby/google-apis-core/v1.0
|
|
156
|
+
documentation_uri: https://googleapis.dev/ruby/google-apis-core/v1.1.0
|
|
157
157
|
source_code_uri: https://github.com/googleapis/google-api-ruby-client/tree/main/google-apis-core
|
|
158
158
|
rdoc_options: []
|
|
159
159
|
require_paths:
|