Class: Validate

Inherits:
Object
  • Object
show all
Defined in:
lib/puppetclassify/validate.rb

Instance Method Summary collapse

Constructor Details

#initialize(nc_api_url, puppet_https) ⇒ Validate

Returns a new instance of Validate.



5
6
7
8
# File 'lib/puppetclassify/validate.rb', line 5

def initialize(nc_api_url, puppet_https)
  @nc_api_url = nc_api_url
  @puppet_https = puppet_https
end

Instance Method Details

#validate_group(group_info) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/puppetclassify/validate.rb', line 10

def validate_group(group_info)
  validate_res = @puppet_https.post("#{@nc_api_url}/v1/validate/group", group_info.to_json)

  unless validate_res.code.to_i == 200
    STDERR.puts "An error has occured validating the group: HTTP #{validate_res.code} #{validate_res.message}"
    STDERR.puts validate_res.body
  end
end