Class: Netscaler::NetscalerService

Inherits:
Object
  • Object
show all
Defined in:
lib/netscaler/netscaler_service.rb

Instance Method Summary collapse

Instance Method Details

#validate_payload(payload, required_args) ⇒ Object

Raises:

  • (ArgumentError)


3
4
5
6
7
8
9
10
11
12
# File 'lib/netscaler/netscaler_service.rb', line 3

def validate_payload(payload, required_args)
  payload = Netscaler.hash_hack(payload)
  raise ArgumentError, 'payload must be a hash.' unless payload.is_a?(Hash)
  missing_args=[]
  required_args.each do |arg|
    missing_args << arg unless payload[arg] != nil
  end

  raise ArgumentError, "Missing required arguments. #{missing_args.join(', ')}" unless missing_args.length == 0;
end