protocol-grpc 0.3.0 → 0.4.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: a889e5eb3f6b74e8609a27a4667b62611ab8dc0515d24d9ecf70c4fee7e25b11
4
- data.tar.gz: 56b5bc9e9d8a767db66ead55bcc97404e8092ef6a75a008d4bd893624391b808
3
+ metadata.gz: 301c1d74991d960be7af4b50850ffa24aab9e4c2c7aedc97759518027aacfe18
4
+ data.tar.gz: ac2fe4b32aa211ef8dbf4329a8677ae09deced47ab21816c0b6fb361d346dcd2
5
5
  SHA512:
6
- metadata.gz: 6aab2ee9f75421070a6348c39da680c7cd320e31021b9492f48d48832ab4caf580ffa77113a792e336cd87158890d22ed12d9e4650079954b33c99c7da85e422
7
- data.tar.gz: 67c0e25c06ed8f5c8ad431233506f6133655d64a6e546d9767c74049d85b0fa6b54e37384e15e6458c429f0431779fad96c8b01e30821acd8f7952a260ccf3de
6
+ metadata.gz: 2467aaa36d36c6d011ee4913984defc1974d008bf25081777863d83b4c3c7c7825556ae571a99cc74858a7eece0c99cf253953230bbb7220244082a2c32bd95f
7
+ data.tar.gz: 222fe2052157790f288d72f6f6feff1ad42d507ab188e2bce23cbf0f2e9fa63d7eb0966f774935e5ae0ad3e5a497170f8b126f9dfa4d10ccf53b7f385d7b8437
checksums.yaml.gz.sig CHANGED
Binary file
@@ -129,5 +129,3 @@ call.deadline.exceeded? # => false
129
129
  # Access peer information
130
130
  call.peer # => Protocol::HTTP::Address
131
131
  ```
132
-
133
-
data/design.md CHANGED
@@ -779,10 +779,10 @@ module Protocol
779
779
  # Handle the RPC
780
780
  begin
781
781
  handle_rpc(request, handler, handler_method, request_class, response_class)
782
- rescue Error => e
783
- trailers_only_error(e.status_code, e.message)
784
- rescue => e
785
- trailers_only_error(Status::INTERNAL, e.message)
782
+ rescue Error => error
783
+ trailers_only_error(e.status_code, error.message)
784
+ rescue => error
785
+ trailers_only_error(Status::INTERNAL, error.message)
786
786
  end
787
787
  end
788
788
 
@@ -15,6 +15,11 @@ module Protocol
15
15
  # This is the standard readable body for gRPC - all gRPC responses use message framing.
16
16
  # Wraps the underlying HTTP body and transforms raw chunks into decoded gRPC messages.
17
17
  class ReadableBody < Protocol::HTTP::Body::Wrapper
18
+ # Wrap the body of a message.
19
+ #
20
+ # @parameter message [Request | Response] The message to wrap.
21
+ # @parameter options [Hash] The options to pass to the initializer.
22
+ # @returns [ReadableBody | Nil] The wrapped body or `nil` if the message has no body.
18
23
  def self.wrap(message, **options)
19
24
  if body = message.body
20
25
  message.body = self.new(body, **options)
@@ -11,8 +11,8 @@ module Protocol
11
11
  # Can be used by both client stubs and server implementations.
12
12
  class Interface
13
13
  # RPC method definition
14
- RPC = Struct.new(:request_class, :response_class, :streaming, :method, keyword_init: true) do
15
- def initialize(request_class:, response_class:, streaming: :unary, method: nil)
14
+ RPC = Struct.new(:name, :request_class, :response_class, :streaming, :method, keyword_init: true) do
15
+ def initialize(name:, request_class:, response_class:, streaming: :unary, method: nil)
16
16
  super
17
17
  end
18
18
 
@@ -40,6 +40,8 @@ module Protocol
40
40
  # @parameter streaming [Symbol] Streaming type (:unary, :server_streaming, :client_streaming, :bidirectional)
41
41
  # @parameter method [Symbol | Nil] Optional explicit Ruby method name (snake_case). If not provided, automatically converts PascalCase to snake_case.
42
42
  def self.rpc(name, **options)
43
+ options[:name] = name
44
+
43
45
  # Ensure snake_case method name is always available
44
46
  options[:method] ||= pascal_case_to_snake_case(name.to_s).to_sym
45
47
 
@@ -7,7 +7,6 @@
7
7
  module Protocol
8
8
  # @namespace
9
9
  module GRPC
10
- VERSION = "0.3.0"
10
+ VERSION = "0.4.0"
11
11
  end
12
12
  end
13
-
data/readme.md CHANGED
@@ -28,6 +28,10 @@ Please see the [project documentation](https://socketry.github.io/protocol-grpc/
28
28
 
29
29
  Please see the [project releases](https://socketry.github.io/protocol-grpc/releases/index) for all releases.
30
30
 
31
+ ### v0.4.0
32
+
33
+ - Add `RPC#name`.
34
+
31
35
  ### v0.3.0
32
36
 
33
37
  - **Breaking**: `Protocol::GRPC::Call` now takes a `response` object parameter instead of separate `response_headers`.
data/releases.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Releases
2
2
 
3
+ ## v0.4.0
4
+
5
+ - Add `RPC#name`.
6
+
3
7
  ## v0.3.0
4
8
 
5
9
  - **Breaking**: `Protocol::GRPC::Call` now takes a `response` object parameter instead of separate `response_headers`.
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.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
metadata.gz.sig CHANGED
Binary file