Class: Pytty::Client::Api::Signal

Inherits:
Object
  • Object
show all
Defined in:
lib/pytty/client/api/signal.rb

Class Method Summary collapse

Class Method Details

.run(id:, signal:) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/pytty/client/api/signal.rb', line 5

def self.run(id:, signal:)
  internet = Async::HTTP::Internet.new
  headers = [['accept', 'application/json']]
  body = {
    signal: signal
  }.to_json

  response = internet.post("#{Pytty::Client.host_url}/v1/signal/#{id}", headers, [body])
  [response, JSON.parse(response.read)]
ensure
  internet.close
end