Class: JSS::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/jss-api/server.rb,
lib/jss-api.rb

Overview

A class representing a JSS Server.

The APIConnection instance has a JSS::Server instance in its @server attribute. It is created fresh every time APIConnection#connect is called.

That’s the only time it should be instantiated, and all access should be through JSS::API.server

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeServer

Initialize!



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/jss-api/server.rb', line 77

def initialize
  begin

    # the jssuser resource is readable by anyone with a JSS acct
    # regardless of their permissions.
    # However, it's marked as 'deprecated'. Hopefully jamf will
    # keep this basic level of info available for basic authentication
    # and JSS version checking.
    ju = JSS::API.get_rsrc('jssuser')[:user]
    @license_type = ju[:license_type]
    @product = ju[:product]
    @raw_version = ju[:version]
    parsed = JSS.parse_jss_version(@raw_version)
    @major_version = parsed[:major]
    @minor_version = parsed[:minor]
    @revision_version = parsed[:revision]
    @version = parsed[:version]

  rescue RestClient::Request::Unauthorized
    raise JSS::AuthenticationError, "Incorrect JSS username or password for '#{JSS::API.jss_user}@#{JSS::API.server_host}'."
  end

end

Instance Attribute Details

#activation_codeString (readonly)



47
48
49
# File 'lib/jss-api/server.rb', line 47

def activation_code
  @activation_code
end

#license_typeString (readonly)



50
51
52
# File 'lib/jss-api/server.rb', line 50

def license_type
  @license_type
end

#major_versionObject (readonly)

@return [Integer]



59
60
61
# File 'lib/jss-api/server.rb', line 59

def major_version
  @major_version
end

#minor_versionObject (readonly)

@return [Integer]



62
63
64
# File 'lib/jss-api/server.rb', line 62

def minor_version
  @minor_version
end

#organizationString (readonly) Also known as: institution



43
44
45
# File 'lib/jss-api/server.rb', line 43

def organization
  @organization
end

#productString (readonly) Also known as: product_name



53
54
55
# File 'lib/jss-api/server.rb', line 53

def product
  @product
end

#raw_versionObject (readonly)

@return [String]



68
69
70
# File 'lib/jss-api/server.rb', line 68

def raw_version
  @raw_version
end

#revision_versionObject (readonly)

@return [Integer]



65
66
67
# File 'lib/jss-api/server.rb', line 65

def revision_version
  @revision_version
end

#versionObject (readonly)

@return [String] The version of the JSS. See the method JSS.parse_jss_version



56
57
58
# File 'lib/jss-api/server.rb', line 56

def version
  @version
end