ads_common/lib/ads_common/parameters_validator.rb
def check_required_argument_present(arg, field)
      # At least one item required, none passed.
      if field[:min_occurs] > 0 and arg.nil?
        raise AdsCommon::Errors::MissingPropertyError.new(
            field[:name], field[:type])
      end
      # An object passed when an array is expected.
      if (field[:max_occurs] == :unbounded) and
          !(arg.nil? or arg.kind_of?(Array))
        raise AdsCommon::Errors::TypeMismatchError.new(
            Array, arg.class, field[:name])
      end
      # An array passed when an object is expected.
      if (field[:max_occurs] == 1) and arg.kind_of?(Array)
        raise AdsCommon::Errors::TypeMismatchError.new(
            field[:type], Array, field[:name])
      end
    end
def check_required_argument_present(arg, field)
      # At least one item required, none passed.
      if field[:min_occurs] > 0 and arg.nil?
        raise AdsCommon::Errors::MissingPropertyError.new(
            field[:name], field[:type])
      end
      # An object passed when an array is expected.
      if (field[:max_occurs] == :unbounded) and
          !(arg.nil? or arg.kind_of?(Array))
        raise AdsCommon::Errors::TypeMismatchError.new(
            Array, arg.class, field[:name])
      end
      # An array passed when an object is expected.
      if (field[:max_occurs] == 1) and arg.kind_of?(Array)
        raise AdsCommon::Errors::TypeMismatchError.new(
            field[:type], Array, field[:name])
      end
    end
Checks the provided data structure matches wsdl definition.