Module: Jamf::Locatable
- Included in:
- MobileDevice
- Defined in:
- lib/jamf/api/mixins/locatable.rb
Overview
Classes mixing this in have a Jamf::Location instance in their :location attribute.
See the Jamf::JSONObject docs for OBJECT_MODEL for defining the :location attribute. It should always be marked ‘readonly: true`, since attempting to set the location as a whole will raise an error.
Instead of setting it as a whole, you must use the Jamf::Location object stored in the :location attribute to access it’s values, like so:
mycomputer.location.department # => 'Muggle Studies'
mycomputer.location.room = 'Great Hall'
All location attributes can be set that way, but building, room, department, & phoneNumber are more related to the physical location, so must be used that way.
The other attributes, username, realName, position, and emailAddress, are more related to the assinged user than the physical location, and are also acessible via the #user method, which returns a simple wrapper for those attributes, like this:
mycomputer.user.name # => 'adumble' user.username works too
mycomputer.user.realName = 'Albus Dumbledore'
mycomputer.user.position = 'Headmaster'
mycomputer.user.emailAddress = '[email protected]'
are more related to the machine and its physical location than to the user responsible for the machine.
Defined Under Namespace
Classes: User
Instance Method Summary collapse
Instance Method Details
#location=(_loc) ⇒ Object
59 60 61 |
# File 'lib/jamf/api/mixins/locatable.rb', line 59 def location=(_loc) raise Jamf::UnsupportedError, 'Location cannot be set as a whole, set its attributes individually' end |