grafeas 1.4.0 → 1.5.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: 59a357d6fabe73010d485eb77a50947f09e26d7eb6844de6dc09c4ad646e834e
4
- data.tar.gz: 36150ec7fc51e4931c00af9528ecd0181957ed06b857abeed429088c80694862
3
+ metadata.gz: 913695ac0f735da37dba6b2e011a88220cb1b0f65f5e9d363e58ce5596fe3ffc
4
+ data.tar.gz: ad36aef7e2630fa749e07401ebd29d4175badca05395052932539e7868a28c06
5
5
  SHA512:
6
- metadata.gz: 8d6f658f0d8c88a01e882f7641bb29060a0a80eb39ec7e3146ca429249e68e606a35077699408917f6724cf42468202d5e79cdc39abd5df1a31c96266efcbffc
7
- data.tar.gz: 65ac518f4b933128e26216dd66b719c91063d1189755834b02bd1f7f3daad1008443eed7948ce56628acfe4afc6b9d5e130ff48f93a46235158b3cbdd6f48ffe
6
+ metadata.gz: 82fe604a6d66e62d97355a1c90224a332266c4f2c494e8b2fe30eb0e51bc975a7711324d0493e99aa9be05a57f870b05e7c7f479398562594685e6aa06048e10
7
+ data.tar.gz: 1c7876254f9b153542806a177cac8736e9bc6ade3d73edad87e162d65d9b884a7381dc8f5123feb8c426c7c5aa6e81a33e780944f3e2857cfd21e45c5e8b6ab0
data/README.md CHANGED
@@ -35,35 +35,39 @@ and includes substantial interface changes. Existing code written for earlier
35
35
  versions of this library will likely require updates to use this version.
36
36
  See the {file:MIGRATING.md MIGRATING.md} document for more information.
37
37
 
38
- ## Enabling Logging
39
-
40
- To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
41
- The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/current/stdlibs/logger/Logger.html) as shown below,
42
- or a [`Google::Cloud::Logging::Logger`](https://cloud.google.com/ruby/docs/reference/google-cloud-logging/latest)
43
- that will write logs to [Cloud Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
44
- and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
45
-
46
- Configuring a Ruby stdlib logger:
47
-
48
- ```ruby
49
- require "logger"
50
-
51
- module MyLogger
52
- LOGGER = Logger.new $stderr, level: Logger::WARN
53
- def logger
54
- LOGGER
55
- end
56
- end
57
-
58
- # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
59
- module GRPC
60
- extend MyLogger
61
- end
62
- ```
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
+ [grafeas-v1](https://cloud.google.com/ruby/docs/reference/grafeas-v1/latest).
63
67
 
64
68
  ## Supported Ruby Versions
65
69
 
66
- This library is supported on Ruby 2.7+.
70
+ This library is supported on Ruby 3.0+.
67
71
 
68
72
  Google provides official support for Ruby versions that are actively supported
69
73
  by Ruby Core—that is, Ruby versions that are either in normal maintenance or
@@ -18,5 +18,5 @@
18
18
 
19
19
 
20
20
  module Grafeas
21
- VERSION = "1.4.0"
21
+ VERSION = "1.5.0"
22
22
  end
data/lib/grafeas.rb CHANGED
@@ -36,6 +36,11 @@ module Grafeas
36
36
  # supported by that API version, and the corresponding gem is available, the
37
37
  # appropriate versioned client will be returned.
38
38
  #
39
+ # Raises an exception if the currently installed versioned client gem for the
40
+ # given API version does not support the Grafeas service.
41
+ # You can determine whether the method will succeed by calling
42
+ # {Grafeas.grafeas_available?}.
43
+ #
39
44
  # ## About Grafeas
40
45
  #
41
46
  # [Grafeas](https://grafeas.io) API.
@@ -67,6 +72,32 @@ module Grafeas
67
72
  service_module = Grafeas.const_get(package_name).const_get(:Grafeas)
68
73
  service_module.const_get(:Client).new(&block)
69
74
  end
75
+
76
+ ##
77
+ # Determines whether the Grafeas service is supported by the current client.
78
+ # If true, you can retrieve a client object by calling {Grafeas.grafeas}.
79
+ # If false, that method will raise an exception. This could happen if the given
80
+ # API version does not exist or does not support the Grafeas service,
81
+ # or if the versioned client gem needs an update to support the Grafeas service.
82
+ #
83
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
84
+ # Defaults to `:v1`.
85
+ # @return [boolean] Whether the service is available.
86
+ #
87
+ def self.grafeas_available? version: :v1
88
+ require "grafeas/#{version.to_s.downcase}"
89
+ package_name = Grafeas
90
+ .constants
91
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
92
+ .first
93
+ return false unless package_name
94
+ service_module = Grafeas.const_get package_name
95
+ return false unless service_module.const_defined? :Grafeas
96
+ service_module = service_module.const_get :Grafeas
97
+ service_module.const_defined? :Client
98
+ rescue ::LoadError
99
+ false
100
+ end
70
101
  end
71
102
 
72
103
  helper_path = ::File.join __dir__, "grafeas", "helpers.rb"
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grafeas
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
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-02-26 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
@@ -61,7 +60,6 @@ homepage: https://github.com/googleapis/google-cloud-ruby
61
60
  licenses:
62
61
  - Apache-2.0
63
62
  metadata: {}
64
- post_install_message:
65
63
  rdoc_options: []
66
64
  require_paths:
67
65
  - lib
@@ -69,15 +67,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
69
67
  requirements:
70
68
  - - ">="
71
69
  - !ruby/object:Gem::Version
72
- version: '2.7'
70
+ version: '3.0'
73
71
  required_rubygems_version: !ruby/object:Gem::Requirement
74
72
  requirements:
75
73
  - - ">="
76
74
  - !ruby/object:Gem::Version
77
75
  version: '0'
78
76
  requirements: []
79
- rubygems_version: 3.5.6
80
- signing_key:
77
+ rubygems_version: 3.6.2
81
78
  specification_version: 4
82
79
  summary: API Client library for the Grafeas API
83
80
  test_files: []