Class: Jamf::ComputerInvitation

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

Overview

This class represents a Computer Invitation in the JSS.

Adding Computer Invitations to the JSS

This class is meant only to generate and hold the response of creating an invitation.

See Also:

Constant Summary collapse

RSRC_BASE =

The base for REST resources of this class

'computerinvitations'.freeze
RSRC_LIST_KEY =

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

:computer_invitations
RSRC_OBJECT_KEY =

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

:computer_invitation
OTHER_LOOKUP_KEYS =

See Jamf::APIObject

{
  invitation: { fetch_rsrc_key: :invitation }
}.freeze
OBJECT_HISTORY_OBJECT_TYPE =

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

84
SITE_SUBSET =

Where is site data located in the API JSON?

:top

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = { id: :new, name: 'some_new_name', ssh_username: 'casper_remote', hide_account: 'true' }) ⇒ ComputerInvitation

Returns a new instance of ComputerInvitation.



118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/jamf/api/classic/api_objects/computer_invitation.rb', line 118

def initialize(args = {
  id: :new,
  name: 'some_new_name',
  ssh_username: 'casper_remote',
  hide_account: 'true'
})
  super args

  @name = @init_data[:invitation]
  @invitation_type = @init_data[:invitation_type]
   = @init_data[:create_account_if_does_not_exist]
  @expiration_date_epoch = @init_data[:expiration_date_epoch] || args[:expiration_date_epoch]
  @ssh_username = @init_data[:ssh_username] || args[:ssh_username]
   = @init_data[:hide_account] || args[:hide_account]
  @invitation_status = @init_data[:invitation_status] || args[:invitation_status]
  @multiple_uses_allowed = @init_data[:multiple_uses_allowed] || args[:multiple_uses_allowed]
end

Instance Attribute Details

#create_account_if_does_not_existString

“true” or “false” are valid values.



82
83
84
# File 'lib/jamf/api/classic/api_objects/computer_invitation.rb', line 82

def 
  
end

#expiration_date_epochString

Time since epoch that the invitation will expire at.

Note: defaults to “Unlimited”, so only set if it should expire.



89
90
91
# File 'lib/jamf/api/classic/api_objects/computer_invitation.rb', line 89

def expiration_date_epoch
  @expiration_date_epoch
end

#hide_accountString

The whether or not to hide the ssh user.



101
102
103
# File 'lib/jamf/api/classic/api_objects/computer_invitation.rb', line 101

def 
  
end

#invitation_statusString

The invitation_status.



106
107
108
# File 'lib/jamf/api/classic/api_objects/computer_invitation.rb', line 106

def invitation_status
  @invitation_status
end

#invitation_typeString

Valid values are: URL and EMAIL. Will default to DEFAULT.



77
78
79
# File 'lib/jamf/api/classic/api_objects/computer_invitation.rb', line 77

def invitation_type
  @invitation_type
end

#multiple_uses_allowedString

Whether the invitation can be used multiple times (boolean).



111
112
113
# File 'lib/jamf/api/classic/api_objects/computer_invitation.rb', line 111

def multiple_uses_allowed
  @multiple_uses_allowed
end

#nameString (readonly)



72
73
74
# File 'lib/jamf/api/classic/api_objects/computer_invitation.rb', line 72

def name
  @name
end

#ssh_usernameString

The username of the ssh user to be created.

REQUIRED for valid setup.



96
97
98
# File 'lib/jamf/api/classic/api_objects/computer_invitation.rb', line 96

def ssh_username
  @ssh_username
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

#createJamf::ComputerInvitation

Needed to support creation of new Computer Invitations to set their name.



143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/jamf/api/classic/api_objects/computer_invitation.rb', line 143

def create
  new_invitation_id = super

  jss_me = ComputerInvitation.fetch(id: new_invitation_id, name: 'set_by_request')
  @name = jss_me.name
  @invitation_type = jss_me.invitation_type
   = jss_me.
  @expiration_date_epoch = jss_me.expiration_date_epoch
  @ssh_username = jss_me.ssh_username
   = jss_me.
  @invitation_status = jss_me.invitation_status
  @multiple_uses_allowed = jss_me.multiple_uses_allowed
end

#site=(new_site) ⇒ void Originally defined in module Sitable

This method returns an undefined value.

Change the site of this object. Any of the NON_SITES values will unset the site

#site_assigned?Boolean Originally defined in module Sitable

Does this object have a site assigned?

#site_idInteger Originally defined in module Sitable

The id of the site for this object.

#site_nameString Also known as: site Originally defined in module Sitable

The name of the site for this object. For backward compatibility, this is aliased to just ‘site’

#site_objectJamf::Site Originally defined in module Sitable

The Jamf::Site instance for this object’s site

#unset_sitevoid Originally defined in module Sitable

This method returns an undefined value.

Set the site to nothing