Class: Emasser::PAC

Inherits:
SubCommandBase show all
Defined in:
lib/emasser/get.rb,
lib/emasser/post.rb

Overview

Add a Package Approval Chain (PAC)

Endpoints:

/api/systems/{systemId}/approval/pac

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from SubCommandBase

banner

Methods included from OutputConverters

#change_to_datetime, #to_output_hash

Methods included from InputConverters

#to_input_hash

Methods included from OptionsParser

#optional_options, #required_options

Class Method Details

.exit_on_failure?Boolean

Returns:

  • (Boolean)


540
541
542
# File 'lib/emasser/get.rb', line 540

def self.exit_on_failure?
  true
end

Instance Method Details

#addObject



557
558
559
560
561
562
563
564
565
566
567
568
569
570
# File 'lib/emasser/post.rb', line 557

def add
  body = EmassClient::PacGet.new
  body.name = options[:name]
  body.workflow = options[:workflow]
  body.comments = options[:comments]

  body_array = Array.new(1, body)

  result = EmassClient::PACApi.new.add_system_pac(options[:systemId], body_array)
  puts to_output_hash(result).green
rescue EmassClient::ApiError => e
  puts 'Exception when calling ApprovalChainApi->add_system_pac'.red
  puts to_output_hash(e)
end

#packageObject



549
550
551
552
553
554
555
556
# File 'lib/emasser/get.rb', line 549

def package
  # Get location of system package in PAC
  result = EmassClient::PACApi.new.get_system_pac(options[:systemId])
  puts to_output_hash(result).green
rescue EmassClient::ApiError => e
  puts 'Exception when calling PACApi->get_system_pac'.red
  puts to_output_hash(e)
end