Class: Format

Inherits:
Object
  • Object
show all
Defined in:
lib/vmfloaty/format.rb

Class Method Summary collapse

Class Method Details

.get_hosts(hostname_hash) ⇒ Object

TODO: Takes the json response body from an HTTP GET request and “pretty prints” it



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/vmfloaty/format.rb', line 5

def self.get_hosts(hostname_hash)
  host_hash = {}

  hostname_hash.delete("ok")
  hostname_hash.each do |type, hosts|
    if type == "domain"
      host_hash[type] = hosts
    else
      host_hash[type] = hosts["hostname"]
    end
  end

  puts host_hash.to_json
end