lib/jss/api_object/mobile_device.rb in ruby-jss-1.2.6 vs lib/jss/api_object/mobile_device.rb in ruby-jss-1.2.9
- old
+ new
@@ -1,6 +1,6 @@
-### Copyright 2019 Pixar
+### Copyright 2020 Pixar
###
### Licensed under the Apache License, Version 2.0 (the "Apache License")
### with the following modification; you may not use this file except in
### compliance with the Apache License and the following modification to it:
@@ -525,19 +525,22 @@
@need_to_update = true
end
#
def asset_tag=(new_val)
+ new_val = new_val.strip
return nil if @asset_tag == new_val
- new_val.strip!
+
@asset_tag = new_val
@need_to_update = true
end
- #
- def update
- super
- return @id unless @needs_mdm_name_change
+ # @param no_mdm_rename[Boolean] should a MDM `set device name` command be sent
+ # if the device is managed and supervised?
+ def update(no_mdm_rename: false)
+ super()
+ return @id if no_mdm_rename || !@needs_mdm_name_change
+
set_device_name @name if managed? && supervised?
@needs_mdm_name_change = false
@id
end