Class: Jamf::IBeacon

Inherits:
APIObject show all
Includes:
Creatable, Updatable
Defined in:
lib/jamf/api/classic/api_objects/ibeacon.rb

Overview

An iBeacon in the JSS.

See Also:

Constant Summary collapse

RSRC_BASE =

The base for REST resources of this class

'ibeacons'.freeze
RSRC_LIST_KEY =

the hash key used for the JSON list output of all objects in the JSS

:ibeacons
RSRC_OBJECT_KEY =

The hash key used for the JSON object output. It’s also used in various error messages

:ibeacon
OBJECT_HISTORY_OBJECT_TYPE =

the object type for this object in the object history table. See APIObject#add_object_history_entry

360
MAJOR_MINOR_RANGE =

The major & minor values, if used, must be in this range

0..65_535.freeze
MAJOR_MINOR_UNUSED =

If not used, this is the value for the major and minor

-1

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ IBeacon

Constructor

See Also:

  • APIObject.initialize


92
93
94
95
96
97
98
99
100
101
102
# File 'lib/jamf/api/classic/api_objects/ibeacon.rb', line 92

def initialize(**args)
  super

  @uuid = @init_data[:uuid]
  @major = @init_data[:major]
  @minor = @init_data[:minor]

  # defaults
  @major ||= MAJOR_MINOR_UNUSED
  @minor ||= MAJOR_MINOR_UNUSED
end

Instance Attribute Details

#majorIPAddr

an integer within MAJOR_MINOR_RANGE or MAJOR_MINOR_UNUSED

Returns:

  • (IPAddr)

    the mid-level region identifier,



83
84
85
# File 'lib/jamf/api/classic/api_objects/ibeacon.rb', line 83

def major
  @major
end

#minorIPAddr

an integer within MAJOR_MINOR_RANGE or MAJOR_MINOR_UNUSED

Returns:

  • (IPAddr)

    the low-level region identifier,



87
88
89
# File 'lib/jamf/api/classic/api_objects/ibeacon.rb', line 87

def minor
  @minor
end

#need_to_updateBoolean (readonly) Originally defined in module Updatable

Returns do we have unsaved changes?.

Returns:

  • (Boolean)

    do we have unsaved changes?

#uuidString

Returns the top-level region identifier, a valid UUID.

Returns:

  • (String)

    the top-level region identifier, a valid UUID



79
80
81
# File 'lib/jamf/api/classic/api_objects/ibeacon.rb', line 79

def uuid
  @uuid
end

Instance Method Details

#clone(new_name, api: nil, cnx: nil) ⇒ APIObject Originally defined in module Creatable

make a clone of this API object, with a new name. The class must be creatable

Parameters:

  • name (String)

    the name for the new object

  • cnx (Jamf::Connection) (defaults to: nil)

    the API in which to create the object Defaults to the API used to instantiate this object

Returns:

  • (APIObject)

    An unsaved clone of this APIObject with the given name

Raises:

#createObject

Raises:

See Also:

  • Creatable.create


166
167
168
169
170
# File 'lib/jamf/api/classic/api_objects/ibeacon.rb', line 166

def create
  raise Jamf::MissingDataError, 'uuid may not be empty' if @uuid.to_s.empty?

  super
end

#name=(newname) ⇒ void Originally defined in module Updatable

This method returns an undefined value.

Change the name of this item Remember to #update to push changes to the server.

Parameters:

  • newname (String)

    the new name

Raises:

#updateObject

Raises:

See Also:

  • Updatable.update


173
174
175
176
177
# File 'lib/jamf/api/classic/api_objects/ibeacon.rb', line 173

def update
  raise Jamf::MissingDataError, 'uuid may not be empty' if @uuid.to_s.empty?

  super
end

#using_major?Boolean

Returns is the major identifier being used in this region?.

Returns:

  • (Boolean)

    is the major identifier being used in this region?



156
157
158
# File 'lib/jamf/api/classic/api_objects/ibeacon.rb', line 156

def using_major?
  @major == MAJOR_MINOR_UNUSED
end

#using_minor?Boolean

Returns is the minor identifier being used in this region?.

Returns:

  • (Boolean)

    is the minor identifier being used in this region?



161
162
163
# File 'lib/jamf/api/classic/api_objects/ibeacon.rb', line 161

def using_minor?
  @minor == MAJOR_MINOR_UNUSED
end