Class: Marathon::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/marathon/client.rb

Defined Under Namespace

Classes: InvalidResponseError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(host) ⇒ Client

Returns a new instance of Client.



7
8
9
10
11
12
13
14
# File 'lib/marathon/client.rb', line 7

def initialize(host)
  @host = host
  @uri = URI(host)

  @http = Net::HTTP.new(@uri.host, @uri.port)
  @http.use_ssl = @uri.is_a?(URI::HTTPS)
  @http.start # for keep-alive
end

Instance Attribute Details

#hostObject

Returns the value of attribute host.



5
6
7
# File 'lib/marathon/client.rb', line 5

def host
  @host
end

Instance Method Details

#create_app(definition) ⇒ Object



16
17
18
# File 'lib/marathon/client.rb', line 16

def create_app(definition)
  post('/v2/apps', definition)
end

#delete_app(id) ⇒ Object



24
25
26
# File 'lib/marathon/client.rb', line 24

def delete_app(id)
  delete(app_path(id))
end

#get_app(id) ⇒ Object



28
29
30
# File 'lib/marathon/client.rb', line 28

def get_app(id)
  get(app_path(id))
end

#update_app(id, definition) ⇒ Object



20
21
22
# File 'lib/marathon/client.rb', line 20

def update_app(id, definition)
  put(app_path(id), definition)
end