protocol-grpc 0.7.0 → 0.9.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: 5ead258154cb8fe775c509d2b4aa05aadee904b18f052ff72163559c45ffdae0
4
- data.tar.gz: 5af2daafbecc85fcd2fa722f9c8e02a262997e0a7fe1fdc0196fab7af80cf2aa
3
+ metadata.gz: 7a4e884fa493dfbcc313a9c261b9d0cbeef027dc04b7ad99f031160f9231a8e5
4
+ data.tar.gz: f0bb7c75757eef5ae129197304ebe1922b928348b65560512ef110586d49ba66
5
5
  SHA512:
6
- metadata.gz: 1e417c6adce8b055da14fd619381f3de243022ed2e9a27841cb2fab0c0c5232c57bbd559728cfcbf72e1ab61e49981f93d100cde21d3a4d194c0f17a89bc1087
7
- data.tar.gz: 88290f4fb1f059056e0a545eaae4d90efcb4c7b01e69937ecfa17370392092edd66ce178ed1ebab68da3fbb90bfe879ff02ac6ea20f9768e377faa01c7445aa4
6
+ metadata.gz: 1a9db6d101f6f41583d0b8c09fd00f7c4aa03de315e6a969484ae9c48b23a102b5c957bd47cd3c99d70c367e944d18f23e36c27436c8d8d897df7339d49bf9f7
7
+ data.tar.gz: 90f1f8718e1b147cae4a6140aa2b391cb513abe89fa53708c22f5fa8f40724c36c61f35ad448e5ccbcf5437cb4e9bc4e4ee4b4276ea9f1e26399716d55c6fc5c
checksums.yaml.gz.sig CHANGED
Binary file
@@ -91,8 +91,8 @@ require "protocol/grpc/body/readable"
91
91
 
92
92
  # Read response body
93
93
  readable_body = Protocol::GRPC::Body::Readable.new(
94
- response.body,
95
- message_class: Hello::HelloReply
94
+ response.body,
95
+ message_class: Hello::HelloReply
96
96
  )
97
97
 
98
98
  message = readable_body.read
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2025, by Samuel Williams.
4
+ # Copyright, 2026, by Samuel Williams.
5
5
 
6
6
  require "uri"
7
7
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2025, by Samuel Williams.
4
+ # Copyright, 2026, by Samuel Williams.
5
5
 
6
6
  module Protocol
7
7
  module GRPC
@@ -1,14 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2025, by Samuel Williams.
4
+ # Copyright, 2025-2026, by Samuel Williams.
5
5
 
6
6
  require "protocol/http"
7
7
 
8
8
  require_relative "status"
9
9
  require_relative "header/status"
10
10
  require_relative "header/message"
11
- require_relative "header/metadata"
12
11
 
13
12
  module Protocol
14
13
  module GRPC
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2025, by Samuel Williams.
4
+ # Copyright, 2025-2026, by Samuel Williams.
5
5
 
6
6
  require_relative "methods"
7
7
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2025, by Samuel Williams.
4
+ # Copyright, 2025-2026, by Samuel Williams.
5
5
 
6
6
  require "base64"
7
7
  require "protocol/http"
@@ -55,16 +55,22 @@ module Protocol
55
55
  def self.extract_metadata(headers)
56
56
  metadata = {}
57
57
 
58
- headers.each do |key, value|
58
+ headers.to_h.each do |key, value|
59
59
  # Skip reserved headers:
60
60
  next if key.start_with?("grpc-") || key == "content-type" || key == "te"
61
61
 
62
62
  # Decode binary headers:
63
- metadata[key] = if key.end_with?("-bin")
64
- Base64.strict_decode64(value)
63
+ if key.end_with?("-bin")
64
+ if value.is_a?(String)
65
+ value = Base64.strict_decode64(value)
66
+ elsif value.is_a?(Array)
67
+ value = value.map{|item| Base64.strict_decode64(item)}
68
+ end
65
69
  else
66
70
  value
67
71
  end
72
+
73
+ metadata[key] = value
68
74
  end
69
75
 
70
76
  metadata
@@ -1,13 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2025, by Samuel Williams.
4
+ # Copyright, 2025-2026, by Samuel Williams.
5
5
 
6
6
  # @namespace
7
7
  module Protocol
8
8
  # @namespace
9
9
  module GRPC
10
- VERSION = "0.7.0"
10
+ VERSION = "0.9.0"
11
11
  end
12
12
  end
13
13
 
data/license.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # MIT License
2
2
 
3
- Copyright, 2025, by Samuel Williams.
3
+ Copyright, 2025-2026, by Samuel Williams.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: protocol-grpc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -110,7 +110,6 @@ files:
110
110
  - lib/protocol/grpc/error.rb
111
111
  - lib/protocol/grpc/header.rb
112
112
  - lib/protocol/grpc/header/message.rb
113
- - lib/protocol/grpc/header/metadata.rb
114
113
  - lib/protocol/grpc/header/status.rb
115
114
  - lib/protocol/grpc/health_check.rb
116
115
  - lib/protocol/grpc/interface.rb
metadata.gz.sig CHANGED
Binary file
@@ -1,22 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Released under the MIT License.
4
- # Copyright, 2025, by Samuel Williams.
5
-
6
- require "protocol/http"
7
-
8
- module Protocol
9
- module GRPC
10
- module Header
11
- # Base class for custom gRPC metadata (allowed in trailers).
12
- class Metadata < Protocol::HTTP::Header::Split
13
- # Whether this header is acceptable in HTTP trailers.
14
- # The `grpc-metadata` header can appear in trailers as per the gRPC specification.
15
- # @returns [Boolean] `true`, as grpc-metadata can appear in trailers.
16
- def self.trailer?
17
- true
18
- end
19
- end
20
- end
21
- end
22
- end