foobara-http-command-connector 0.0.15 → 0.0.16

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: 4a6e931ec6770cb9d080f7881905dfac20b5246a0ca5726e14ce37151edff543
4
- data.tar.gz: b11048224ade66b0fda7dc73b33ce49f522402e283e8ac10bd776e5548c9b6bd
3
+ metadata.gz: 867913b446772a3f596af65d9fff1c5339d0c610e63a9c0ef8db89ed2a949f8d
4
+ data.tar.gz: 9f0cee13ea187120564fcaa957495cdfa09265d57ad4529d74d42b5e57ad785b
5
5
  SHA512:
6
- metadata.gz: 3b4386dd8cbcdccd2b4fe4bc02dde29cae04704fa56e5458dd77d712515518c9e91af64664255679f81539c6b33346b3c8aa91e33cdac95ba98073a5d74359d1
7
- data.tar.gz: 5fbb2a89db7b9605e0509eaac865feea185dd13ac6067c2ce8166cac87970bcf09ab3e2ba31f02c6cfb4328e86b2bbb304cc32ada10193411bd1f0948e001e15
6
+ metadata.gz: 6607270c3fa41c2c5f1e9bb5cb8c44aa2bfbd4b0ecbda02f12df05d3885576282f7f488363b3685e80ad0a8bdfbfaa5d54bbae6b87a56caa7c60f09f49dbb814
7
+ data.tar.gz: a6d83f007e906068d00adef1d4d7b8d2ca852674103db598b32acb48594efd2e8fd636c71d320dcc3aa82da6113d11efdb5275988103464cffd13e3fe133dd20
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [0.0.16] - 2025-03-28
2
+
3
+ -
4
+
1
5
  ## [0.0.15] - 2025-03-28
2
6
 
3
7
  - Implement MoveAttributeToCookie response mutator
@@ -0,0 +1,40 @@
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
+ subclass.attribute_name = attribute_name
12
+ subclass.cookie_name = cookie_name
13
+
14
+ subclass
15
+ end
16
+ end
17
+
18
+ attr_writer :attribute_name, :cookie_name
19
+
20
+ def inputs_type_from(inputs_type)
21
+ new_declaration = TypeDeclarations::Attributes.reject(inputs_type.declaration_data, attribute_name)
22
+ Domain.current.foobara_type_from_declaration(new_declaration)
23
+ end
24
+
25
+ def mutate(request)
26
+ cookie_value = request.cookies[cookie_name]
27
+ request.inputs[attribute_name] = cookie_value
28
+ end
29
+
30
+ def attribute_name
31
+ @attribute_name ||= self.class.attribute_name
32
+ end
33
+
34
+ def cookie_name
35
+ @cookie_name ||= self.class.cookie_name
36
+ end
37
+ end
38
+ end
39
+ end
40
+ 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
- cookie_value = response.body.delete(attribute_name)
30
- response.add_cookie(cookie_name, cookie_value, cookie_opts)
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.15
4
+ version: 0.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Georgi
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-03-28 00:00:00.000000000 Z
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