Class: Morpheus::SetupInterface

Inherits:
APIClient
  • Object
show all
Defined in:
lib/morpheus/api/setup_interface.rb

Overview

There is no authentication required for this API.

Instance Method Summary collapse

Instance Method Details

#authorization_required?Boolean

no Authorization header is required

Returns:

  • (Boolean)


6
7
8
# File 'lib/morpheus/api/setup_interface.rb', line 6

def authorization_required?
  false
end

#check(params = {}, timeout = 5) ⇒ Object

this should go away and just use



23
24
25
26
27
28
# File 'lib/morpheus/api/setup_interface.rb', line 23

def check(params={}, timeout=5)
  headers = {params: params}
  # use access token if authenticated
  headers[:authorization] = "Bearer #{@access_token}" if @access_token
  execute(method: :get, url: "/api/setup/check", headers: headers, timeout: timeout)
end

#default_timeoutObject

health checks use a relatively small timeout by default



11
12
13
# File 'lib/morpheus/api/setup_interface.rb', line 11

def default_timeout
  5
end

#get(params = {}) ⇒ Object



15
16
17
18
19
20
# File 'lib/morpheus/api/setup_interface.rb', line 15

def get(params={})
  headers = {params: params}
  # use access token if authenticated
  headers[:authorization] = "Bearer #{@access_token}" if @access_token
  execute(method: :get, url: "/api/setup", headers: headers)
end

#hub_login(payload = {}) ⇒ Object



41
42
43
44
# File 'lib/morpheus/api/setup_interface.rb', line 41

def (payload={})
  headers = { 'Content-Type' => 'application/json' }
  execute(method: :post, url: "/api/setup/hub-login", headers: headers, payload: payload.to_json)
end

#hub_register(payload = {}) ⇒ Object



36
37
38
39
# File 'lib/morpheus/api/setup_interface.rb', line 36

def hub_register(payload={})
  headers = { 'Content-Type' => 'application/json' }
  execute(method: :post, url: "/api/setup/hub-register", headers: headers, payload: payload.to_json)
end

#init(payload = {}) ⇒ Object

you can only use this successfully one time on a fresh install.



31
32
33
34
# File 'lib/morpheus/api/setup_interface.rb', line 31

def init(payload={})
  headers = { 'Content-Type' => 'application/json' }
  execute(method: :post, url: "/api/setup/init", headers: headers, payload: payload.to_json)
end