Class: Binance::Utils::Validation

Inherits:
Object
  • Object
show all
Defined in:
lib/binance/utils/validation.rb

Overview

Client side validation

Class Method Summary collapse

Class Method Details

.invalid?(param_value) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
15
16
# File 'lib/binance/utils/validation.rb', line 12

def invalid?(param_value)
  param_value.nil? ||
    (array_or_hash?(param_value) && param_value.empty?) ||
    (param_value.respond_to?(:to_str) && param_value.empty?)
end

.require_param(param_name, param_value) ⇒ Object



8
9
10
# File 'lib/binance/utils/validation.rb', line 8

def require_param(param_name, param_value)
  raise Binance::RequiredParameterError.new(param_name, param_value) if invalid?(param_value)
end