lib/pytty/client/api/yield.rb in pytty-0.3.0 vs lib/pytty/client/api/yield.rb in pytty-0.4.0

- old
+ new

@@ -1,23 +1,24 @@ module Pytty module Client module Api class Yield - def self.run(cmd:, env:) + def self.run(cmd:, id:, env:) internet = Async::HTTP::Internet.new headers = [['accept', 'application/json']] term_env = { "LINES" => IO.console.winsize.first.to_s, "COLUMNS" => IO.console.winsize.last.to_s }.merge env body = { + id: id, cmd: cmd, env: term_env }.to_json - response = internet.post("http://localhost:1234/v1/yield", headers, [body]) + response = internet.post("#{Pytty::Client.host_url}/v1/yield", headers, [body]) JSON.parse(response.body.read) end end end end \ No newline at end of file