Method: JSS::PeripheralType#fields=

Defined in:
lib/jss/api_object/peripheral_type.rb

#fields=(new_fields) ⇒ void

This method returns an undefined value.

Replace the entire Array of field definitions. The :order of each will be set based on the indexes of the Array provided.



147
148
149
150
151
152
153
154
155
156
# File 'lib/jss/api_object/peripheral_type.rb', line 147

def fields= (new_fields)
  unless new_fields.kind_of? Array and  new_fields.reject{|c| c.kind_of? Hash }.empty?
    raise JSS::InvalidDataError, "Argument must be an Array of Hashes."
  end
  raise "A peripheral type can have a maximmum of 20 fields"  if new_fields.count > 20
  new_fields.each{ |f| field_ok? f }
  @fields = new_fields
  order_fields
  @need_to_update = true
end