foobara-http-command-connector 0.0.25 → 0.0.26

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: 88dbdfc89d4069572fddd99686602ba6397997f6c783436dfd95b105a615034b
4
- data.tar.gz: 0cadfc7c58c3d52c7a8fdecd1e2f6bc7ba8fb6f513dd835ed1e93786090aafaf
3
+ metadata.gz: 29aa9d3315dc94a20e2799a25609724d6c07116d468c0187618916ecb294f424
4
+ data.tar.gz: a04bbdca1ed113eb63589e437ce5262e2c483704601473f2665fcfe660c2740b
5
5
  SHA512:
6
- metadata.gz: a38d412897c87218f0941b0df609f98481766557fa8182766d8ba704b93c2fc15d79bf71104a90e5a2ffcae99c4c845cc4171af19645ffdbdad38bf44bf05232
7
- data.tar.gz: 72c53f3b1fa770643c09a8755818e8b54619ebea9b6a2b2172790d73228f6bb33009b3b19aaafbe4ebcd3f819b944ca7aa82dcbee7d11393f06922991f7c2240
6
+ metadata.gz: 9f3860ea8fa74eec452c33bd8065a3ffae94227ea5123103c1354b4547307060139a9a62badeb9eb33c49b300d281dd70aab9e45f21a9589d6e12cc8920c78a2
7
+ data.tar.gz: 5c5e6ad45a9d9af5e732121d1cda3433a0d98a7f2ae1765fa62a2de61e18824c6fef07e02c802034ef040ad7c756b5c60caa55c493d30bfc0216ce29fdd03f8c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [0.0.26] - 2025-05-03
2
+
3
+ - Deal with CommandConnector interface changes
4
+
1
5
  ## [0.0.25] - 2025-05-01
2
6
 
3
7
  - Add SetInputToProcResult request transformer
data/src/http/request.rb CHANGED
@@ -113,14 +113,6 @@ module Foobara
113
113
  path
114
114
  end
115
115
  end
116
-
117
- def set_response_header(name, value)
118
- name = name.to_s
119
- name = name.downcase
120
-
121
- self.response_headers ||= {}
122
- self.response_headers = response_headers.merge(name => value)
123
- end
124
116
  end
125
117
  end
126
118
  end
@@ -24,6 +24,10 @@ module Foobara
24
24
  Domain.current.foobara_type_from_declaration(new_declaration)
25
25
  end
26
26
 
27
+ def applicable?(_request)
28
+ true
29
+ end
30
+
27
31
  def mutate(request)
28
32
  request.inputs[attribute_name] = request.instance_exec(&input_value_proc)
29
33
  end
data/src/http.rb CHANGED
@@ -58,24 +58,28 @@ module Foobara
58
58
  super(*, prefix:, **)
59
59
  end
60
60
 
61
- def request_to_command(request)
61
+ def request_to_command_class(request)
62
62
  if request.method == "OPTIONS"
63
- return Foobara::CommandConnectors::Http::Commands::GetOptions.new(request:)
63
+ Foobara::CommandConnectors::Http::Commands::GetOptions
64
+ else
65
+ super.tap do |command_class|
66
+ if request.action == "help"
67
+ command_class.serializers = [Commands::Help::ResultSerializer]
68
+ end
69
+ end
64
70
  end
71
+ end
65
72
 
66
- command = super
67
-
68
- if request.action == "help"
69
- request.set_response_header("content-type", "text/html")
70
- command.class.serializers = [Commands::Help::ResultSerializer]
73
+ def request_to_command_inputs(request)
74
+ if request.method == "OPTIONS"
75
+ { request: }
76
+ else
77
+ super
71
78
  end
72
-
73
- command
74
79
  end
75
80
 
76
81
  def set_response_status(response)
77
- command = response.command
78
- outcome = command.outcome
82
+ outcome = response.outcome
79
83
 
80
84
  response.status = if outcome.success?
81
85
  200
@@ -124,6 +128,10 @@ module Foobara
124
128
  end
125
129
  end
126
130
 
131
+ if request.action == "help"
132
+ response_headers = (response_headers || {}).merge("content-type" => "text/html")
133
+ end
134
+
127
135
  if response_headers
128
136
  static_headers.merge(response_headers)
129
137
  else
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.25
4
+ version: 0.0.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Georgi
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-05-01 00:00:00.000000000 Z
10
+ date: 2025-05-03 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: foobara
@@ -15,14 +15,14 @@ dependencies:
15
15
  requirements:
16
16
  - - "~>"
17
17
  - !ruby/object:Gem::Version
18
- version: 0.0.88
18
+ version: 0.0.116
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - "~>"
24
24
  - !ruby/object:Gem::Version
25
- version: 0.0.88
25
+ version: 0.0.116
26
26
  email:
27
27
  - azimux@gmail.com
28
28
  executables: []