summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-03-06 11:24:42 -0700
committermo khan <mo@mokhan.ca>2025-03-06 11:24:42 -0700
commit27e5b886ad9e9e4c0d831162dbae9d9025fb2903 (patch)
tree32c00563a2d93d82dbeefece715a2cbaeba6d41b /lib
parent0fb8fe928b9ca6f907d532789038f8b8fdcca42c (diff)
refactor: use protobuf3 and define twirp service
Diffstat (limited to 'lib')
-rw-r--r--lib/ability_pb.rb8
-rw-r--r--lib/ability_services_pb.rb22
-rw-r--r--lib/ability_twirp.rb15
3 files changed, 32 insertions, 13 deletions
diff --git a/lib/ability_pb.rb b/lib/ability_pb.rb
index 06bc660..5929bba 100644
--- a/lib/ability_pb.rb
+++ b/lib/ability_pb.rb
@@ -5,10 +5,12 @@
require 'google/protobuf'
-descriptor_data = "\n\rability.proto\"E\n\x0c\x41llowRequest\x12\x0f\n\x07subject\x18\x01 \x02(\t\x12\x12\n\npermission\x18\x02 \x02(\t\x12\x10\n\x08resource\x18\x03 \x02(\t\"\x1c\n\nAllowReply\x12\x0e\n\x06result\x18\x01 \x02(\x08\x32\x32\n\x07\x41\x62ility\x12\'\n\x07\x41llowed\x12\r.AllowRequest\x1a\x0b.AllowReply\"\x00"
+descriptor_data = "\n\rability.proto\x12\x05\x61uthx\"E\n\x0c\x41llowRequest\x12\x0f\n\x07subject\x18\x01 \x01(\t\x12\x12\n\npermission\x18\x02 \x01(\t\x12\x10\n\x08resource\x18\x03 \x01(\t\"\x1c\n\nAllowReply\x12\x0e\n\x06result\x18\x01 \x01(\x08\x32>\n\x07\x41\x62ility\x12\x33\n\x07\x41llowed\x12\x13.authx.AllowRequest\x1a\x11.authx.AllowReply\"\x00\x62\x06proto3"
pool = Google::Protobuf::DescriptorPool.generated_pool
pool.add_serialized_file(descriptor_data)
-AllowRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("AllowRequest").msgclass
-AllowReply = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("AllowReply").msgclass
+module Authx
+ AllowRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("authx.AllowRequest").msgclass
+ AllowReply = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("authx.AllowReply").msgclass
+end
diff --git a/lib/ability_services_pb.rb b/lib/ability_services_pb.rb
index 7aec39b..ca55ef6 100644
--- a/lib/ability_services_pb.rb
+++ b/lib/ability_services_pb.rb
@@ -1,20 +1,22 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
-# Source: ability.proto for package ''
+# Source: ability.proto for package 'authx'
require 'grpc'
require 'ability_pb'
-module Ability
- class Service
+module Authx
+ module Ability
+ class Service
- include ::GRPC::GenericService
+ include ::GRPC::GenericService
- self.marshal_class_method = :encode
- self.unmarshal_class_method = :decode
- self.service_name = 'Ability'
+ self.marshal_class_method = :encode
+ self.unmarshal_class_method = :decode
+ self.service_name = 'authx.Ability'
- rpc :Allowed, ::AllowRequest, ::AllowReply
- end
+ rpc :Allowed, ::Authx::AllowRequest, ::Authx::AllowReply
+ end
- Stub = Service.rpc_stub_class
+ Stub = Service.rpc_stub_class
+ end
end
diff --git a/lib/ability_twirp.rb b/lib/ability_twirp.rb
new file mode 100644
index 0000000..497400e
--- /dev/null
+++ b/lib/ability_twirp.rb
@@ -0,0 +1,15 @@
+# Code generated by protoc-gen-twirp_ruby 1.11.0, DO NOT EDIT.
+require 'twirp'
+require_relative 'ability_pb.rb'
+
+module Authx
+ class AbilityService < ::Twirp::Service
+ package 'authx'
+ service 'Ability'
+ rpc :Allowed, AllowRequest, AllowReply, :ruby_method => :allowed
+ end
+
+ class AbilityClient < ::Twirp::Client
+ client_for AbilityService
+ end
+end