Method: JSS::Group#initialize

Defined in:
lib/jss-api/api_object/group.rb

#initialize(args = {}) ⇒ Group

When creating a new group in the JSS, you must call .new with a :type key and a value of :smart or :static, as well as a :name and the :id => :new

See Also:



139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/jss-api/api_object/group.rb', line 139

def initialize(args = {})

  if args[:id] == :new
    raise JSS::InvalidDataError, "New group creation must specify a :type of :smart or :static" unless GROUP_TYPES.include? args[:type]
  end

  super args

  @is_smart = @init_data[:is_smart] || (args[:type] == :smart)

  @members = if @init_data[self.class::MEMBER_CLASS::RSRC_LIST_KEY]
    @init_data[self.class::MEMBER_CLASS::RSRC_LIST_KEY]
  else
    []
  end

  @site = JSS::APIObject.get_name(@init_data[:site])

  parse_criteria

end