Module: JSS

Defined in:
lib/jss.rb,
lib/jss/client.rb,
lib/jss/server.rb,
lib/jss/version.rb,
lib/jss/composer.rb,
lib/jss/api_object.rb,
lib/jss/exceptions.rb,
lib/jss/configuration.rb,
lib/jss/db_connection.rb,
lib/jss/api_connection.rb,
lib/jss/api_object/site.rb,
lib/jss/api_object/user.rb,
lib/jss/api_object/ebook.rb,
lib/jss/api_object/group.rb,
lib/jss/api_object/policy.rb,
lib/jss/api_object/script.rb,
lib/jss/api_object/account.rb,
lib/jss/api_object/package.rb,
lib/jss/api_object/vppable.rb,
lib/jss/api_object/webhook.rb,
lib/jss/api_object/building.rb,
lib/jss/api_object/category.rb,
lib/jss/api_object/computer.rb,
lib/jss/api_object/scopable.rb,
lib/jss/api_object/creatable.rb,
lib/jss/api_object/locatable.rb,
lib/jss/api_object/matchable.rb,
lib/jss/api_object/updatable.rb,
lib/jss/api_object/department.rb,
lib/jss/api_object/extendable.rb,
lib/jss/api_object/peripheral.rb,
lib/jss/api_object/uploadable.rb,
lib/jss/api_object/criteriable.rb,
lib/jss/api_object/ldap_server.rb,
lib/jss/api_object/purchasable.rb,
lib/jss/api_object/categorizable.rb,
lib/jss/api_object/mobile_device.rb,
lib/jss/api_object/self_servable.rb,
lib/jss/api_object/netboot_server.rb,
lib/jss/api_object/scopable/scope.rb,
lib/jss/api_object/advanced_search.rb,
lib/jss/api_object/mac_application.rb,
lib/jss/api_object/network_segment.rb,
lib/jss/api_object/peripheral_type.rb,
lib/jss/api_object/group/user_group.rb,
lib/jss/api_object/removable_macaddr.rb,
lib/jss/api_object/distribution_point.rb,
lib/jss/api_object/self_servable/icon.rb,
lib/jss/api_object/computer_invitation.rb,
lib/jss/api_object/extension_attribute.rb,
lib/jss/api_object/restricted_software.rb,
lib/jss/api_object/criteriable/criteria.rb,
lib/jss/api_object/group/computer_group.rb,
lib/jss/api_object/criteriable/criterion.rb,
lib/jss/api_object/software_update_server.rb,
lib/jss/api_object/group/mobile_device_group.rb,
lib/jss/api_object/mobile_device_application.rb,
lib/jss/api_object/osx_configuration_profile.rb,
lib/jss/api_object/mobile_device_configuration_profile.rb,
lib/jss/api_object/advanced_search/advanced_user_search.rb,
lib/jss/api_object/advanced_search/advanced_computer_search.rb,
lib/jss/api_object/extension_attribute/user_extension_attribute.rb,
lib/jss/api_object/advanced_search/advanced_mobile_device_search.rb,
lib/jss/api_object/extension_attribute/computer_extension_attribute.rb,
lib/jss/api_object/extension_attribute/mobile_device_extension_attribute.rb

Overview

A mix-in module providing object-updating via the JSS API.

Defined Under Namespace

Modules: Categorizable, Composer, Creatable, Criteriable, Extendable, FileUpload, Locatable, Matchable, Purchasable, Scopable, SelfServable, Updatable, Uploadable, VPPable Classes: APIConnection, APIObject, Account, AdvancedComputerSearch, AdvancedMobileDeviceSearch, AdvancedSearch, AdvancedUserSearch, AlreadyExistsError, AuthenticationError, Building, Category, Client, Computer, ComputerExtensionAttribute, ComputerGroup, ComputerInvitation, Configuration, ConflictError, DBConnection, Department, DistributionPoint, EBook, ExtensionAttribute, FileServiceError, Group, Icon, InvalidConnectionError, InvalidDataError, LDAPServer, MacApplication, MissingDataError, MobileDevice, MobileDeviceApplication, MobileDeviceConfigurationProfile, MobileDeviceExtensionAttribute, MobileDeviceGroup, NetBootServer, NetworkSegment, NoSuchItemError, OSXConfigurationProfile, Package, Peripheral, PeripheralType, Policy, Preferences, RemovableMacAddress, RestrictedSoftware, Script, Server, Site, SoftwareUpdateServer, TimeoutError, UnmanagedError, UnsupportedError, User, UserExtensionAttribute, UserGroup, WebHook

Constant Summary collapse

MINIMUM_RUBY_VERSION =

The minimum Ruby version that works with this gem

'2.0.0'.freeze
MINIMUM_SERVER_VERSION =

The minimum JSS version that works with this gem, as returned by the API in the deprecated ‘jssuser’ resource

'9.4'.freeze
TIME_ZONE_OFFSET =

The current local UTC offset as a fraction of a day (Time.now.utc_offset is the offset in seconds, 60*60*24 is the seconds in a day)

Rational(Time.now.utc_offset, 60 * 60 * 24)
TRUE_FALSE =

These are handy for testing values without making new arrays, strings, etc every time.

[true, false].freeze
NIL_DATES =

When parsing a date/time data into a Time object, these will return nil

[0, nil, '', '0'].freeze
VERSION =

The version of the JSS ruby gem

'0.9.1'.freeze
CONFIG =

The single instance of Configuration

JSS::Configuration.instance
DB_CNX =

The single instance of the DBConnection

DBConnection.instance
API =

Save the default connection in the API constant, mostly for backward compatibility.

@api
@@stdin_lines =

The contents of anything piped to stdin, split into lines. See stdin

nil
@@master_distribution_point =

the master dist. point, see JSS.master_distribution_point

nil
@@my_distribution_point =

the dist point for this machine right now

nil

Class Method Summary collapse

Class Method Details

.apiJSS::APIConnection Also known as: api_connection, connection

The currently active JSS::APIConnection instance.

Returns:



752
753
754
# File 'lib/jss/api_connection.rb', line 752

def self.api
  @api
end

.dbMysql

Returns The mysql database available through the DBConnection.instance.

Returns:

  • (Mysql)

    The mysql database available through the DBConnection.instance



286
287
288
# File 'lib/jss/db_connection.rb', line 286

def self.db
  DB_CNX.db
end

.new_api_connection(args = {}) ⇒ APIConnection Also known as: new_connection, new_api

Create a new APIConnection object and use it for all future API calls. If connection options are provided, they are passed to the connect method immediately, otherwise JSS.api.connect must be called before attemting to use the connection.

Parameters:

Returns:



720
721
722
723
# File 'lib/jss/api_connection.rb', line 720

def self.new_api_connection(args = {})
  @api = APIConnection.new args
  @api
end

.use_api_connection(connection) ⇒ APIConnection Also known as: use_api, use_connection

Switch the connection used for all API interactions to the one provided. See APIConnection for details and examples of using multiple connections

Parameters:

  • connection (APIConnection)

    The APIConnection to use for future API calls. If omitted, use the default connection created when ruby-jss was loaded (which may or may not yet be connected)

Returns:



735
736
737
738
# File 'lib/jss/api_connection.rb', line 735

def self.use_api_connection(connection)
  raise 'API connections must be instances of JSS::APIConnection' unless connection.is_a? JSS::APIConnection
  @api = connection
end

.use_default_connectionvoid

This method returns an undefined value.

Make the default connection (Stored in JSS::API) active



744
745
746
# File 'lib/jss/api_connection.rb', line 744

def self.use_default_connection
  use_api_connection API
end