Method: Voice::Actions::Input#validate_dtmf

Defined in:
lib/vonage/voice/actions/input.rb

#validate_dtmfObject

Raises:



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/vonage/voice/actions/input.rb', line 50

def validate_dtmf
  raise ClientError.new("Expected 'dtmf' to be included in 'type' parameter if 'dtmf' options specified") unless self.type.include?('dtmf')

  if self.dtmf[:timeOut]
    raise ClientError.new("Expected 'timeOut' to not be more than 10 seconds") if self.dtmf[:timeOut] > 10
  end

  if self.dtmf[:maxDigits]
    raise ClientError.new("Expected 'maxDigits' to not be more than 22") if self.dtmf[:maxDigits] > 22
  end

  if self.dtmf[:submitOnHash]
    raise ClientError.new("Invalid 'submitOnHash' value, must be a Boolean") unless self.dtmf[:submitOnHash] == true || self.dtmf[:submitOnHash] == false
  end
end