foobara-http-command-connector 0.0.15 → 0.0.17
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 867605b13dfdbb6e3735a376abee65a62af60597a1158946928295823f901980
|
4
|
+
data.tar.gz: 2ef5837bd5fed7c4ad21a952faee5b4b51a7af1e94acf4e2cfc7b037bd7dc75d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5e4f2ddec2597b5f5b42e900420bea28d9f1f770ca063793afd18938e33a03405c8020d8b2d03e7a214c4b8fc67fe97e75b9b16638641816534e61b927c3593
|
7
|
+
data.tar.gz: ab961b1861b1b6ba002b71c46c566cf6eb157148f17ec02f3ca67eec2a8dcc388873b0d6058ef113523d4c97199ed50b687dda98d5b06ebd1dfbd40909c8edaa
|
data/CHANGELOG.md
CHANGED
@@ -0,0 +1,42 @@
|
|
1
|
+
module Foobara
|
2
|
+
module CommandConnectors
|
3
|
+
class Http < CommandConnector
|
4
|
+
class SetInputFromCookie < RequestMutator
|
5
|
+
class << self
|
6
|
+
attr_accessor :attribute_name, :cookie_name
|
7
|
+
|
8
|
+
def for(attribute_name, cookie_name = attribute_name)
|
9
|
+
subclass = Class.new(self)
|
10
|
+
|
11
|
+
cookie_name = cookie_name.to_s if cookie_name.is_a?(::Symbol)
|
12
|
+
|
13
|
+
subclass.attribute_name = attribute_name
|
14
|
+
subclass.cookie_name = cookie_name
|
15
|
+
|
16
|
+
subclass
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
attr_writer :attribute_name, :cookie_name
|
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
|
+
cookie_value = request.cookies[cookie_name]
|
29
|
+
request.inputs[attribute_name] = cookie_value
|
30
|
+
end
|
31
|
+
|
32
|
+
def attribute_name
|
33
|
+
@attribute_name ||= self.class.attribute_name
|
34
|
+
end
|
35
|
+
|
36
|
+
def cookie_name
|
37
|
+
@cookie_name ||= self.class.cookie_name
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -19,15 +19,16 @@ module Foobara
|
|
19
19
|
attr_writer :attribute_name, :cookie_name, :cookie_opts
|
20
20
|
|
21
21
|
def result_type_from(result_type)
|
22
|
-
AttributesTransformers.reject(result_type.declaration_data)
|
23
22
|
new_declaration = TypeDeclarations::Attributes.reject(result_type.declaration_data, attribute_name)
|
24
23
|
|
25
24
|
Domain.current.foobara_type_from_declaration(new_declaration)
|
26
25
|
end
|
27
26
|
|
28
27
|
def mutate(response)
|
29
|
-
|
30
|
-
|
28
|
+
if response.command.success?
|
29
|
+
cookie_value = response.body.delete(attribute_name)
|
30
|
+
response.add_cookie(cookie_name, cookie_value, cookie_opts)
|
31
|
+
end
|
31
32
|
end
|
32
33
|
|
33
34
|
def attribute_name
|
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.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miles Georgi
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-03-
|
10
|
+
date: 2025-03-30 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: foobara
|
@@ -65,6 +65,7 @@ files:
|
|
65
65
|
- src/http/commands/help/templates/type.html.erb
|
66
66
|
- src/http/cookie.rb
|
67
67
|
- src/http/request.rb
|
68
|
+
- src/http/request_mutators/set_input_from_cookie.rb
|
68
69
|
- src/http/response.rb
|
69
70
|
- src/http/response_mutators/move_attribute_to_cookie.rb
|
70
71
|
homepage: https://github.com/foobara/http-command-connector
|