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 +4 -4
- data/CHANGELOG.md +4 -0
- data/src/http/request_mutators/set_input_to_proc_result.rb +41 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88dbdfc89d4069572fddd99686602ba6397997f6c783436dfd95b105a615034b
|
4
|
+
data.tar.gz: 0cadfc7c58c3d52c7a8fdecd1e2f6bc7ba8fb6f513dd835ed1e93786090aafaf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a38d412897c87218f0941b0df609f98481766557fa8182766d8ba704b93c2fc15d79bf71104a90e5a2ffcae99c4c845cc4171af19645ffdbdad38bf44bf05232
|
7
|
+
data.tar.gz: 72c53f3b1fa770643c09a8755818e8b54619ebea9b6a2b2172790d73228f6bb33009b3b19aaafbe4ebcd3f819b944ca7aa82dcbee7d11393f06922991f7c2240
|
data/CHANGELOG.md
CHANGED
@@ -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.
|
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-
|
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
|