wineskills 0.1.0 → 0.1.1

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: f0cbe57e888a0c33017bc5d5d213d504cb28e2f7c57ca1427b16aa163d625aab
4
- data.tar.gz: 5bf74dfec943c179dd631e5a441ce9106ebb542849d2e5a571a714f202212fe1
3
+ metadata.gz: b37f72f6dc67a42505d6807eb0ab36f203f9d3aefc58373b062fbf83528a2678
4
+ data.tar.gz: 6bd0f57fd9ce6ea16939943978df70fe4251f2e376dae2af3713a60032379f4c
5
5
  SHA512:
6
- metadata.gz: 5a4cf2842c6e4f76251bbb85dc08203dfc6411a310a9fb4dc73ad210635d1846a761264f450120486076afef1b6936c58ac82e95961e0303984d4b418d942417
7
- data.tar.gz: 22645d8dd1978dcbf26344d3def1ba1351c55e3968eb1fb353bb2855e8994eb25f356ec80f9bf8c78a617048e293cbc428148bccc577f08ef68896f0ef929829
6
+ metadata.gz: 92a6af0b8213b8fdb656ce37e07ef6579a052f9b70ab2d1ef1ca623b3f508d76b6d81b38c9fad1583c79e5af914e33fdb50a9b2595e577f142bf328af255948f
7
+ data.tar.gz: 386ef379f6399e04c7662b2d2718c878c7061a005b5cc0cb183d5d04a7b5b0d530fcfc02a131c633b49c5e5a8cdb5b86330ffa5314bb299955be7cc24b1d3143
@@ -5,13 +5,15 @@
5
5
  require 'google/protobuf'
6
6
 
7
7
 
8
- descriptor_data = "\n\x12protos/Wines.proto\x12\x0ewineskills_rpc\"\x11\n\x0fGetWinesRequest\"7\n\x10GetWinesResponse\x12#\n\x05wines\x18\x01 \x03(\x0b\x32\x14.wineskills_rpc.Wine\"\xa0\x01\n\x04Wine\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0c\n\x04kind\x18\x02 \x01(\t\x12\x0c\n\x04\x62ody\x18\x03 \x01(\t\x12\x0f\n\x07\x61\x63idity\x18\x04 \x01(\t\x12\x11\n\telaborate\x18\x05 \x01(\t\x12\x19\n\x11\x61lcohol_by_volume\x18\x06 \x01(\t\x12\x0f\n\x07\x63ountry\x18\x07 \x01(\t\x12\x0e\n\x06region\x18\x08 \x01(\t\x12\x0e\n\x06winery\x18\t \x01(\t2X\n\x05Wines\x12O\n\x08GetWines\x12\x1f.wineskills_rpc.GetWinesRequest\x1a .wineskills_rpc.GetWinesResponse\"\x00\x62\x06proto3"
8
+ descriptor_data = "\n\x12protos/Wines.proto\x12\x0ewineskills_rpc\"\x11\n\x0fGetWinesRequest\"#\n\x12SearchWinesRequest\x12\r\n\x05query\x18\x01 \x01(\t\"7\n\x10GetWinesResponse\x12#\n\x05wines\x18\x01 \x03(\x0b\x32\x14.wineskills_rpc.Wine\":\n\x13SearchWinesResponse\x12#\n\x05wines\x18\x01 \x03(\x0b\x32\x14.wineskills_rpc.Wine\"\xa0\x01\n\x04Wine\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0c\n\x04kind\x18\x02 \x01(\t\x12\x0c\n\x04\x62ody\x18\x03 \x01(\t\x12\x0f\n\x07\x61\x63idity\x18\x04 \x01(\t\x12\x11\n\telaborate\x18\x05 \x01(\t\x12\x19\n\x11\x61lcohol_by_volume\x18\x06 \x01(\t\x12\x0f\n\x07\x63ountry\x18\x07 \x01(\t\x12\x0e\n\x06region\x18\x08 \x01(\t\x12\x0e\n\x06winery\x18\t \x01(\t2\xb2\x01\n\x05Wines\x12O\n\x08GetWines\x12\x1f.wineskills_rpc.GetWinesRequest\x1a .wineskills_rpc.GetWinesResponse\"\x00\x12X\n\x0bSearchWines\x12\".wineskills_rpc.SearchWinesRequest\x1a#.wineskills_rpc.SearchWinesResponse\"\x00\x62\x06proto3"
9
9
 
