gapic-common 0.11.0 → 0.11.1

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: 2760df5ba60e10af0fcea12a09d984b020d5dde80a2969cef159272a1e766731
4
- data.tar.gz: ad50bd4473dbf92bd8f31cdcaa0ab87bb08d53c359fc45f7b4f335bac0bcc56c
3
+ metadata.gz: 4362fc972a82bd5c92fdf8172a0ad005f371ecfaf968d251e19bc64b73681652
4
+ data.tar.gz: 85ebd85fef5f54aecfec53ffba4a83e2d7b03ecc26c474ffe64f2644241ae74f
5
5
  SHA512:
6
- metadata.gz: ffd0f60edffb9a9d57113d13d46300d7da0102291d10977f5e900baf482a9c2822180a75460e0079e457dca861cd0bc9af15cc80694021de5c1ab9ad23b2c7a3
7
- data.tar.gz: ed5d777bdb4ae4359b3fb6b1ee1b12e751541b565b08fdeacc4f698caeac878b7a3a540b2004bf63b7bb8a063da51620e7892ac5bcae98234ff969e804456cc7
6
+ metadata.gz: c1b4b4844fbc1380ccb5e82098c9e8647437da5cbfea789d0eb94543c020b10e97187faf5ac600b6b83d8091172b14f29d9cf05bb93017369b8126af21e49415
7
+ data.tar.gz: d046faba797ec8b2d76ec66cc2deb12fca86c570a090c05e97ecb844c1aebe8591d56d84a3910a226a8895f0171b1d060ede34a8879c103a76a0ec7da5ad7c7d
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Release History
2
2
 
3
+ ### 0.11.1 (2022-08-03)
4
+
5
+ #### Bug Fixes
6
+
7
+ * error code of 0 is not an error, body template field can be nil ([#805](https://github.com/googleapis/gapic-generator-ruby/issues/805))
8
+
3
9
  ### 0.11.0 (2022-07-27)
4
10
 
5
11
  #### Features
@@ -14,6 +14,6 @@
14
14
 
15
15
  module Gapic
16
16
  module Common
17
- VERSION = "0.11.0".freeze
17
+ VERSION = "0.11.1".freeze
18
18
  end
19
19
  end
@@ -140,7 +140,8 @@ module Gapic
140
140
  # @return [Boolean] Whether an error has been returned.
141
141
  #
142
142
  def error?
143
- done? && (!err.nil? || !error_code.nil?)
143
+ no_error_code = error_code.nil? || error_code.zero?
144
+ done? && !(err.nil? && no_error_code)
144
145
  end
145
146
 
146
147
  ##
@@ -108,12 +108,9 @@ module Gapic
108
108
  uri_values = bind_uri_values! http_binding, request_hash
109
109
  next if uri_values.any? { |_, value| value.nil? }
110
110
 
111
- if http_binding.body && http_binding.body != "*"
112
- # Note that the body template can only point to a top-level field,
113
- # so there is no need to split the path.
114
- body_binding_camel = camel_name_for http_binding.body
115
- next unless request_hash.key? body_binding_camel
116
- end
111
+ # Note that the body template can only point to a top-level field,
112
+ # so there is no need to split the path.
113
+ next if http_binding.body && http_binding.body != "*" && !(request.respond_to? http_binding.body.to_sym)
117
114
 
118
115
  method = http_binding.method
119
116
  uri = expand_template http_binding.template, uri_values
@@ -182,9 +179,15 @@ module Gapic
182
179
  #
183
180
  # The `request_hash_without_uri` at this point was mutated to delete these fields.
184
181
  #
185
- # Note that the body template can only point to a top-level field
186
- request_hash_without_uri.delete camel_name_for body_template
187
- body = request.send(body_template.to_sym).to_json(emit_defaults: true)
182
+ # Note 1: body template can only point to a top-level field.
183
+ # Note 2: The field that body template points to can be null, in which case
184
+ # an empty string should be sent. E.g. `Compute.Projects.SetUsageExportBucket`.
185
+ request_body_field = request.send body_template.to_sym if request.respond_to? body_template.to_sym
186
+ if request_body_field
187
+ request_hash_without_uri.delete camel_name_for body_template
188
+ body = request_body_field.to_json emit_defaults: true
189
+ end
190
+
188
191
  query_params = build_query_params request_hash_without_uri
189
192
  else
190
193
  query_params = build_query_params request_hash_without_uri
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gapic-common
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Google API Authors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-27 00:00:00.000000000 Z
11
+ date: 2022-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday