def check_field(field, value)
      ### get the field defs for this PeriphType, omitting the leading nil
      @field_defs ||= JSS::PeripheralType.fetch(:name => @type, api: @api).fields.compact

      ### we must have the right number of fields, and they must have the same names
      ### as the definition
      required_fields = @field_defs.map{|f| f[:name]}
      raise JSS::InvalidDataError, "Peripherals of type '#{@type}' doesn't have a field '#{field}', they only have: #{required_fields.join(', ')}" unless required_fields.include? field

      ### any menu fields can only have values as defined by the type.
      menu_flds = @field_defs.select{|f| f[:type] == "menu" }
      menu_flds.each do |mf|
        next unless mf[:name] == field
        raise JSS::InvalidDataError, "The value for field '#{field}' must be one of: #{mf[:choices].join(', ')}" unless mf[:choices].include? value
      end #if menu_flds.include? field

    end
def check_field(field, value)
      ### get the field defs for this PeriphType, omitting the leading nil
      @field_defs ||= JSS::PeripheralType.fetch(:name => @type, api: @api).fields.compact

      ### we must have the right number of fields, and they must have the same names
      ### as the definition
      required_fields = @field_defs.map{|f| f[:name]}
      raise JSS::InvalidDataError, "Peripherals of type '#{@type}' doesn't have a field '#{field}', they only have: #{required_fields.join(', ')}" unless required_fields.include? field

      ### any menu fields can only have values as defined by the type.
      menu_flds = @field_defs.select{|f| f[:type] == "menu" }
      menu_flds.each do |mf|
        next unless mf[:name] == field
        raise JSS::InvalidDataError, "The value for field '#{field}' must be one of: #{mf[:choices].join(', ')}" unless mf[:choices].include? value
      end #if menu_flds.include? field

    end
check a field, the field name must match those defined in
 the appropriate peripheral type.
 If a field is a menu field, the value must also be one of those defined
 in the periph type.
 Raise an exception if wrong.