class Jamf::IBeacon
An iBeacon in the JSS
. @see Jamf::APIObject
Constants
- MAJOR_MINOR_RANGE
The major & minor values, if used, must be in this range
- MAJOR_MINOR_UNUSED
If not used, this is the value for the major and minor
- OBJECT_HISTORY_OBJECT_TYPE
the object type for this object in the object history table. See {APIObject#add_object_history_entry}
- RSRC_BASE
The base for REST resources of this class
- RSRC_LIST_KEY
the hash key used for the JSON list output of all objects in the
JSS
- RSRC_OBJECT_KEY
The hash key used for the JSON object output. It’s also used in various error messages
Attributes
@return [IPAddr] the mid-level region identifier,
an integer within MAJOR_MINOR_RANGE
or MAJOR_MINOR_UNUSED
@return [IPAddr] the low-level region identifier,
an integer within MAJOR_MINOR_RANGE
or MAJOR_MINOR_UNUSED
@return [String] the top-level region identifier, a valid UUID
Public Class Methods
Constructor @see Jamf::APIObject.initialize
Jamf::APIObject::new
# File lib/jamf/api/classic/api_objects/ibeacon.rb 92 def initialize(**args) 93 super 94 95 @uuid = @init_data[:uuid] 96 @major = @init_data[:major] 97 @minor = @init_data[:minor] 98 99 # defaults 100 @major ||= MAJOR_MINOR_UNUSED 101 @minor ||= MAJOR_MINOR_UNUSED 102 end
Public Instance Methods
@see Creatable.create
Jamf::APIObject::create
# File lib/jamf/api/classic/api_objects/ibeacon.rb 166 def create 167 raise Jamf::MissingDataError, 'uuid may not be empty' if @uuid.to_s.empty? 168 169 super 170 end
Set the major value to for this iBeacon region. Use nil or -1 to not use the major value
@param newval the new value
@return [void]
# File lib/jamf/api/classic/api_objects/ibeacon.rb 127 def major=(newval) 128 if newval.nil? || newval == MAJOR_MINOR_UNUSED 129 newval ||= MAJOR_MINOR_UNUSED 130 else 131 Jamf::Validate.ibeacon_major_minor newval 132 end 133 @major = newval 134 @need_to_update = true 135 end
Set the minoe value to for this iBeacon region. Use nil or -1 to not use the major value
@param newval the new value
@return [void]
# File lib/jamf/api/classic/api_objects/ibeacon.rb 144 def minor=(newval) 145 if newval.nil? || newval == MAJOR_MINOR_UNUSED 146 newval ||= MAJOR_MINOR_UNUSED 147 else 148 Jamf::Validate.ibeacon_major_minor newval 149 end 150 151 @minor = newval 152 @need_to_update = true 153 end
@see Updatable.update
Jamf::APIObject#update
# File lib/jamf/api/classic/api_objects/ibeacon.rb 173 def update 174 raise Jamf::MissingDataError, 'uuid may not be empty' if @uuid.to_s.empty? 175 176 super 177 end
@return is the major identifier being used in this region?
# File lib/jamf/api/classic/api_objects/ibeacon.rb 156 def using_major? 157 @major == MAJOR_MINOR_UNUSED 158 end
@return is the minor identifier being used in this region?
# File lib/jamf/api/classic/api_objects/ibeacon.rb 161 def using_minor? 162 @minor == MAJOR_MINOR_UNUSED 163 end
set the uuid
@param newval the new uuid
@return [void]
# File lib/jamf/api/classic/api_objects/ibeacon.rb 114 def uuid=(newval) 115 Jamf::Validate.uuid newval 116 @uuid = newval 117 @need_to_update = true 118 end
Private Instance Methods
the xml formated data for adding or updating this in the JSS
# File lib/jamf/api/classic/api_objects/ibeacon.rb 185 def rest_xml 186 doc = REXML::Document.new Jamf::Connection::XML_HEADER 187 ns = doc.add_element RSRC_OBJECT_KEY.to_s 188 ns.add_element('name').text = @name 189 ns.add_element('uuid').text = @uuid 190 ns.add_element('major').text = @major.to_s 191 ns.add_element('minor').text = @minor.to_s 192 doc.to_s 193 end