google-cloud-document_ai 1.4.1 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 58a1d3da9361f0bf8798944d154bc1352cdd3ab92e2b9b51f9697646176331d3
4
- data.tar.gz: d008f9c7d727b9816de7e71cc43019e586b23666410ed5d0767b7cd2da46abae
3
+ metadata.gz: 0ee39d470f05e36357d4412614cfda148189cf6a17107a1efbadce9b64ac5007
4
+ data.tar.gz: b7f73db076d361b2c564733a5bc17990ed7d568bbadf6cd15251b40e06b5cc4e
5
5
  SHA512:
6
- metadata.gz: e432cfc463fddb02c008254a66b3fcc7d2e5d31becd1000dc1222f18a012adb79144f9ae097a8b7d17320c0f1d45b4ce1944d10eee6b76111e9b834f3a6174ad
7
- data.tar.gz: c072eecb21e0a50ecde2b3789ef9b3803ef03c503007d4a29dc579e1dfe2f2f1c33ca8952439a14ab068a7438df1160e49e67fda978bcdec0c079720fc72bc53
6
+ metadata.gz: b6e828283f7a6746fcc93576542bea21c19761b01b2a377d992ba0effb6422acd48a4f939c7214797632518640b313c43cb69f502b247389df9e809cb9b616ca
7
+ data.tar.gz: f65116627cc33c429d80d0902f8cbb1cbea0fe729b9b7e28015f1f19a1b2737e5cf03e826f1cf00134de500f71aa60390145c9c64d6a4c027365172cfe54c8b0
data/README.md CHANGED
@@ -35,9 +35,40 @@ In order to use this library, you first need to go through the following steps:
35
35
  1. [Enable the API.](https://console.cloud.google.com/apis/library/documentai.googleapis.com)
36
36
  1. {file:AUTHENTICATION.md Set up authentication.}
37
37
 
38
+ ## Debug Logging
39
+
40
+ This library comes with opt-in Debug Logging that can help you troubleshoot
41
+ your application's integration with the API. When logging is activated, key
42
+ events such as requests and responses, along with data payloads and metadata
43
+ such as headers and client configuration, are logged to the standard error
44
+ stream.
45
+
46
+ **WARNING:** Client Library Debug Logging includes your data payloads in
47
+ plaintext, which could include sensitive data such as PII for yourself or your
48
+ customers, private keys, or other security data that could be compromising if
49
+ leaked. Always practice good data hygiene with your application logs, and follow
50
+ the principle of least access. Google also recommends that Client Library Debug
51
+ Logging be enabled only temporarily during active debugging, and not used
52
+ permanently in production.
53
+
54
+ To enable logging, set the environment variable `GOOGLE_SDK_RUBY_LOGGING_GEMS`
55
+ to the value `all`. Alternatively, you can set the value to a comma-delimited
56
+ list of client library gem names. This will select the default logging behavior,
57
+ which writes logs to the standard error stream. On a local workstation, this may
58
+ result in logs appearing on the console. When running on a Google Cloud hosting
59
+ service such as [Google Cloud Run](https://cloud.google.com/run), this generally
60
+ results in logs appearing alongside your application logs in the
61
+ [Google Cloud Logging](https://cloud.google.com/logging/) service.
62
+
63
+ Debug logging also requires that the versioned clients for this service be
64
+ sufficiently recent, released after about Dec 10, 2024. If logging is not
65
+ working, try updating the versioned clients in your bundle or installed gems:
66
+ [google-cloud-document_ai-v1](https://cloud.google.com/ruby/docs/reference/google-cloud-document_ai-v1/latest),
67
+ [google-cloud-document_ai-v1beta3](https://cloud.google.com/ruby/docs/reference/google-cloud-document_ai-v1beta3/latest).
68
+
38
69
  ## Supported Ruby Versions
39
70
 
40
- This library is supported on Ruby 2.7+.
71
+ This library is supported on Ruby 3.0+.
41
72
 
42
73
  Google provides official support for Ruby versions that are actively supported
43
74
  by Ruby Core—that is, Ruby versions that are either in normal maintenance or
@@ -20,7 +20,7 @@
20
20
  module Google
21
21
  module Cloud
22
22
  module DocumentAI
23
- VERSION = "1.4.1"
23
+ VERSION = "1.5.0"
24
24
  end
25
25
  end
26
26
  end
@@ -58,6 +58,11 @@ module Google
58
58
  # You can also specify a different transport by passing `:rest` or `:grpc` in
59
59
  # the `transport` parameter.
60
60
  #
61
+ # Raises an exception if the currently installed versioned client gem for the
62
+ # given API version does not support the given transport of the DocumentProcessorService service.
63
+ # You can determine whether the method will succeed by calling
64
+ # {Google::Cloud::DocumentAI.document_processor_service_available?}.
65
+ #
61
66
  # ## About DocumentProcessorService
62
67
  #
63
68
  # Service to call Document AI to process documents according to the
@@ -82,6 +87,37 @@ module Google
82
87
  service_module.const_get(:Client).new(&block)
83
88
  end
84
89
 
90
+ ##
91
+ # Determines whether the DocumentProcessorService service is supported by the current client.
92
+ # If true, you can retrieve a client object by calling {Google::Cloud::DocumentAI.document_processor_service}.
93
+ # If false, that method will raise an exception. This could happen if the given
94
+ # API version does not exist or does not support the DocumentProcessorService service,
95
+ # or if the versioned client gem needs an update to support the DocumentProcessorService service.
96
+ #
97
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
98
+ # Defaults to `:v1`.
99
+ # @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
100
+ # @return [boolean] Whether the service is available.
101
+ #
102
+ def self.document_processor_service_available? version: :v1, transport: :grpc
103
+ require "google/cloud/document_ai/#{version.to_s.downcase}"
104
+ package_name = Google::Cloud::DocumentAI
105
+ .constants
106
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
107
+ .first
108
+ return false unless package_name
109
+ service_module = Google::Cloud::DocumentAI.const_get package_name
110
+ return false unless service_module.const_defined? :DocumentProcessorService
111
+ service_module = service_module.const_get :DocumentProcessorService
112
+ if transport == :rest
113
+ return false unless service_module.const_defined? :Rest
114
+ service_module = service_module.const_get :Rest
115
+ end
116
+ service_module.const_defined? :Client
117
+ rescue ::LoadError
118
+ false
119
+ end
120
+
85
121
  ##
86
122
  # Configure the google-cloud-document_ai library.
87
123
  #
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-document_ai
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Google LLC
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-08-09 00:00:00.000000000 Z
10
+ date: 2025-01-29 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: google-cloud-core
@@ -83,7 +82,6 @@ homepage: https://github.com/googleapis/google-cloud-ruby
83
82
  licenses:
84
83
  - Apache-2.0
85
84
  metadata: {}
86
- post_install_message:
87
85
  rdoc_options: []
88
86
  require_paths:
89
87
  - lib
@@ -91,15 +89,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
91
89
  requirements:
92
90
  - - ">="
93
91
  - !ruby/object:Gem::Version
94
- version: '2.7'
92
+ version: '3.0'
95
93
  required_rubygems_version: !ruby/object:Gem::Requirement
96
94
  requirements:
97
95
  - - ">="
98
96
  - !ruby/object:Gem::Version
99
97
  version: '0'
100
98
  requirements: []
101
- rubygems_version: 3.5.6
102
- signing_key:
99
+ rubygems_version: 3.6.2
103
100
  specification_version: 4
104
101
  summary: API Client library for the Document AI API
105
102
  test_files: []