10
10
  pool = Google::Protobuf::DescriptorPool.generated_pool
11
11
  pool.add_serialized_file(descriptor_data)
12
12
 
13
13
  module WineskillsRpc
14
14
  GetWinesRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("wineskills_rpc.GetWinesRequest").msgclass
15
+ SearchWinesRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("wineskills_rpc.SearchWinesRequest").msgclass
15
16
  GetWinesResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("wineskills_rpc.GetWinesResponse").msgclass
17
+ SearchWinesResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("wineskills_rpc.SearchWinesResponse").msgclass
16
18
  Wine = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("wineskills_rpc.Wine").msgclass
17
19
  end
@@ -15,6 +15,7 @@ module WineskillsRpc
15
15
  self.service_name = 'wineskills_rpc.Wines'
16
16
 
17
17
  rpc :GetWines, ::WineskillsRpc::GetWinesRequest, ::WineskillsRpc::GetWinesResponse
18
+ rpc :SearchWines, ::WineskillsRpc::SearchWinesRequest, ::WineskillsRpc::SearchWinesResponse
18
19
  end
19
20
 
20
21
  Stub = Service.rpc_stub_class
@@ -4,8 +4,12 @@ module Wineskills
4
4
  class CLI < Thor
5
5
  desc "wines", "Prints all wines"
6
6
  def wines
7
- client = ::Gruf::Client.new(service: ::WineskillsRpc::Wines, options: { hostname: ENV.fetch("GRPC_SERVICES_URL") } )
8
- puts client.call(:GetWines).message.wines
7
+ puts Rpc.instance.client.call(:GetWines).message.wines
8
+ end
9
+
10
+ desc "search QUERY", "Search wines with QUERY"
11
+ def search(query)
12
+ puts Rpc.instance.client.call(:SearchWines, query: query).message.wines
9
13
  end
10
14
  end
11
15
  end
@@ -0,0 +1,20 @@
1
+ require "singleton"
2
+
3
+ module Wineskills
4
+ class Rpc
5
+ include Singleton
6
+ attr_accessor :client
7
+
8
+ private
9
+
10
+ def initialize
11
+ @client =
12
+ ::Gruf::Client.new(
13
+ service: ::WineskillsRpc::Wines,
14
+ options: {
15
+ hostname: ENV.fetch("GRPC_SERVICES_URL"),
16
+ },
17
+ )
18
+ end
19
+ end
20
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Wineskills
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
data/lib/wineskills.rb CHANGED
@@ -5,9 +5,11 @@ require_relative "protos/Wines_pb"
5
5
  require_relative "protos/Wines_services_pb"
6
6
 
7
7
  require_relative "wineskills/version"
8
+ require_relative "wineskills/rpc"
8
9
  require_relative "wineskills/cli"
9
10
 
10
11
  module Wineskills
11
- class Error < StandardError; end
12
+ class Error < StandardError
13
+ end
12
14
  # Your code goes here...
13
15
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wineskills
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pierre FILSTROFF
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-08-25 00:00:00.000000000 Z
11
+ date: 2024-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gruf
@@ -58,6 +58,7 @@ files:
58
58
  - lib/protos/Wines_services_pb.rb
59
59
  - lib/wineskills.rb
60
60
  - lib/wineskills/cli.rb
61
+ - lib/wineskills/rpc.rb
61
62
  - lib/wineskills/version.rb
62
63
  - sig/wineskills.rbs
63
64
  homepage: https://wineskills.fiwares.com