foobara-http-command-connector 0.0.24 → 0.0.25

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: 3d736806debd1bbbac0e0e19a500a10077b24b8f78d04d8493328e323467b3cb
4
- data.tar.gz: 5d881973d9994cfd5b127bb57a5dc6e7bbed2e210c0013e7d9fa3b9efaae81c8
3
+ metadata.gz: 88dbdfc89d4069572fddd99686602ba6397997f6c783436dfd95b105a615034b
4
+ data.tar.gz: 0cadfc7c58c3d52c7a8fdecd1e2f6bc7ba8fb6f513dd835ed1e93786090aafaf
5
5
  SHA512:
6
- metadata.gz: 148abf405a30f5a2008f646df51568799da0cc875e832e4b205bc7fe77d32d148d546629902232e535d0d1948c95fe705d5271f6f617563ad363a179e838afcc
7
- data.tar.gz: f1b512be8a16cb6422e00ff0167785dfd3cd5bd88c1b8b743ef1cb7f3fd2291453256c3646445dd9933e969efc63b03cf59a6d6c23aeba2f36b80755514092c0
6
+ metadata.gz: a38d412897c87218f0941b0df609f98481766557fa8182766d8ba704b93c2fc15d79bf71104a90e5a2ffcae99c4c845cc4171af19645ffdbdad38bf44bf05232
7
+ data.tar.gz: 72c53f3b1fa770643c09a8755818e8b54619ebea9b6a2b2172790d73228f6bb33009b3b19aaafbe4ebcd3f819b944ca7aa82dcbee7d11393f06922991f7c2240
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [0.0.25] - 2025-05-01
2
+
3
+ - Add SetInputToProcResult request transformer
4
+
1
5
  ## [0.0.24] - 2025-04-28
2
6
 
3
7
  - Make sure cookies are looked up by string not symbol
@@ -0,0 +1,41 @@
1
+ module Foobara
2
+ module CommandConnectors
3
+ class Http < CommandConnector
4
+ # TODO: We don't really want to mutate the request. We just need access to the authenticated user.
5
+ # consider changing inputs transformer to have access to the command/request somehow
6
+ class SetInputToProcResult < RequestMutator
7
+ class << self
8
+ attr_accessor :attribute_name, :input_value_proc
9
+
10
+ def for(attribute_name, &input_value_proc)
11
+ subclass = Class.new(self)
12
+
13
+ subclass.attribute_name = attribute_name
14
+ subclass.input_value_proc = input_value_proc
15
+
16
+ subclass
17
+ end
18
+ end
19
+
20
+ attr_writer :attribute_name, :input_value_proc
21
+
22
+ def inputs_type_from(inputs_type)
23
+ new_declaration = TypeDeclarations::Attributes.reject(inputs_type.declaration_data, attribute_name)
24
+ Domain.current.foobara_type_from_declaration(new_declaration)
25
+ end
26
+
27
+ def mutate(request)
28
+ request.inputs[attribute_name] = request.instance_exec(&input_value_proc)
29
+ end
30
+
31
+ def attribute_name
32
+ @attribute_name ||= self.class.attribute_name
33
+ end
34
+
35
+ def input_value_proc
36
+ @input_value_proc ||= self.class.input_value_proc
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foobara-http-command-connector
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.24
4
+ version: 0.0.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Georgi
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-04-28 00:00:00.000000000 Z
10
+ date: 2025-05-01 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: foobara
@@ -67,6 +67,7 @@ files:
67
67
  - src/http/request.rb
68
68
  - src/http/request_mutators/set_input_from_cookie.rb
69
69
  - src/http/request_mutators/set_input_from_header.rb
70
+ - src/http/request_mutators/set_input_to_proc_result.rb
70
71
  - src/http/response.rb
71
72
  - src/http/response_mutators/move_attribute_to_cookie.rb
72
73
  - src/http/response_mutators/move_attribute_to_header.rb