foobara 0.0.94 → 0.0.95

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: 481928c28115c1b97adee6f5caa284b559ca954ee57f337bbb456ab80972b4eb
4
- data.tar.gz: 2d083d6fb702f82dd920e4de4a7ac9bc6e82dd3fa87d874cb89f49d495d4b780
3
+ metadata.gz: 10cd2a997729a02fc1b6f3ea24a4694a7ec3a0e5908eb3fd37f2f90fd7e56c71
4
+ data.tar.gz: 2568a8ffbc4885f8a1edc70c4a7f41582631b0e8f55e6ff6100166814d579a8e
5
5
  SHA512:
6
- metadata.gz: 2c9a25149a21e5d8aa851e4a8776f5f3d8a3e44635598544a4d9da2e8e9709ec61c812e286ecedacd6376e7a928c94993567a5dd00d0c67d829d4f6a4d9848f6
7
- data.tar.gz: 9561f972da6f0c94e40adc04d23ef33e7eea856b045248c4e04f057365543eaf82b6810592221e64e1ecb9e3a31530edb2f7beefa2ab3845a117197bd0b6c6af
6
+ metadata.gz: d41fffe3ecdb08e1c6366ce4bf58cf7733bebcf595f16745ef6b3cd3a1ddfa67a19934934b73aff8e225e03205c73ade43b5ee92d429ba9f1a3d832de1856667
7
+ data.tar.gz: 61dba1a73fb5cb3399b68f2a8f00586f79268495106393b3083beb505d6fecd5c896dfb74beec941e3e4d8c8521e212bc6f499889c68f28c37b56c91c10c4260
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # [0.0.95] - 2025-04-07
2
+
3
+ - Split up #run and #build_request_and_command in CommandConnector to help subclasses
4
+
1
5
  # [0.0.94] - 2025-04-07
2
6
 
3
7
  - Support capture_unknown_errors at the command connector level
@@ -7,6 +7,7 @@ module Foobara
7
7
  attr_accessor :command,
8
8
  :error,
9
9
  :command_connector,
10
+ # Why aren't there serializers on the response?
10
11
  :serializers,
11
12
  :inputs,
12
13
  :full_command_name,
@@ -15,7 +16,7 @@ module Foobara
15
16
  attr_reader :command_class
16
17
 
17
18
  def initialize(**opts)
18
- valid_keys = %i[inputs full_command_name action]
19
+ valid_keys = %i[inputs full_command_name action serializers]
19
20
 
20
21
  invalid_keys = opts.keys - valid_keys
21
22
 
@@ -28,6 +29,7 @@ module Foobara
28
29
  self.inputs = opts[:inputs] if opts.key?(:inputs)
29
30
  self.action = opts[:action] if opts.key?(:action)
30
31
  self.full_command_name = opts[:full_command_name] if opts.key?(:full_command_name)
32
+ self.serializers = Util.array(opts[:serializers]) if opts.key?(:serializers)
31
33
  end
32
34
 
33
35
  def command_class=(klass)
@@ -325,17 +325,23 @@ module Foobara
325
325
  end
326
326
 
327
327
  def build_request(...)
328
- self.class::Request.new(...)
328
+ self.class::Request.new(...).tap do |request|
329
+ # TODO: feels like a smell
330
+ request.command_connector = self
331
+ end
329
332
  end
330
333
 
331
334
  # TODO: maybe introduce a Runner interface?
332
- def run(*, **)
335
+ def run(...)
333
336
  process_delayed_connections
334
337
 
335
- request, command = build_request_and_command(*, **)
338
+ request = build_request(...)
339
+
340
+ run_request(request)
341
+ end
336
342
 
337
- # TODO: feels like a smell
338
- request.command_connector = self
343
+ def run_request(request)
344
+ command = build_command(request)
339
345
 
340
346
  if command.respond_to?(:requires_authentication?) && command.requires_authentication?
341
347
  authenticate(request)
@@ -379,15 +385,13 @@ module Foobara
379
385
  end
380
386
  end
381
387
 
382
- def build_request_and_command(...)
383
- request = build_request(...)
384
-
388
+ def build_command(request)
385
389
  unless request.error
386
390
  command = request_to_command(request)
387
391
  request.command = command
388
392
  end
389
393
 
390
- [request, command]
394
+ command
391
395
  end
392
396
 
393
397
  def build_response(request)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foobara
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.94
4
+ version: 0.0.95
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Georgi
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-04-07 00:00:00.000000000 Z
10
+ date: 2025-04-08 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: bigdecimal