Class: EzPaaS::HTTP::SSEClient
Instance Attribute Summary
Attributes inherited from HTTPClient
#url
Instance Method Summary
collapse
Methods inherited from HTTPClient
#initialize
Instance Method Details
#deploy(app, file_name) ⇒ Object
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/ezpaas/http/sse_client.rb', line 12
def deploy(app, file_name)
begin
file = File.open(file_name, 'rb')
path = "/deployments?app=#{app}"
options = {
body: file,
headers: {'Content-Type': 'application/tar'}
}
streaming_request(:post, path, options) do |message|
yield message.data if block_given?
end
ensure
file.close
end
end
|
#destroy(app) ⇒ Object
39
40
41
42
43
44
|
# File 'lib/ezpaas/http/sse_client.rb', line 39
def destroy(app)
path = "/deployments?app=#{app}"
streaming_request(:delete, path) do |message|
yield message.data if block_given?
end
end
|
#scale(app, scale) ⇒ Object
31
32
33
34
35
36
37
|
# File 'lib/ezpaas/http/sse_client.rb', line 31
def scale(app, scale)
scale_qs = scale.map { |k, v| "scale[#{k}]=#{v}" }.join('&')
path = "/deployments?app=#{app}&" + scale_qs
streaming_request(:patch, path) do |message|
yield message.data if block_given?
end
end
|