Class: Pytty::Client::Api::Port
- Inherits:
-
Object
- Object
- Pytty::Client::Api::Port
- Defined in:
- lib/pytty/client/api/port.rb
Class Method Summary collapse
Class Method Details
.run(id:, from:, to:) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/pytty/client/api/port.rb', line 5 def self.run(id:, from:, to:) internet = Async::HTTP::Internet.new headers = [['accept', 'application/json']] body = { from: from, to: to }.to_json response = internet.post("#{Pytty::Client.host_url}/v1/port/#{id}", headers, [body]) [response, JSON.parse(response.body.read)] ensure internet.close end |