gapic-common 0.10.0 → 0.11.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: 5962314c78d1864ee6b768003c887d15af76619c8644a96392f0931ad6f2712c
4
- data.tar.gz: 89920288c50070f089949eb11ff94010a52b69d1919b5e4ab6eb50cd9a3610ad
3
+ metadata.gz: 2760df5ba60e10af0fcea12a09d984b020d5dde80a2969cef159272a1e766731
4
+ data.tar.gz: ad50bd4473dbf92bd8f31cdcaa0ab87bb08d53c359fc45f7b4f335bac0bcc56c
5
5
  SHA512:
6
- metadata.gz: 02c0113ca2287b79558c698393b3315b85c4359b15b90bf54929ea7e7f04a5189769559a69d22f35cebcedb99d62d1a02b2a7ca16739ea724565ace848a89279
7
- data.tar.gz: cf43e6bedb320bc4f91f22e4b0354c87583b92e5734ea4d5d40d280bd9ffeaf0d272eda97e1e9bae2ce7e507e8a56a76c4a5c26ca5156326e7edd1bc88dfc5d9
6
+ metadata.gz: ffd0f60edffb9a9d57113d13d46300d7da0102291d10977f5e900baf482a9c2822180a75460e0079e457dca861cd0bc9af15cc80694021de5c1ab9ad23b2c7a3
7
+ data.tar.gz: ed5d777bdb4ae4359b3fb6b1ee1b12e751541b565b08fdeacc4f698caeac878b7a3a540b2004bf63b7bb8a063da51620e7892ac5bcae98234ff969e804456cc7
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Release History
2
2
 
3
+ ### 0.11.0 (2022-07-27)
4
+
5
+ #### Features
6
+
7
+ * Add CallOptions#merge and CallOptions equality checking ([#802](https://github.com/googleapis/gapic-generator-ruby/issues/802))
8
+
9
+ #### Bug Fixes
10
+
11
+ * transcoder should always preserve slashes ([#795](https://github.com/googleapis/gapic-generator-ruby/issues/795))
12
+
3
13
  ### 0.10.0 (2022-06-20)
4
14
 
5
15
  #### Features
@@ -74,6 +74,7 @@ module Gapic
74
74
  #
75
75
  # @param retry_policy [Hash] The policy for error retry. keys must match the arguments for
76
76
  # {RpcCall::RetryPolicy.new}.
77
+ #
77
78
  def apply_defaults retry_policy
78
79
  return unless retry_policy.is_a? Hash
79
80
 
@@ -85,6 +86,21 @@ module Gapic
85
86
  self
86
87
  end
87
88
 
89
+ # @private Equality test
90
+ def eql? other
91
+ other.is_a?(RetryPolicy) &&
92
+ other.retry_codes == retry_codes &&
93
+ other.initial_delay == initial_delay &&
94
+ other.multiplier == multiplier &&
95
+ other.max_delay == max_delay
96
+ end
97
+ alias == eql?
98
+
99
+ # @private Hash code
100
+ def hash
101
+ [retry_codes, initial_delay, multiplier, max_delay].hash
102
+ end
103
+
88
104
  # @private
89
105
  # See https://grpc.github.io/grpc/core/md_doc_statuscodes.html for a
90
106
  # list of error codes.
@@ -61,12 +61,18 @@ module Gapic
61
61
  # @param retry_policy [Hash] the policy for error retry.
62
62
  # @param retry_policy [Hash] The policy for error retry. keys must match the arguments for
63
63
  # {RetryPolicy.new}.
64
+ #
64
65
  def apply_defaults timeout: nil, metadata: nil, retry_policy: nil
65
66
  @timeout ||= timeout
66
67
  @metadata = metadata.merge @metadata if metadata
67
68
  @retry_policy.apply_defaults retry_policy if @retry_policy.respond_to? :apply_defaults
68
69
  end
69
70
 
71
+ ##
72
+ # Convert to hash form.
73
+ #
74
+ # @return [Hash]
75
+ #
70
76
  def to_h
71
77
  {
72
78
  timeout: timeout,
@@ -74,5 +80,31 @@ module Gapic
74
80
  retry_policy: retry_policy
75
81
  }
76
82
  end
83
+
84
+ ##
85
+ # Return a new CallOptions with the given modifications. The current object
86
+ # is not modified.
87
+ #
88
+ # @param kwargs [keywords] Updated fields. See {#initialize} for details.
89
+ # @return [CallOptions] A new CallOptions object.
90
+ #
91
+ def merge **kwargs
92
+ kwargs = to_h.merge kwargs
93
+ CallOptions.new(**kwargs)
94
+ end
95
+
96
+ # @private Equality test
97
+ def eql? other
98
+ other.is_a?(CallOptions) &&
99
+ other.timeout == timeout &&
100
+ other.metadata == metadata &&
101
+ other.retry_policy == retry_policy
102
+ end
103
+ alias == eql?
104
+
105
+ # @private Hash code
106
+ def hash
107
+ to_h.hash
108
+ end
77
109
  end
78
110
  end
@@ -14,6 +14,6 @@
14
14
 
15
15
  module Gapic
16
16
  module Common
17
- VERSION = "0.10.0".freeze
17
+ VERSION = "0.11.0".freeze
18
18
  end
19
19
  end
@@ -49,8 +49,8 @@ module Gapic
49
49
  matches.each do |name, _regex, _preserve_slashes|
50
50
  unless uri_template =~ /({#{Regexp.quote name}})/
51
51
  err_msg = "Binding configuration is incorrect: missing parameter in the URI template.\n" \
52
- "Parameter `#{name}` is specified for matching but there is no corresponding parameter" \
53
- " `{#{name}}` in the URI template."
52
+ "Parameter `#{name}` is specified for matching but there is no corresponding parameter " \
53
+ "`{#{name}}` in the URI template."
54
54
  raise ::Gapic::Common::Error, err_msg
55
55
  end
56
56
 
@@ -60,8 +60,8 @@ module Gapic
60
60
  if template =~ /{([a-zA-Z_.]+)}/
61
61
  err_name = Regexp.last_match[1]
62
62
  err_msg = "Binding configuration is incorrect: missing match configuration.\n" \
63
- "Parameter `{#{err_name}}` is specified in the URI template but there is no" \
64
- " corresponding match configuration for `#{err_name}`."
63
+ "Parameter `{#{err_name}}` is specified in the URI template but there is no " \
64
+ "corresponding match configuration for `#{err_name}`."
65
65
  raise ::Gapic::Common::Error, err_msg
66
66
  end
67
67
 
@@ -145,11 +145,7 @@ module Gapic
145
145
  field_value = extract_scalar_value! request_hash, field_path_camel, field_binding.regex
146
146
 
147
147
  if field_value
148
- field_value = if field_binding.preserve_slashes
149
- field_value.split("/").map { |segment| percent_escape(segment) }.join("/")
150
- else
151
- percent_escape field_value
152
- end
148
+ field_value = field_value.split("/").map { |segment| percent_escape(segment) }.join("/")
153
149
  end
154
150
 
155
151
  [field_binding.field_path, field_value]
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.10.0
4
+ version: 0.11.0
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-06-20 00:00:00.000000000 Z
11
+ date: 2022-07-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday