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 - Initiate system workflow for review

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from SubCommandBase

banner

Methods included from OutputConverters

#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)


502
503
504
# File 'lib/emasser/get.rb', line 502

def self.exit_on_failure?
  true
end

Instance Method Details

#addObject



472
473
474
475
476
477
478
479
480
481
482
483
484
485
# File 'lib/emasser/post.rb', line 472

def add
  body = EmassClient::PacRequestBodyPost.new
  body.name = options[:name]
  body.type = options[:type]
  body.comments = options[:comments]

  body_array = Array.new(1, body)

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

#packageObject



511
512
513
514
515
516
517
518
# File 'lib/emasser/get.rb', line 511

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 ApprovalChainApi->get_system_'.red
  puts to_output_hash(e)
end